Title: [278901] branches/safari-611-branch
Revision
278901
Author
alanc...@apple.com
Date
2021-06-15 14:49:28 -0700 (Tue, 15 Jun 2021)

Log Message

Cherry-pick r278410. rdar://problem/79355285

    Cherry-pick webrtc fix to correctly handle audio track state in case of renegotiation
    https://bugs.webkit.org/show_bug.cgi?id=226577

    Reviewed by Eric Carlson.

    LayoutTests/imported/w3c:

    * web-platform-tests/webrtc/receiver-track-live.https-expected.txt:

    Source/ThirdParty/libwebrtc:

    Cherry-pick https://webrtc.googlesource.com/src/+/c335b0e63bff56ca0fbfa617dee6a644c85df164%5E%21/.
    We need to do small changes to peer_connection.cc given the upstream fix is based on a newer version
    which has some code moved from peer_connection.cc to rtp_transmission_manager.cc.

    * Source/webrtc/pc/audio_rtp_receiver.cc:
    * Source/webrtc/pc/audio_rtp_receiver.h:
    * Source/webrtc/pc/peer_connection.cc:
    * Source/webrtc/pc/peer_connection_rtp_unittest.cc:
    * Source/webrtc/pc/remote_audio_source.cc:
    * Source/webrtc/pc/remote_audio_source.h:
    * Source/webrtc/pc/rtp_sender_receiver_unittest.cc:

    LayoutTests:

    Update test now that we have the correct behavior.

    * webrtc/receiver-track-should-stay-live-even-if-receiver-is-inactive.html:

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278410 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-611-branch/LayoutTests/ChangeLog (278900 => 278901)


--- branches/safari-611-branch/LayoutTests/ChangeLog	2021-06-15 21:49:24 UTC (rev 278900)
+++ branches/safari-611-branch/LayoutTests/ChangeLog	2021-06-15 21:49:28 UTC (rev 278901)
@@ -1,3 +1,50 @@
+2021-06-15  Alan Coon  <alanc...@apple.com>
+
+        Cherry-pick r278410. rdar://problem/79355285
+
+    Cherry-pick webrtc fix to correctly handle audio track state in case of renegotiation
+    https://bugs.webkit.org/show_bug.cgi?id=226577
+    
+    Reviewed by Eric Carlson.
+    
+    LayoutTests/imported/w3c:
+    
+    * web-platform-tests/webrtc/receiver-track-live.https-expected.txt:
+    
+    Source/ThirdParty/libwebrtc:
+    
+    Cherry-pick https://webrtc.googlesource.com/src/+/c335b0e63bff56ca0fbfa617dee6a644c85df164%5E%21/.
+    We need to do small changes to peer_connection.cc given the upstream fix is based on a newer version
+    which has some code moved from peer_connection.cc to rtp_transmission_manager.cc.
+    
+    * Source/webrtc/pc/audio_rtp_receiver.cc:
+    * Source/webrtc/pc/audio_rtp_receiver.h:
+    * Source/webrtc/pc/peer_connection.cc:
+    * Source/webrtc/pc/peer_connection_rtp_unittest.cc:
+    * Source/webrtc/pc/remote_audio_source.cc:
+    * Source/webrtc/pc/remote_audio_source.h:
+    * Source/webrtc/pc/rtp_sender_receiver_unittest.cc:
+    
+    LayoutTests:
+    
+    Update test now that we have the correct behavior.
+    
+    * webrtc/receiver-track-should-stay-live-even-if-receiver-is-inactive.html:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278410 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-06-03  Youenn Fablet  <you...@apple.com>
+
+            Cherry-pick webrtc fix to correctly handle audio track state in case of renegotiation
+            https://bugs.webkit.org/show_bug.cgi?id=226577
+
+            Reviewed by Eric Carlson.
+
+            Update test now that we have the correct behavior.
+
+            * webrtc/receiver-track-should-stay-live-even-if-receiver-is-inactive.html:
+
 2021-06-10  Russell Epstein  <repst...@apple.com>
 
         Cherry-pick r278177. rdar://problem/79144899

