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}
diff --git a/video/video_send_stream.cc b/video/video_send_stream.cc
index a947af9..c244d17 100644
--- a/video/video_send_stream.cc
+++ b/video/video_send_stream.cc
@@ -208,14 +208,9 @@
   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;
diff --git a/video/video_send_stream_tests.cc b/video/video_send_stream_tests.cc
index 85dbbaf..8cb4313 100644
--- a/video/video_send_stream_tests.cc
+++ b/video/video_send_stream_tests.cc
@@ -2287,6 +2287,19 @@
   });
   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();