VideoSendStream: Don't disable the alive flag when updating layers.

When implicit start/stop happens via activation/deactivation of layers
occurs, don't change the state of the 'alive' flag since further
activations following full de-activation need to be allowed to happen
when Stop() has not been called.

Bug: chromium:1234779
Change-Id: Ic3cae387990122eaa2f48de096ff9dafa7c34414
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/228242
Reviewed-by: Magnus Flodman <mflodman@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34698}
This commit is contained in:
Tommi
2021-08-09 19:57:44 +02:00
committed by WebRTC LUCI CQ
parent 8c654aa059
commit 264cf54443
2 changed files with 15 additions and 7 deletions

View File

@ -208,14 +208,9 @@ void VideoSendStream::UpdateActiveSimulcastLayers(
RTC_LOG(LS_INFO) << "UpdateActiveSimulcastLayers: "
<< active_layers_string.str();
rtp_transport_queue_->PostTask(ToQueuedTask(
transport_queue_safety_, [this, active_layers, was_running = running_] {
rtp_transport_queue_->PostTask(
ToQueuedTask(transport_queue_safety_, [this, active_layers] {
send_stream_.UpdateActiveSimulcastLayers(active_layers);
const bool running = rtp_video_sender_->IsActive();
if (was_running != running) {
running ? transport_queue_safety_->SetAlive()
: transport_queue_safety_->SetNotAlive();
}
}));
running_ = running;

View File

@ -2287,6 +2287,19 @@ TEST_F(VideoSendStreamTest, VideoSendStreamUpdateActiveSimulcastLayers) {
});
EXPECT_TRUE(encoder.WaitBitrateChanged(false));
// Re-activating a layer should resume sending and trigger a bitrate change.
GetVideoEncoderConfig()->simulcast_layers[0].active = true;
SendTask(RTC_FROM_HERE, task_queue(), [this]() {
GetVideoSendStream()->UpdateActiveSimulcastLayers({true, false});
EXPECT_TRUE(GetVideoSendStream()->started());
});
EXPECT_TRUE(encoder.WaitBitrateChanged(true));
// Stop and clean up.
SendTask(RTC_FROM_HERE, task_queue(),
[this]() { GetVideoSendStream()->Stop(); });
EXPECT_TRUE(encoder.WaitBitrateChanged(false));
SendTask(RTC_FROM_HERE, task_queue(), [this]() {
DestroyStreams();
DestroyCalls();