Modified: branches/safari-611-branch/LayoutTests/imported/w3c/ChangeLog (278900 => 278901)


--- branches/safari-611-branch/LayoutTests/imported/w3c/ChangeLog	2021-06-15 21:49:24 UTC (rev 278900)
+++ branches/safari-611-branch/LayoutTests/imported/w3c/ChangeLog	2021-06-15 21:49:28 UTC (rev 278901)
@@ -1,3 +1,48 @@
+2021-06-15  Alan Coon  <alanc...@apple.com>
+
+        Cherry-pick r278410. rdar://problem/79355285
+
+    Cherry-pick webrtc fix to correctly handle audio track state in case of renegotiation
+    https://bugs.webkit.org/show_bug.cgi?id=226577
+    
+    Reviewed by Eric Carlson.
+    
+    LayoutTests/imported/w3c:
+    
+    * web-platform-tests/webrtc/receiver-track-live.https-expected.txt:
+    
+    Source/ThirdParty/libwebrtc:
+    
+    Cherry-pick https://webrtc.googlesource.com/src/+/c335b0e63bff56ca0fbfa617dee6a644c85df164%5E%21/.
+    We need to do small changes to peer_connection.cc given the upstream fix is based on a newer version
+    which has some code moved from peer_connection.cc to rtp_transmission_manager.cc.
+    
+    * Source/webrtc/pc/audio_rtp_receiver.cc:
+    * Source/webrtc/pc/audio_rtp_receiver.h:
+    * Source/webrtc/pc/peer_connection.cc:
+    * Source/webrtc/pc/peer_connection_rtp_unittest.cc:
+    * Source/webrtc/pc/remote_audio_source.cc:
+    * Source/webrtc/pc/remote_audio_source.h:
+    * Source/webrtc/pc/rtp_sender_receiver_unittest.cc:
+    
+    LayoutTests:
+    
+    Update test now that we have the correct behavior.
+    
+    * webrtc/receiver-track-should-stay-live-even-if-receiver-is-inactive.html:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278410 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-06-03  Youenn Fablet  <you...@apple.com>
+
+            Cherry-pick webrtc fix to correctly handle audio track state in case of renegotiation
+            https://bugs.webkit.org/show_bug.cgi?id=226577
+
+            Reviewed by Eric Carlson.
+
+            * web-platform-tests/webrtc/receiver-track-live.https-expected.txt:
+
 2021-05-07  Russell Epstein  <repst...@apple.com>
 
         Cherry-pick r276627. rdar://problem/77580982

Modified: branches/safari-611-branch/LayoutTests/imported/w3c/web-platform-tests/webrtc/receiver-track-live.https-expected.txt (278900 => 278901)


--- branches/safari-611-branch/LayoutTests/imported/w3c/web-platform-tests/webrtc/receiver-track-live.https-expected.txt	2021-06-15 21:49:24 UTC (rev 278900)
+++ branches/safari-611-branch/LayoutTests/imported/w3c/web-platform-tests/webrtc/receiver-track-live.https-expected.txt	2021-06-15 21:49:28 UTC (rev 278901)
@@ -1,7 +1,7 @@
 
 
 PASS Setup audio call
-FAIL Inactivate the audio transceiver assert_equals: expected "live" but got "ended"
-FAIL Reactivate the audio transceiver assert_equals: expected "live" but got "ended"
+PASS Inactivate the audio transceiver
+PASS Reactivate the audio transceiver
 PASS Clean-up
 

Modified: branches/safari-611-branch/LayoutTests/webrtc/receiver-track-should-stay-live-even-if-receiver-is-inactive.html (278900 => 278901)


