Add unit test ReportsUpdatedVideoLayersAllocationWhenResolutionChanges
This test that a new allocation is reported if the input resolution changes. Bug: webrtc:12000 Change-Id: Iaf8be1af62bbc8a2ca19b58f0587ceacfcfa5991 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/197807 Reviewed-by: Erik Språng <sprang@webrtc.org> Commit-Queue: Per Kjellander <perkj@webrtc.org> Cr-Commit-Position: refs/heads/master@{#32837}
This commit is contained in:
parent
46ea5d7f82
commit
4190ce995b
@ -67,6 +67,7 @@ using ::testing::Lt;
|
||||
using ::testing::Matcher;
|
||||
using ::testing::NiceMock;
|
||||
using ::testing::Return;
|
||||
using ::testing::SizeIs;
|
||||
using ::testing::StrictMock;
|
||||
|
||||
namespace {
|
||||
@ -4122,6 +4123,44 @@ TEST_F(VideoStreamEncoderTest,
|
||||
video_stream_encoder_->Stop();
|
||||
}
|
||||
|
||||
TEST_F(VideoStreamEncoderTest,
|
||||
ReportsUpdatedVideoLayersAllocationWhenResolutionChanges) {
|
||||
ResetEncoder("VP8", /*num_streams*/ 2, 1, 1, /*screenshare*/ false,
|
||||
VideoStreamEncoderSettings::BitrateAllocationCallbackType::
|
||||
kVideoLayersAllocation);
|
||||
|
||||
video_stream_encoder_->OnBitrateUpdatedAndWaitForManagedResources(
|
||||
DataRate::BitsPerSec(kSimulcastTargetBitrateBps),
|
||||
DataRate::BitsPerSec(kSimulcastTargetBitrateBps),
|
||||
DataRate::BitsPerSec(kSimulcastTargetBitrateBps), 0, 0, 0);
|
||||
|
||||
video_source_.IncomingCapturedFrame(
|
||||
CreateFrame(CurrentTimeMs(), codec_width_, codec_height_));
|
||||
WaitForEncodedFrame(CurrentTimeMs());
|
||||
EXPECT_EQ(sink_.number_of_layers_allocations(), 1);
|
||||
ASSERT_THAT(sink_.GetLastVideoLayersAllocation().active_spatial_layers,
|
||||
SizeIs(2));
|
||||
EXPECT_EQ(sink_.GetLastVideoLayersAllocation().active_spatial_layers[1].width,
|
||||
codec_width_);
|
||||
EXPECT_EQ(
|
||||
sink_.GetLastVideoLayersAllocation().active_spatial_layers[1].height,
|
||||
codec_height_);
|
||||
|
||||
video_source_.IncomingCapturedFrame(
|
||||
CreateFrame(CurrentTimeMs(), codec_width_ / 2, codec_height_ / 2));
|
||||
WaitForEncodedFrame(CurrentTimeMs());
|
||||
EXPECT_EQ(sink_.number_of_layers_allocations(), 2);
|
||||
ASSERT_THAT(sink_.GetLastVideoLayersAllocation().active_spatial_layers,
|
||||
SizeIs(2));
|
||||
EXPECT_EQ(sink_.GetLastVideoLayersAllocation().active_spatial_layers[1].width,
|
||||
codec_width_ / 2);
|
||||
EXPECT_EQ(
|
||||
sink_.GetLastVideoLayersAllocation().active_spatial_layers[1].height,
|
||||
codec_height_ / 2);
|
||||
|
||||
video_stream_encoder_->Stop();
|
||||
}
|
||||
|
||||
TEST_F(VideoStreamEncoderTest, TemporalLayersNotDisabledIfSupported) {
|
||||
// 2 TLs configured, temporal layers supported by encoder.
|
||||
const int kNumTemporalLayers = 2;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user