Make RtpEncodingParameters to not reverse active flags order

Bug: webrtc:11319
Change-Id: If63db02d282ee622c12405f85c0fbae1ba13fcb2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/168196
Reviewed-by: Florent Castelli <orphis@webrtc.org>
Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30459}
This commit is contained in:
Ilya Nikolaevskiy
2020-02-05 17:31:00 +01:00
committed by Commit Bot
parent 02b17a5507
commit 72859e5e15
3 changed files with 17 additions and 3 deletions

View File

@ -2117,6 +2117,17 @@ void WebRtcVideoChannel::WebRtcVideoSendStream::UpdateSendState() {
for (size_t i = 0; i < num_layers; ++i) {
active_layers[i] = IsLayerActive(rtp_parameters_.encodings[i]);
}
if (parameters_.encoder_config.number_of_streams == 1 &&
rtp_parameters_.encodings.size() > 1) {
// SVC is used.
// The only present simulcast layer should be active if any of the
// configured SVC layers is active.
bool is_active = false;
for (size_t i = 0; i < rtp_parameters_.encodings.size(); ++i) {
is_active |= rtp_parameters_.encodings[i].active;
}
active_layers[0] = is_active;
}
// This updates what simulcast layers are sending, and possibly starts
// or stops the VideoSendStream.
stream_->UpdateActiveSimulcastLayers(active_layers);

View File

@ -156,6 +156,9 @@ VideoCodec VideoCodecInitializer::VideoEncoderConfigToVideoCodec(
break;
}
case kVideoCodecVP9: {
// Force the first stream to always be active.
video_codec.simulcastStream[0].active = codec_active;
if (!config.encoder_specific_settings) {
*video_codec.VP9() = VideoEncoder::GetDefaultVp9Settings();
}
@ -197,7 +200,7 @@ VideoCodec VideoCodecInitializer::VideoEncoderConfigToVideoCodec(
spatial_idx < config.simulcast_layers.size() &&
spatial_idx < spatial_layers.size();
++spatial_idx) {
spatial_layers[spatial_layers.size() - spatial_idx - 1].active =
spatial_layers[spatial_idx].active =
config.simulcast_layers[spatial_idx].active;
}
}

View File

@ -351,14 +351,14 @@ TEST_F(VideoCodecInitializerTest, Vp9DeactivateLayers) {
EXPECT_TRUE(codec_out_.spatialLayers[2].active);
// Deactivate top layer.
config_.simulcast_layers[0].active = false;
config_.simulcast_layers[2].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[2].active = true;
config_.simulcast_layers[1].active = false;
EXPECT_TRUE(InitializeCodec());
EXPECT_TRUE(codec_out_.spatialLayers[0].active);