--- branches/safari-611-branch/LayoutTests/webrtc/receiver-track-should-stay-live-even-if-receiver-is-inactive.html	2021-06-15 21:49:24 UTC (rev 278900)
+++ branches/safari-611-branch/LayoutTests/webrtc/receiver-track-should-stay-live-even-if-receiver-is-inactive.html	2021-06-15 21:49:28 UTC (rev 278901)
@@ -46,8 +46,7 @@
         await pc2.setLocalDescription(answer);
         await pc1.setRemoteDescription(answer);
 
-        // FIXME: The track should be live but is ended due to a bug in our backend.
-        assert_equals(remoteTrack.readyState, "ended");
+        assert_equals(remoteTrack.readyState, "live");
     }, "Inactivate the audio transceiver");
 
     promise_test(async (test) => {
@@ -59,8 +58,7 @@
         await pc2.setLocalDescription(answer);
         await pc1.setRemoteDescription(answer);
 
-        // FIXME: The track should be live but is ended due to a bug in our backend.
-        assert_equals(remoteTrack.readyState, "ended");
+        assert_equals(remoteTrack.readyState, "live");
     }, "Reactivate the audio transceiver");
     </script>
 </body>

Modified: branches/safari-611-branch/Source/ThirdParty/libwebrtc/ChangeLog (278900 => 278901)


--- branches/safari-611-branch/Source/ThirdParty/libwebrtc/ChangeLog	2021-06-15 21:49:24 UTC (rev 278900)
+++ branches/safari-611-branch/Source/ThirdParty/libwebrtc/ChangeLog	2021-06-15 21:49:28 UTC (rev 278901)
@@ -1,5 +1,60 @@
 2021-06-15  Alan Coon  <alanc...@apple.com>
 
+        Cherry-pick r278410. rdar://problem/79355285
+
+    Cherry-pick webrtc fix to correctly handle audio track state in case of renegotiation
+    https://bugs.webkit.org/show_bug.cgi?id=226577
+    
+    Reviewed by Eric Carlson.
+    
+    LayoutTests/imported/w3c:
+    
+    * web-platform-tests/webrtc/receiver-track-live.https-expected.txt:
+    
+    Source/ThirdParty/libwebrtc:
+    
+    Cherry-pick https://webrtc.googlesource.com/src/+/c335b0e63bff56ca0fbfa617dee6a644c85df164%5E%21/.
+    We need to do small changes to peer_connection.cc given the upstream fix is based on a newer version
+    which has some code moved from peer_connection.cc to rtp_transmission_manager.cc.
+    
+    * Source/webrtc/pc/audio_rtp_receiver.cc:
+    * Source/webrtc/pc/audio_rtp_receiver.h:
+    * Source/webrtc/pc/peer_connection.cc:
+    * Source/webrtc/pc/peer_connection_rtp_unittest.cc:
+    * Source/webrtc/pc/remote_audio_source.cc:
+    * Source/webrtc/pc/remote_audio_source.h:
+    * Source/webrtc/pc/rtp_sender_receiver_unittest.cc:
+    
+    LayoutTests:
+    
+    Update test now that we have the correct behavior.
+    
+    * webrtc/receiver-track-should-stay-live-even-if-receiver-is-inactive.html:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278410 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-06-03  Youenn Fablet  <you...@apple.com>
+
+            Cherry-pick webrtc fix to correctly handle audio track state in case of renegotiation
+            https://bugs.webkit.org/show_bug.cgi?id=226577
+
+            Reviewed by Eric Carlson.
+
+            Cherry-pick https://webrtc.googlesource.com/src/+/c335b0e63bff56ca0fbfa617dee6a644c85df164%5E%21/.
+            We need to do small changes to peer_connection.cc given the upstream fix is based on a newer version
+            which has some code moved from peer_connection.cc to rtp_transmission_manager.cc.
+
+            * Source/webrtc/pc/audio_rtp_receiver.cc:
+            * Source/webrtc/pc/audio_rtp_receiver.h:
+            * Source/webrtc/pc/peer_connection.cc:
+            * Source/webrtc/pc/peer_connection_rtp_unittest.cc:
+            * Source/webrtc/pc/remote_audio_source.cc:
+            * Source/webrtc/pc/remote_audio_source.h:
+            * Source/webrtc/pc/rtp_sender_receiver_unittest.cc:
+
+2021-06-15  Alan Coon  <alanc...@apple.com>
+
         Cherry-pick r278272. rdar://problem/79355341
 
     Use tighter bitrate allocation rules for WebRTC H264 software encoder

