Also apply VP9 bitrate's singlecast tweak in single active stream case.
We shouldn't treat VP9 simulcast {active,inactive,inactive} different
from VP9 singlecast when it comes to bitrates, so the condition
`config.simulcast_layers.size() <= 1` is updated to
`video_codec.numberOfSimulcastStreams <= 1` which holds true in the
"single active stream" case as well.
This is consistent with existing logic, such as the fact that we use
`SvcRateAllocator` instead of `SimulcastRateAllocator` when
`numberOfSimulcastStreams <= 1`.
Bug: webrtc:15061
Change-Id: I67fc78b9c0f97f1d607c91bbc689b06c3fd5cb48
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/298920
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39791}
This commit is contained in:
parent
5d1ec8262e
commit
9bbd9598b8
@ -242,7 +242,7 @@ VideoCodec VideoCodecInitializer::VideoEncoderConfigToVideoCodec(
|
||||
if (spatial_layers.empty())
|
||||
break;
|
||||
// Use codec bitrate limits if spatial layering is not requested.
|
||||
if (config.simulcast_layers.size() <= 1 &&
|
||||
if (video_codec.numberOfSimulcastStreams <= 1 &&
|
||||
ScalabilityModeToNumSpatialLayers(*scalability_mode) == 1) {
|
||||
spatial_layers.back().minBitrate = video_codec.minBitrate;
|
||||
spatial_layers.back().targetBitrate = video_codec.maxBitrate;
|
||||
|
||||
@ -589,11 +589,17 @@ TEST_F(VideoCodecInitializerTest, Vp9SingleSpatialLayerBitratesAreConsistent) {
|
||||
EXPECT_TRUE(VideoCodecInitializer::SetupCodec(config, streams, &codec));
|
||||
|
||||
EXPECT_EQ(1u, codec.VP9()->numberOfSpatialLayers);
|
||||
// Target is consistent with min and max (min <= target <= max).
|
||||
EXPECT_GE(codec.spatialLayers[0].targetBitrate,
|
||||
codec.spatialLayers[0].minBitrate);
|
||||
EXPECT_LE(codec.spatialLayers[0].targetBitrate,
|
||||
codec.spatialLayers[0].maxBitrate);
|
||||
EXPECT_LT(codec.spatialLayers[0].minBitrate, kDefaultMinBitrateBps / 1000);
|
||||
// In the single spatial layer case, the spatial layer bitrates are copied
|
||||
// from the codec's bitrate which is the sum if VideoStream bitrates. In this
|
||||
// case we only have a single VideoStream using default values.
|
||||
EXPECT_EQ(codec.spatialLayers[0].minBitrate, kDefaultMinBitrateBps / 1000);
|
||||
EXPECT_EQ(codec.spatialLayers[0].targetBitrate, kDefaultMaxBitrateBps / 1000);
|
||||
EXPECT_EQ(codec.spatialLayers[0].maxBitrate, kDefaultMaxBitrateBps / 1000);
|
||||
}
|
||||
|
||||
TEST_F(VideoCodecInitializerTest, Vp9TwoSpatialLayersBitratesAreConsistent) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user