Add initial support for RtpEncodingParameters max_framerate.

Add support to set the framerate to the maximum of |max_framerate|.
Different framerates are currently not supported per stream for video.

Bug: webrtc:9597
Change-Id: Ie326617b66bd97be387f809a7f82b97b8f3ff5fe
Reviewed-on: https://webrtc-review.googlesource.com/92392
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Commit-Queue: Åsa Persson <asapersson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24270}
This commit is contained in:
Åsa Persson
2018-08-10 16:16:43 +02:00
committed by Commit Bot
parent 553b6f68e1
commit ced5cfdb35
14 changed files with 387 additions and 167 deletions

View File

@ -493,7 +493,7 @@ TEST_F(CallPerfTest, ReceivesCpuOveruseAndUnderuse) {
class LoadObserver : public test::SendTest,
public test::FrameGeneratorCapturer::SinkWantsObserver {
public:
LoadObserver() : SendTest(kLongTimeoutMs), test_phase_(TestPhase::kStart) {}
LoadObserver() : SendTest(kLongTimeoutMs), test_phase_(TestPhase::kInit) {}
void OnFrameGeneratorCapturerCreated(
test::FrameGeneratorCapturer* frame_generator_capturer) override {
@ -507,9 +507,21 @@ TEST_F(CallPerfTest, ReceivesCpuOveruseAndUnderuse) {
// TODO(sprang): Add integration test for maintain-framerate mode?
void OnSinkWantsChanged(rtc::VideoSinkInterface<VideoFrame>* sink,
const rtc::VideoSinkWants& wants) override {
// First expect CPU overuse. Then expect CPU underuse when the encoder
// At kStart expect CPU overuse. Then expect CPU underuse when the encoder
// delay has been decreased.
switch (test_phase_) {
case TestPhase::kInit:
// Max framerate should be set initially.
if (wants.max_framerate_fps != std::numeric_limits<int>::max() &&
wants.max_pixel_count == std::numeric_limits<int>::max()) {
test_phase_ = TestPhase::kStart;
} else {
ADD_FAILURE() << "Got unexpected adaptation request, max res = "
<< wants.max_pixel_count << ", target res = "
<< wants.target_pixel_count.value_or(-1)
<< ", max fps = " << wants.max_framerate_fps;
}
break;
case TestPhase::kStart:
if (wants.max_pixel_count < std::numeric_limits<int>::max()) {
// On adapting down, VideoStreamEncoder::VideoSourceProxy will set
@ -553,7 +565,12 @@ TEST_F(CallPerfTest, ReceivesCpuOveruseAndUnderuse) {
EXPECT_TRUE(Wait()) << "Timed out before receiving an overuse callback.";
}
enum class TestPhase { kStart, kAdaptedDown, kAdaptedUp } test_phase_;
enum class TestPhase {
kInit,
kStart,
kAdaptedDown,
kAdaptedUp
} test_phase_;
} test;
RunBaseTest(&test);