Modified: branches/safari-611-branch/Source/ThirdParty/libwebrtc/Source/webrtc/pc/audio_rtp_receiver.cc (278900 => 278901)


--- branches/safari-611-branch/Source/ThirdParty/libwebrtc/Source/webrtc/pc/audio_rtp_receiver.cc	2021-06-15 21:49:24 UTC (rev 278900)
+++ branches/safari-611-branch/Source/ThirdParty/libwebrtc/Source/webrtc/pc/audio_rtp_receiver.cc	2021-06-15 21:49:28 UTC (rev 278901)
@@ -30,18 +30,25 @@
 
 AudioRtpReceiver::AudioRtpReceiver(rtc::Thread* worker_thread,
                                    std::string receiver_id,
-                                   std::vector<std::string> stream_ids)
+                                   std::vector<std::string> stream_ids,
+                                   bool is_unified_plan)
     : AudioRtpReceiver(worker_thread,
                        receiver_id,
-                       CreateStreamsFromIds(std::move(stream_ids))) {}
+                       CreateStreamsFromIds(std::move(stream_ids)),
+                       is_unified_plan) {}
 
 AudioRtpReceiver::AudioRtpReceiver(
     rtc::Thread* worker_thread,
     const std::string& receiver_id,
-    const std::vector<rtc::scoped_refptr<MediaStreamInterface>>& streams)
+    const std::vector<rtc::scoped_refptr<MediaStreamInterface>>& streams,
+    bool is_unified_plan)
     : worker_thread_(worker_thread),
       id_(receiver_id),
-      source_(new rtc::RefCountedObject<RemoteAudioSource>(worker_thread)),
+      source_(new rtc::RefCountedObject<RemoteAudioSource>(
+          worker_thread,
+          is_unified_plan
+              ? RemoteAudioSource::OnAudioChannelGoneAction::kSurvive
+              : RemoteAudioSource::OnAudioChannelGoneAction::kEnd)),
       track_(AudioTrackProxyWithInternal<AudioTrack>::Create(
           rtc::Thread::Current(),
           AudioTrack::Create(receiver_id, source_))),
@@ -139,6 +146,7 @@
   if (stopped_) {
     return;
   }
+  source_->SetState(MediaSourceInterface::kEnded);
   if (media_channel_) {
     // Allow that SetOutputVolume fail. This is the normal case when the
     // underlying media channel has already been deleted.

Modified: branches/safari-611-branch/Source/ThirdParty/libwebrtc/Source/webrtc/pc/audio_rtp_receiver.h (278900 => 278901)


--- branches/safari-611-branch/Source/ThirdParty/libwebrtc/Source/webrtc/pc/audio_rtp_receiver.h	2021-06-15 21:49:24 UTC (rev 278900)
+++ branches/safari-611-branch/Source/ThirdParty/libwebrtc/Source/webrtc/pc/audio_rtp_receiver.h	2021-06-15 21:49:28 UTC (rev 278901)
@@ -39,12 +39,14 @@
  public:
   AudioRtpReceiver(rtc::Thread* worker_thread,
                    std::string receiver_id,
-                   std::vector<std::string> stream_ids);
+                   std::vector<std::string> stream_ids,
+                   bool is_unified_plan);
   // TODO(https://crbug.com/webrtc/9480): Remove this when streams() is removed.
   AudioRtpReceiver(
       rtc::Thread* worker_thread,
       const std::string& receiver_id,
-      const std::vector<rtc::scoped_refptr<MediaStreamInterface>>& streams);
+      const std::vector<rtc::scoped_refptr<MediaStreamInterface>>& streams,
+      bool is_unified_plan);
   virtual ~AudioRtpReceiver();
 
   // ObserverInterface implementation

