Activate/deactivate VP9 spatial layers.

* Stop encoding spatial layers S(n >= N) if application deactivates
spatial layer N by setting RTCRtpEncodingParameters.active = false.

* Move calculation of padding bitrate to SvcRateAllocator class.

* Pad up to minimum required bitrate of base layer if ALR probing is
enabled.

Bug: webrtc:9350
Change-Id: I398284c943d43348def535c83263fc234c9767fa
Reviewed-on: https://webrtc-review.googlesource.com/c/113240
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Commit-Queue: Sergey Silkin <ssilkin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25945}
This commit is contained in:
Sergey Silkin
2018-12-10 09:28:53 +01:00
committed by Commit Bot
parent b47ccc38e7
commit 8b9b5f98db
12 changed files with 310 additions and 100 deletions

View File

@ -313,4 +313,36 @@ TEST_F(VideoCodecInitializerTest,
kDefaultMaxBitrateBps / 1000);
}
TEST_F(VideoCodecInitializerTest, Vp9DeactivateLayers) {
SetUpFor(VideoCodecType::kVideoCodecVP9, 3, 1, false);
VideoStream stream = DefaultStream();
streams_.push_back(stream);
config_.simulcast_layers.resize(3);
// Activate all layers.
config_.simulcast_layers[0].active = true;
config_.simulcast_layers[1].active = true;
config_.simulcast_layers[2].active = true;
EXPECT_TRUE(InitializeCodec());
EXPECT_TRUE(codec_out_.spatialLayers[0].active);
EXPECT_TRUE(codec_out_.spatialLayers[1].active);
EXPECT_TRUE(codec_out_.spatialLayers[2].active);
// Deactivate top layer.
config_.simulcast_layers[0].active = false;
EXPECT_TRUE(InitializeCodec());
EXPECT_TRUE(codec_out_.spatialLayers[0].active);
EXPECT_TRUE(codec_out_.spatialLayers[1].active);
EXPECT_FALSE(codec_out_.spatialLayers[2].active);
// Deactivate middle layer.
config_.simulcast_layers[0].active = true;
config_.simulcast_layers[1].active = false;
EXPECT_TRUE(InitializeCodec());
EXPECT_TRUE(codec_out_.spatialLayers[0].active);
EXPECT_FALSE(codec_out_.spatialLayers[1].active);
EXPECT_TRUE(codec_out_.spatialLayers[2].active);
}
} // namespace webrtc