Ensure FakeVp8Encoder::GetEncoderInfo() writes EncoderInfo.fps_allocation:

Bug: webrtc:10155
Change-Id: I9ba5ec97319a89890b218758fa230bc27c2a917e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/185805
Commit-Queue: Per Kjellander <perkj@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32241}
This commit is contained in:
Per Kjellander
2020-09-29 20:00:03 +02:00
committed by Commit Bot
parent e820cef534
commit be0aec2174
5 changed files with 30 additions and 0 deletions

View File

@ -34,6 +34,8 @@ class SimulcastTestFixture {
virtual void TestSpatioTemporalLayers321PatternEncoder() = 0;
virtual void TestStrideEncodeDecode() = 0;
virtual void TestDecodeWidthHeightSet() = 0;
virtual void
TestEncoderInfoForDefaultTemporalLayerProfileHasFpsAllocation() = 0;
};
} // namespace test

View File

@ -903,5 +903,15 @@ void SimulcastTestFixtureImpl::TestDecodeWidthHeightSet() {
EXPECT_EQ(0, decoder_->Decode(encoded_frame[2], false, 0));
}
void SimulcastTestFixtureImpl::
TestEncoderInfoForDefaultTemporalLayerProfileHasFpsAllocation() {
VideoEncoder::EncoderInfo encoder_info = encoder_->GetEncoderInfo();
EXPECT_EQ(encoder_info.fps_allocation[0].size(),
static_cast<size_t>(kDefaultTemporalLayerProfile[0]));
EXPECT_EQ(encoder_info.fps_allocation[1].size(),
static_cast<size_t>(kDefaultTemporalLayerProfile[1]));
EXPECT_EQ(encoder_info.fps_allocation[2].size(),
static_cast<size_t>(kDefaultTemporalLayerProfile[2]));
}
} // namespace test
} // namespace webrtc

View File

@ -50,6 +50,7 @@ class SimulcastTestFixtureImpl final : public SimulcastTestFixture {
void TestSpatioTemporalLayers321PatternEncoder() override;
void TestStrideEncodeDecode() override;
void TestDecodeWidthHeightSet() override;
void TestEncoderInfoForDefaultTemporalLayerProfileHasFpsAllocation() override;
static void DefaultSettings(VideoCodec* settings,
const int* temporal_layer_profile,

View File

@ -112,6 +112,17 @@ CodecSpecificInfo FakeVp8Encoder::EncodeHook(
VideoEncoder::EncoderInfo FakeVp8Encoder::GetEncoderInfo() const {
EncoderInfo info;
info.implementation_name = "FakeVp8Encoder";
MutexLock lock(&mutex_);
for (int sid = 0; sid < config_.numberOfSimulcastStreams; ++sid) {
int number_of_temporal_layers =
config_.simulcastStream[sid].numberOfTemporalLayers;
info.fps_allocation[sid].clear();
for (int tid = 0; tid < number_of_temporal_layers; ++tid) {
// {1/4, 1/2, 1} allocation for num layers = 3.
info.fps_allocation[sid].push_back(255 /
(number_of_temporal_layers - tid));
}
}
return info;
}

View File

@ -104,5 +104,11 @@ TEST(TestFakeVp8Codec, TestDecodeWidthHeightSet) {
fixture->TestDecodeWidthHeightSet();
}
TEST(TestFakeVp8Codec,
TestEncoderInfoForDefaultTemporalLayerProfileHasFpsAllocation) {
auto fixture = CreateSpecificSimulcastTestFixture();
fixture->TestEncoderInfoForDefaultTemporalLayerProfileHasFpsAllocation();
}
} // namespace test
} // namespace webrtc