Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

Commit

Permalink
Ensure FakeVp8Encoder::GetEncoderInfo() writes EncoderInfo.fps_alloca…
Browse files Browse the repository at this point in the history
…tion:

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}
  • Loading branch information
perkj authored and Commit Bot committed Sep 29, 2020
1 parent e820cef commit be0aec2
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 0 deletions.
2 changes: 2 additions & 0 deletions api/test/simulcast_test_fixture.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ class SimulcastTestFixture {
virtual void TestSpatioTemporalLayers321PatternEncoder() = 0;
virtual void TestStrideEncodeDecode() = 0;
virtual void TestDecodeWidthHeightSet() = 0;
virtual void
TestEncoderInfoForDefaultTemporalLayerProfileHasFpsAllocation() = 0;
};

} // namespace test
Expand Down
10 changes: 10 additions & 0 deletions modules/video_coding/utility/simulcast_test_fixture_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions modules/video_coding/utility/simulcast_test_fixture_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
11 changes: 11 additions & 0 deletions test/fake_vp8_encoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
6 changes: 6 additions & 0 deletions test/fake_vp8_encoder_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,11 @@ TEST(TestFakeVp8Codec, TestDecodeWidthHeightSet) {
fixture->TestDecodeWidthHeightSet();
}

TEST(TestFakeVp8Codec,
TestEncoderInfoForDefaultTemporalLayerProfileHasFpsAllocation) {
auto fixture = CreateSpecificSimulcastTestFixture();
fixture->TestEncoderInfoForDefaultTemporalLayerProfileHasFpsAllocation();
}

} // namespace test
} // namespace webrtc

0 comments on commit be0aec2

Please sign in to comment.