Remove TemporalLayersFactory and associated classes

As the rate allocation has been moved into entirely into
SimulcastRateAllocator, and the listeners are thus no longer needed,
this class doesn't fill any other purpose than to determine if
ScreenshareLayers or TemporalLayers should be created for a given
simulcast stream. This can however be done just from looking at the
VideoCodec instance, so changing this into a static factory method.

Due to dependencies from upstream projects, keep the class name and
field in VideoCodec around for now.

Bug: webrtc:9012
Change-Id: I028fe6b2a19e0d16b35956cc2df01dcf5bfa7979
Reviewed-on: https://webrtc-review.googlesource.com/63264
Commit-Queue: Erik Språng <sprang@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22529}
This commit is contained in:
Erik Språng
2018-03-21 09:57:23 +01:00
committed by Commit Bot
parent 8fc7948cc2
commit 82fad3d513
23 changed files with 103 additions and 350 deletions

View File

@ -81,23 +81,7 @@ class SimulcastRateAllocatorTest : public ::testing::TestWithParam<bool> {
}
void CreateAllocator() {
std::unique_ptr<TemporalLayersFactory> tl_factory(GetTlFactory());
codec_.VP8()->tl_factory = tl_factory.get();
allocator_.reset(new SimulcastRateAllocator(codec_, std::move(tl_factory)));
// Simulate InitEncode().
tl_factories_.clear();
if (codec_.numberOfSimulcastStreams == 0) {
tl_factories_.push_back(
std::unique_ptr<TemporalLayers>(codec_.VP8()->tl_factory->Create(
0, codec_.VP8()->numberOfTemporalLayers, 0)));
} else {
for (uint32_t i = 0; i < codec_.numberOfSimulcastStreams; ++i) {
tl_factories_.push_back(
std::unique_ptr<TemporalLayers>(codec_.VP8()->tl_factory->Create(
i, codec_.simulcastStream[i].numberOfTemporalLayers, 0)));
}
}
allocator_.reset(new SimulcastRateAllocator(codec_));
}
void SetupCodecThreeSimulcastStreams(
@ -128,10 +112,6 @@ class SimulcastRateAllocatorTest : public ::testing::TestWithParam<bool> {
}
}
virtual std::unique_ptr<TemporalLayersFactory> GetTlFactory() {
return std::unique_ptr<TemporalLayersFactory>(new TemporalLayersFactory());
}
BitrateAllocation GetAllocation(uint32_t target_bitrate) {
return allocator_->GetAllocation(target_bitrate * 1000U, kDefaultFrameRate);
}
@ -140,7 +120,6 @@ class SimulcastRateAllocatorTest : public ::testing::TestWithParam<bool> {
static const int kDefaultFrameRate = 30;
VideoCodec codec_;
std::unique_ptr<SimulcastRateAllocator> allocator_;
std::vector<std::unique_ptr<TemporalLayers>> tl_factories_;
};
TEST_F(SimulcastRateAllocatorTest, NoSimulcastBelowMin) {
@ -485,8 +464,7 @@ TEST_F(SimulcastRateAllocatorTest, ThreeStreamsMiddleInactive) {
TEST_F(SimulcastRateAllocatorTest, GetPreferredBitrateBps) {
MockTemporalLayers mock_layers;
allocator_.reset(new SimulcastRateAllocator(codec_, nullptr));
allocator_->OnTemporalLayersCreated(0, &mock_layers);
allocator_.reset(new SimulcastRateAllocator(codec_));
EXPECT_CALL(mock_layers, OnRatesUpdated(_, _)).Times(0);
EXPECT_EQ(codec_.maxBitrate * 1000,
allocator_->GetPreferredBitrateBps(codec_.maxFramerate));
@ -540,11 +518,6 @@ class ScreenshareRateAllocationTest : public SimulcastRateAllocatorTest {
codec_.active = active;
}
}
std::unique_ptr<TemporalLayersFactory> GetTlFactory() override {
return std::unique_ptr<TemporalLayersFactory>(
new ScreenshareTemporalLayersFactory());
}
};
INSTANTIATE_TEST_CASE_P(ScreenshareTest,