Modified: branches/safari-611-branch/Source/ThirdParty/libwebrtc/Source/webrtc/pc/peer_connection.cc (278900 => 278901)


--- branches/safari-611-branch/Source/ThirdParty/libwebrtc/Source/webrtc/pc/peer_connection.cc	2021-06-15 21:49:24 UTC (rev 278900)
+++ branches/safari-611-branch/Source/ThirdParty/libwebrtc/Source/webrtc/pc/peer_connection.cc	2021-06-15 21:49:28 UTC (rev 278901)
@@ -1210,7 +1210,7 @@
   if (media_type == cricket::MEDIA_TYPE_AUDIO) {
     receiver = RtpReceiverProxyWithInternal<RtpReceiverInternal>::Create(
         signaling_thread(), new AudioRtpReceiver(worker_thread(), receiver_id,
-                                                 std::vector<std::string>({})));
+                                                 std::vector<std::string>({}), IsUnifiedPlan()));
     NoteUsageEvent(UsageEvent::AUDIO_ADDED);
   } else {
     RTC_DCHECK_EQ(media_type, cricket::MEDIA_TYPE_VIDEO);
@@ -2253,7 +2253,7 @@
   // TODO(https://crbug.com/webrtc/9480): When we remove remote_streams(), use
   // the constructor taking stream IDs instead.
   auto* audio_receiver = new AudioRtpReceiver(
-      worker_thread(), remote_sender_info.sender_id, streams);
+      worker_thread(), remote_sender_info.sender_id, streams, IsUnifiedPlan());
   audio_receiver->SetMediaChannel(voice_media_channel());
   if (remote_sender_info.sender_id == kDefaultAudioSenderId) {
     audio_receiver->SetupUnsignaledMediaChannel();

Modified: branches/safari-611-branch/Source/ThirdParty/libwebrtc/Source/webrtc/pc/peer_connection_rtp_unittest.cc (278900 => 278901)


--- branches/safari-611-branch/Source/ThirdParty/libwebrtc/Source/webrtc/pc/peer_connection_rtp_unittest.cc	2021-06-15 21:49:24 UTC (rev 278900)
+++ branches/safari-611-branch/Source/ThirdParty/libwebrtc/Source/webrtc/pc/peer_connection_rtp_unittest.cc	2021-06-15 21:49:28 UTC (rev 278901)
@@ -779,7 +779,57 @@
   EXPECT_EQ(receivers[0]->streams()[0]->id(), kStreamId1);
   EXPECT_EQ(receivers[0]->streams()[1]->id(), kStreamId2);
 }
