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:

committed by
Commit Bot

parent
02b17a5507
commit
72859e5e15
@ -2117,6 +2117,17 @@ void WebRtcVideoChannel::WebRtcVideoSendStream::UpdateSendState() {
|
|||||||
for (size_t i = 0; i < num_layers; ++i) {
|
for (size_t i = 0; i < num_layers; ++i) {
|
||||||
active_layers[i] = IsLayerActive(rtp_parameters_.encodings[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
|
// This updates what simulcast layers are sending, and possibly starts
|
||||||
// or stops the VideoSendStream.
|
// or stops the VideoSendStream.
|
||||||
stream_->UpdateActiveSimulcastLayers(active_layers);
|
stream_->UpdateActiveSimulcastLayers(active_layers);
|
||||||
|
@ -156,6 +156,9 @@ VideoCodec VideoCodecInitializer::VideoEncoderConfigToVideoCodec(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kVideoCodecVP9: {
|
case kVideoCodecVP9: {
|
||||||
|
// Force the first stream to always be active.
|
||||||
|
video_codec.simulcastStream[0].active = codec_active;
|
||||||
|
|
||||||
if (!config.encoder_specific_settings) {
|
if (!config.encoder_specific_settings) {
|
||||||
*video_codec.VP9() = VideoEncoder::GetDefaultVp9Settings();
|
*video_codec.VP9() = VideoEncoder::GetDefaultVp9Settings();
|
||||||
}
|
}
|
||||||
@ -197,7 +200,7 @@ VideoCodec VideoCodecInitializer::VideoEncoderConfigToVideoCodec(
|
|||||||
spatial_idx < config.simulcast_layers.size() &&
|
spatial_idx < config.simulcast_layers.size() &&
|
||||||
spatial_idx < spatial_layers.size();
|
spatial_idx < spatial_layers.size();
|
||||||
++spatial_idx) {
|
++spatial_idx) {
|
||||||
spatial_layers[spatial_layers.size() - spatial_idx - 1].active =
|
spatial_layers[spatial_idx].active =
|
||||||
config.simulcast_layers[spatial_idx].active;
|
config.simulcast_layers[spatial_idx].active;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -351,14 +351,14 @@ TEST_F(VideoCodecInitializerTest, Vp9DeactivateLayers) {
|
|||||||
EXPECT_TRUE(codec_out_.spatialLayers[2].active);
|
EXPECT_TRUE(codec_out_.spatialLayers[2].active);
|
||||||
|
|
||||||
// Deactivate top layer.
|
// Deactivate top layer.
|
||||||
config_.simulcast_layers[0].active = false;
|
config_.simulcast_layers[2].active = false;
|
||||||
EXPECT_TRUE(InitializeCodec());
|
EXPECT_TRUE(InitializeCodec());
|
||||||
EXPECT_TRUE(codec_out_.spatialLayers[0].active);
|
EXPECT_TRUE(codec_out_.spatialLayers[0].active);
|
||||||
EXPECT_TRUE(codec_out_.spatialLayers[1].active);
|
EXPECT_TRUE(codec_out_.spatialLayers[1].active);
|
||||||
EXPECT_FALSE(codec_out_.spatialLayers[2].active);
|
EXPECT_FALSE(codec_out_.spatialLayers[2].active);
|
||||||
|
|
||||||
// Deactivate middle layer.
|
// Deactivate middle layer.
|
||||||
config_.simulcast_layers[0].active = true;
|
config_.simulcast_layers[2].active = true;
|
||||||
config_.simulcast_layers[1].active = false;
|
config_.simulcast_layers[1].active = false;
|
||||||
EXPECT_TRUE(InitializeCodec());
|
EXPECT_TRUE(InitializeCodec());
|
||||||
EXPECT_TRUE(codec_out_.spatialLayers[0].active);
|
EXPECT_TRUE(codec_out_.spatialLayers[0].active);
|
||||||
|
Reference in New Issue
Block a user