Make VP8 DefaultTemporalLayers always report TL count even with no rate.

If at creation of a VP8 encoder there is not enough bitrate to enable a
given spatial layer - the configuration won't be updated to indicate
the correct temporal layer count. This means GetEncoderInfo() will
indicate lack of temporal layer support, which triggers issues with
rate allocation.

This CL fixes that by always setting an initial bitrate of 0bps.

Bug: webrtc:12788
Change-Id: I10974e85446b58e597d2ca415eaf2550306ce986
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/220929
Commit-Queue: Erik Språng <sprang@webrtc.org>
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34198}
This commit is contained in:
Erik Språng
2021-06-02 11:07:50 +02:00
committed by WebRTC LUCI CQ
parent 1c7ff0d001
commit 486b0401c5
2 changed files with 21 additions and 1 deletions

View File

@ -265,7 +265,8 @@ DefaultTemporalLayers::DefaultTemporalLayers(int number_of_temporal_layers)
temporal_ids_(GetTemporalIds(num_layers_)),
temporal_pattern_(GetDependencyInfo(num_layers_)),
is_static_buffer_(DetermineStaticBuffers(temporal_pattern_)),
pattern_idx_(kUninitializedPatternIndex) {
pattern_idx_(kUninitializedPatternIndex),
new_bitrates_bps_(std::vector<uint32_t>(num_layers_, 0u)) {
RTC_CHECK_GE(kMaxTemporalStreams, number_of_temporal_layers);
RTC_CHECK_GE(number_of_temporal_layers, 0);
RTC_CHECK_LE(number_of_temporal_layers, 4);

View File

@ -687,6 +687,25 @@ TEST_F(TemporalLayersTest, KeyFrame) {
}
}
TEST_F(TemporalLayersTest, SetsTlCountOnFirstConfigUpdate) {
// Create an instance and fetch config update without setting any rate.
constexpr int kNumLayers = 2;
DefaultTemporalLayers tl(kNumLayers);
Vp8EncoderConfig config = tl.UpdateConfiguration(0);
// Config should indicate correct number of temporal layers, but zero bitrate.
ASSERT_TRUE(config.temporal_layer_config.has_value());
EXPECT_EQ(config.temporal_layer_config->ts_number_layers,
uint32_t{kNumLayers});
std::array<uint32_t, Vp8EncoderConfig::TemporalLayerConfig::kMaxLayers>
kZeroRate = {};
EXPECT_EQ(config.temporal_layer_config->ts_target_bitrate, kZeroRate);
// On second call, no new update.
config = tl.UpdateConfiguration(0);
EXPECT_FALSE(config.temporal_layer_config.has_value());
}
class TemporalLayersReferenceTest : public TemporalLayersTest,
public ::testing::WithParamInterface<int> {
public: