Skip to content
Snippets Groups Projects
Commit 3e5d652e authored by Philippe Gorley's avatar Philippe Gorley Committed by Guillaume Roguez
Browse files

android: improve vp8 video streaming


During a VP8 video call on the android client, the peer video freezes.
Optimizes android video buffers using an array instead of a vector. Lets
VP8 decide when to send a keyframe.

Change-Id: I19893c2ac080782daee72958fb6c174eea42037a
Reviewed-by: default avatarGuillaume Roguez <guillaume.roguez@savoirfairelinux.com>
parent ec2f1ebe
No related branches found
No related tags found
No related merge requests found
......@@ -181,11 +181,10 @@ MediaEncoder::openOutput(const char *filename,
av_opt_set_int(encoderCtx_->priv_data, "error-resilient", 1, 0);
av_opt_set_int(encoderCtx_->priv_data, "cpu-used", 3, 0);
av_opt_set_int(encoderCtx_->priv_data, "lag-in-frames", 0, 0);
// don't set encoderCtx_->gop_size: let libvpx decide when to insert a keyframe
encoderCtx_->slices = 2; // VP8E_SET_TOKEN_PARTITIONS
encoderCtx_->qmin = 4;
encoderCtx_->qmax = 56;
encoderCtx_->gop_size = 999999;
encoderCtx_->rc_buffer_size = maxBitrate;
encoderCtx_->bit_rate = maxBitrate;
if (crf != SystemCodecInfo::DEFAULT_NO_QUALITY) {
......
......@@ -57,7 +57,7 @@ VideoInput::VideoInput()
std::bind(&VideoInput::process, this),
std::bind(&VideoInput::cleanup, this))
#if defined(__ANDROID__) || defined(RING_UWP)
, mutex_(), frame_cv_(), buffers_(8)
, mutex_(), frame_cv_(), buffers_()
#endif
{}
......
......@@ -34,6 +34,7 @@
#include <string>
#include <mutex>
#include <condition_variable>
#include <array>
namespace ring {
class MediaDecoder;
......@@ -132,7 +133,7 @@ private:
/* Get notified when libav is done with this buffer */
void releaseBufferCb(uint8_t* ptr);
std::vector<struct VideoFrameBuffer> buffers_;
std::array<struct VideoFrameBuffer, 8> buffers_;
#endif
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment