Framerate controller for VP9 screen sharing.
- Limit framerate by dropping frames before encoding. - The max framerate at screen sharing is set to 5fps. Bug: webrtc:9261 Change-Id: Icfbbecce33fdce2d746291708db0108e0ba10760 Reviewed-on: https://webrtc-review.googlesource.com/76921 Commit-Queue: Sergey Silkin <ssilkin@webrtc.org> Reviewed-by: Erik Språng <sprang@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23316}
This commit is contained in:
committed by
Commit Bot
parent
a832019f4e
commit
d902d58b0a
@ -10,6 +10,7 @@
|
||||
|
||||
#include "api/video/i420_buffer.h"
|
||||
#include "common_video/libyuv/include/webrtc_libyuv.h"
|
||||
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
|
||||
#include "modules/video_coding/codecs/test/video_codec_unittest.h"
|
||||
#include "modules/video_coding/codecs/vp9/include/vp9.h"
|
||||
#include "modules/video_coding/codecs/vp9/svc_config.h"
|
||||
@ -425,4 +426,38 @@ TEST_F(TestVp9Impl,
|
||||
}
|
||||
}
|
||||
|
||||
class TestVp9ImplFrameDropping : public TestVp9Impl {
|
||||
protected:
|
||||
void ModifyCodecSettings(VideoCodec* codec_settings) override {
|
||||
webrtc::test::CodecSettings(kVideoCodecVP9, codec_settings);
|
||||
// We need to encode quite a lot of frames in this test. Use low resolution
|
||||
// to reduce execution time.
|
||||
codec_settings->width = 64;
|
||||
codec_settings->height = 64;
|
||||
codec_settings->mode = kScreensharing;
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(TestVp9ImplFrameDropping, PreEncodeFrameDropping) {
|
||||
const size_t num_frames_to_encode = 100;
|
||||
const float input_framerate_fps = 30.0;
|
||||
const float video_duration_secs = num_frames_to_encode / input_framerate_fps;
|
||||
const float expected_framerate_fps = 5.0f;
|
||||
const float max_abs_framerate_error_fps = expected_framerate_fps * 0.1f;
|
||||
|
||||
VideoFrame* input_frame = NextInputFrame();
|
||||
for (size_t frame_num = 0; frame_num < num_frames_to_encode; ++frame_num) {
|
||||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
||||
encoder_->Encode(*input_frame, nullptr, nullptr));
|
||||
const size_t timestamp = input_frame->timestamp() +
|
||||
kVideoPayloadTypeFrequency / input_framerate_fps;
|
||||
input_frame->set_timestamp(static_cast<uint32_t>(timestamp));
|
||||
}
|
||||
|
||||
const size_t num_encoded_frames = GetNumEncodedFrames();
|
||||
const float encoded_framerate_fps = num_encoded_frames / video_duration_secs;
|
||||
EXPECT_NEAR(encoded_framerate_fps, expected_framerate_fps,
|
||||
max_abs_framerate_error_fps);
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
Reference in New Issue
Block a user