+TEST_F(PeerConnectionRtpTestUnifiedPlan, TracksDoNotEndWhenSsrcChanges) {
+  constexpr uint32_t kFirstMungedSsrc = 1337u;
 
+  auto caller = CreatePeerConnection();
+  auto callee = CreatePeerConnection();
+
+  // Caller offers to receive audio and video.
+  RtpTransceiverInit init;
+  init.direction = RtpTransceiverDirection::kRecvOnly;
+  caller->AddTransceiver(cricket::MEDIA_TYPE_AUDIO, init);
+  caller->AddTransceiver(cricket::MEDIA_TYPE_VIDEO, init);
+
+  // Callee wants to send audio and video tracks.
+  callee->AddTrack(callee->CreateAudioTrack("audio_track"), {});
+  callee->AddTrack(callee->CreateVideoTrack("video_track"), {});
+
+  // Do inittial offer/answer exchange.
+  ASSERT_TRUE(callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal()));
+  ASSERT_TRUE(
+      caller->SetRemoteDescription(callee->CreateAnswerAndSetAsLocal()));
+  ASSERT_EQ(caller->observer()->add_track_events_.size(), 2u);
+  ASSERT_EQ(caller->pc()->GetReceivers().size(), 2u);
+
+  // Do a follow-up offer/answer exchange where the SSRCs are modified.
+  ASSERT_TRUE(callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal()));
+  auto answer = callee->CreateAnswer();
+  auto& contents = answer->description()->contents();
+  ASSERT_TRUE(!contents.empty());
+  for (size_t i = 0; i < contents.size(); ++i) {
+    auto& mutable_streams = contents[i].media_description()->mutable_streams();
+    ASSERT_EQ(mutable_streams.size(), 1u);
+    mutable_streams[0].ssrcs = {kFirstMungedSsrc + static_cast<uint32_t>(i)};
+  }
+  ASSERT_TRUE(
+      callee->SetLocalDescription(CloneSessionDescription(answer.get())));
+  ASSERT_TRUE(
+      caller->SetRemoteDescription(CloneSessionDescription(answer.get())));
+
+  // No furher track events should fire because we never changed direction, only
+  // SSRCs.
+  ASSERT_EQ(caller->observer()->add_track_events_.size(), 2u);
+  // We should have the same number of receivers as before.
+  auto receivers = caller->pc()->GetReceivers();
+  ASSERT_EQ(receivers.size(), 2u);
+  // The tracks are still alive.
+  EXPECT_EQ(receivers[0]->track()->state(),
+            MediaStreamTrackInterface::TrackState::kLive);
+  EXPECT_EQ(receivers[1]->track()->state(),
+            MediaStreamTrackInterface::TrackState::kLive);
+}
+
 // Tests that with Unified Plan if the the stream id changes for a track when
 // when setting a new remote description, that the media stream is updated
 // appropriately for the receiver.

Modified: branches/safari-611-branch/Source/ThirdParty/libwebrtc/Source/webrtc/pc/remote_audio_source.cc (278900 => 278901)


--- branches/safari-611-branch/Source/ThirdParty/libwebrtc/Source/webrtc/pc/remote_audio_source.cc	2021-06-15 21:49:24 UTC (rev 278900)
+++ branches/safari-611-branch/Source/ThirdParty/libwebrtc/Source/webrtc/pc/remote_audio_source.cc	2021-06-15 21:49:28 UTC (rev 278901)
@@ -51,9 +51,12 @@
   const rtc::scoped_refptr<RemoteAudioSource> source_;
 };
 
-RemoteAudioSource::RemoteAudioSource(rtc::Thread* worker_thread)
+RemoteAudioSource::RemoteAudioSource(
+    rtc::Thread* worker_thread,
+    OnAudioChannelGoneAction on_audio_channel_gone_action)
     : main_thread_(rtc::Thread::Current()),
       worker_thread_(worker_thread),
+      on_audio_channel_gone_action_(on_audio_channel_gone_action),
       state_(MediaSourceInterface::kLive) {
   RTC_DCHECK(main_thread_);
   RTC_DCHECK(worker_thread_);
@@ -92,6 +95,13 @@
   });
 }
 
+void RemoteAudioSource::SetState(SourceState new_state) {
+  if (state_ != new_state) {
+    state_ = new_state;
+    FireOnChanged();
+  }
+}
+
 MediaSourceInterface::SourceState RemoteAudioSource::state() const {
   RTC_DCHECK(main_thread_->IsCurrent());
   return state_;
@@ -158,6 +168,9 @@
 }
 
 void RemoteAudioSource::OnAudioChannelGone() {
+  if (on_audio_channel_gone_action_ != OnAudioChannelGoneAction::kEnd) {
+    return;
+  }
   // Called when the audio channel is deleted.  It may be the worker thread
   // in libjingle or may be a different worker thread.
   // This object needs to live long enough for the cleanup logic in OnMessage to
@@ -172,8 +185,7 @@
 void RemoteAudioSource::OnMessage(rtc::Message* msg) {
   RTC_DCHECK(main_thread_->IsCurrent());
   sinks_.clear();
-  state_ = MediaSourceInterface::kEnded;
-  FireOnChanged();
+  SetState(MediaSourceInterface::kEnded);
   // Will possibly delete this RemoteAudioSource since it is reference counted
   // in the message.
   delete msg->pdata;

Modified: branches/safari-611-branch/Source/ThirdParty/libwebrtc/Source/webrtc/pc/remote_audio_source.h (278900 => 278901)


--- branches/safari-611-branch/Source/ThirdParty/libwebrtc/Source/webrtc/pc/remote_audio_source.h	2021-06-15 21:49:24 UTC (rev 278900)
+++ branches/safari-611-branch/Source/ThirdParty/libwebrtc/Source/webrtc/pc/remote_audio_source.h	2021-06-15 21:49:28 UTC (rev 278901)
@@ -34,8 +34,22 @@
 class RemoteAudioSource : public Notifier<AudioSourceInterface>,
                           rtc::MessageHandler {
  public:
-  explicit RemoteAudioSource(rtc::Thread* worker_thread);
+  // In Unified Plan, receivers map to m= sections and their tracks and sources
+  // survive SSRCs being reconfigured. The life cycle of the remote audio source
+  // is associated with the life cycle of the m= section, and thus even if an
+  // audio channel is destroyed the RemoteAudioSource should kSurvive.
+  //
+  // In Plan B however, remote audio sources map 1:1 with an SSRCs and if an
+  // audio channel is destroyed, the RemoteAudioSource should kEnd.
+  enum class OnAudioChannelGoneAction {
+    kSurvive,
+    kEnd,
+  };
 
+  explicit RemoteAudioSource(
+      rtc::Thread* worker_thread,
+      OnAudioChannelGoneAction on_audio_channel_gone_action);
+
   // Register and unregister remote audio source with the underlying media
   // engine.
   void Start(cricket::VoiceMediaChannel* media_channel,
@@ -42,6 +56,7 @@
              absl::optional<uint32_t> ssrc);
   void Stop(cricket::VoiceMediaChannel* media_channel,
             absl::optional<uint32_t> ssrc);
+  void SetState(SourceState new_state);
 
   // MediaSourceInterface implementation.
   MediaSourceInterface::SourceState state() const override;
@@ -68,6 +83,7 @@
 
   rtc::Thread* const main_thread_;
   rtc::Thread* const worker_thread_;
+  const OnAudioChannelGoneAction on_audio_channel_gone_action_;
   std::list<AudioObserver*> audio_observers_;
   Mutex sink_lock_;
   std::list<AudioTrackSinkInterface*> sinks_;

Modified: branches/safari-611-branch/Source/ThirdParty/libwebrtc/Source/webrtc/pc/rtp_sender_receiver_unittest.cc (278900 => 278901)


--- branches/safari-611-branch/Source/ThirdParty/libwebrtc/Source/webrtc/pc/rtp_sender_receiver_unittest.cc	2021-06-15 21:49:24 UTC (rev 278900)
+++ branches/safari-611-branch/Source/ThirdParty/libwebrtc/Source/webrtc/pc/rtp_sender_receiver_unittest.cc	2021-06-15 21:49:28 UTC (rev 278901)
@@ -289,7 +289,8 @@
   void CreateAudioRtpReceiver(
       std::vector<rtc::scoped_refptr<MediaStreamInterface>> streams = {}) {
     audio_rtp_receiver_ =
-        new AudioRtpReceiver(rtc::Thread::Current(), kAudioTrackId, streams);
+        new AudioRtpReceiver(rtc::Thread::Current(), kAudioTrackId, streams,
+                             /*is_unified_plan=*/true);
     audio_rtp_receiver_->SetMediaChannel(voice_media_channel_);
     audio_rtp_receiver_->SetupMediaChannel(kAudioSsrc);
     audio_track_ = audio_rtp_receiver_->audio_track();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to