Changeset 278410 in webkit
- Timestamp:
- Jun 3, 2021, 10:25:28 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/webrtc/receiver-track-live.https-expected.txt (modified) (1 diff)
-
LayoutTests/webrtc/receiver-track-should-stay-live-even-if-receiver-is-inactive.html (modified) (2 diffs)
-
Source/ThirdParty/libwebrtc/ChangeLog (modified) (1 diff)
-
Source/ThirdParty/libwebrtc/Source/webrtc/pc/audio_rtp_receiver.cc (modified) (2 diffs)
-
Source/ThirdParty/libwebrtc/Source/webrtc/pc/audio_rtp_receiver.h (modified) (1 diff)
-
Source/ThirdParty/libwebrtc/Source/webrtc/pc/peer_connection.cc (modified) (2 diffs)
-
Source/ThirdParty/libwebrtc/Source/webrtc/pc/peer_connection_rtp_unittest.cc (modified) (1 diff)
-
Source/ThirdParty/libwebrtc/Source/webrtc/pc/remote_audio_source.cc (modified) (4 diffs)
-
Source/ThirdParty/libwebrtc/Source/webrtc/pc/remote_audio_source.h (modified) (3 diffs)
-
Source/ThirdParty/libwebrtc/Source/webrtc/pc/rtp_sender_receiver_unittest.cc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r278403 r278410 1 2021-06-03 Youenn Fablet <youenn@apple.com> 2 3 Cherry-pick webrtc fix to correctly handle audio track state in case of renegotiation 4 https://bugs.webkit.org/show_bug.cgi?id=226577 5 6 Reviewed by Eric Carlson. 7 8 Update test now that we have the correct behavior. 9 10 * webrtc/receiver-track-should-stay-live-even-if-receiver-is-inactive.html: 11 1 12 2021-06-03 Alan Bujtas <zalan@apple.com> 2 13 -
trunk/LayoutTests/imported/w3c/ChangeLog
r278391 r278410 1 2021-06-03 Youenn Fablet <youenn@apple.com> 2 3 Cherry-pick webrtc fix to correctly handle audio track state in case of renegotiation 4 https://bugs.webkit.org/show_bug.cgi?id=226577 5 6 Reviewed by Eric Carlson. 7 8 * web-platform-tests/webrtc/receiver-track-live.https-expected.txt: 9 1 10 2021-06-02 Alex Christensen <achristensen@webkit.org> 2 11 -
trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/receiver-track-live.https-expected.txt
r267649 r278410 2 2 3 3 PASS Setup audio call 4 FAIL Inactivate the audio transceiver assert_equals: expected "live" but got "ended" 5 FAIL Reactivate the audio transceiver assert_equals: expected "live" but got "ended" 4 PASS Inactivate the audio transceiver 5 PASS Reactivate the audio transceiver 6 6 PASS Clean-up 7 7 -
trunk/LayoutTests/webrtc/receiver-track-should-stay-live-even-if-receiver-is-inactive.html
r262905 r278410 47 47 await pc1.setRemoteDescription(answer); 48 48 49 // FIXME: The track should be live but is ended due to a bug in our backend. 50 assert_equals(remoteTrack.readyState, "ended"); 49 assert_equals(remoteTrack.readyState, "live"); 51 50 }, "Inactivate the audio transceiver"); 52 51 … … 60 59 await pc1.setRemoteDescription(answer); 61 60 62 // FIXME: The track should be live but is ended due to a bug in our backend. 63 assert_equals(remoteTrack.readyState, "ended"); 61 assert_equals(remoteTrack.readyState, "live"); 64 62 }, "Reactivate the audio transceiver"); 65 63 </script> -
trunk/Source/ThirdParty/libwebrtc/ChangeLog
r278352 r278410 1 2021-06-03 Youenn Fablet <youenn@apple.com> 2 3 Cherry-pick webrtc fix to correctly handle audio track state in case of renegotiation 4 https://bugs.webkit.org/show_bug.cgi?id=226577 5 6 Reviewed by Eric Carlson. 7 8 Cherry-pick https://webrtc.googlesource.com/src/+/c335b0e63bff56ca0fbfa617dee6a644c85df164%5E%21/. 9 We need to do small changes to peer_connection.cc given the upstream fix is based on a newer version 10 which has some code moved from peer_connection.cc to rtp_transmission_manager.cc. 11 12 * Source/webrtc/pc/audio_rtp_receiver.cc: 13 * Source/webrtc/pc/audio_rtp_receiver.h: 14 * Source/webrtc/pc/peer_connection.cc: 15 * Source/webrtc/pc/peer_connection_rtp_unittest.cc: 16 * Source/webrtc/pc/remote_audio_source.cc: 17 * Source/webrtc/pc/remote_audio_source.h: 18 * Source/webrtc/pc/rtp_sender_receiver_unittest.cc: 19 1 20 2021-06-02 Youenn Fablet <youenn@apple.com> 2 21 -
trunk/Source/ThirdParty/libwebrtc/Source/webrtc/pc/audio_rtp_receiver.cc
r269642 r278410 31 31 AudioRtpReceiver::AudioRtpReceiver(rtc::Thread* worker_thread, 32 32 std::string receiver_id, 33 std::vector<std::string> stream_ids) 33 std::vector<std::string> stream_ids, 34 bool is_unified_plan) 34 35 : AudioRtpReceiver(worker_thread, 35 36 receiver_id, 36 CreateStreamsFromIds(std::move(stream_ids))) {} 37 CreateStreamsFromIds(std::move(stream_ids)), 38 is_unified_plan) {} 37 39 38 40 AudioRtpReceiver::AudioRtpReceiver( 39 41 rtc::Thread* worker_thread, 40 42 const std::string& receiver_id, 41 const std::vector<rtc::scoped_refptr<MediaStreamInterface>>& streams) 43 const std::vector<rtc::scoped_refptr<MediaStreamInterface>>& streams, 44 bool is_unified_plan) 42 45 : worker_thread_(worker_thread), 43 46 id_(receiver_id), 44 source_(new rtc::RefCountedObject<RemoteAudioSource>(worker_thread)), 47 source_(new rtc::RefCountedObject<RemoteAudioSource>( 48 worker_thread, 49 is_unified_plan 50 ? RemoteAudioSource::OnAudioChannelGoneAction::kSurvive 51 : RemoteAudioSource::OnAudioChannelGoneAction::kEnd)), 45 52 track_(AudioTrackProxyWithInternal<AudioTrack>::Create( 46 53 rtc::Thread::Current(), … … 140 147 return; 141 148 } 149 source_->SetState(MediaSourceInterface::kEnded); 142 150 if (media_channel_) { 143 151 // Allow that SetOutputVolume fail. This is the normal case when the -
trunk/Source/ThirdParty/libwebrtc/Source/webrtc/pc/audio_rtp_receiver.h
r269642 r278410 40 40 AudioRtpReceiver(rtc::Thread* worker_thread, 41 41 std::string receiver_id, 42 std::vector<std::string> stream_ids); 42 std::vector<std::string> stream_ids, 43 bool is_unified_plan); 43 44 // TODO(https://crbug.com/webrtc/9480): Remove this when streams() is removed. 44 45 AudioRtpReceiver( 45 46 rtc::Thread* worker_thread, 46 47 const std::string& receiver_id, 47 const std::vector<rtc::scoped_refptr<MediaStreamInterface>>& streams); 48 const std::vector<rtc::scoped_refptr<MediaStreamInterface>>& streams, 49 bool is_unified_plan); 48 50 virtual ~AudioRtpReceiver(); 49 51 -
trunk/Source/ThirdParty/libwebrtc/Source/webrtc/pc/peer_connection.cc
r269642 r278410 1211 1211 receiver = RtpReceiverProxyWithInternal<RtpReceiverInternal>::Create( 1212 1212 signaling_thread(), new AudioRtpReceiver(worker_thread(), receiver_id, 1213 std::vector<std::string>({}) ));1213 std::vector<std::string>({}), IsUnifiedPlan())); 1214 1214 NoteUsageEvent(UsageEvent::AUDIO_ADDED); 1215 1215 } else { … … 2254 2254 // the constructor taking stream IDs instead. 2255 2255 auto* audio_receiver = new AudioRtpReceiver( 2256 worker_thread(), remote_sender_info.sender_id, streams );2256 worker_thread(), remote_sender_info.sender_id, streams, IsUnifiedPlan()); 2257 2257 audio_receiver->SetMediaChannel(voice_media_channel()); 2258 2258 if (remote_sender_info.sender_id == kDefaultAudioSenderId) { -
trunk/Source/ThirdParty/libwebrtc/Source/webrtc/pc/peer_connection_rtp_unittest.cc
r271793 r278410 780 780 EXPECT_EQ(receivers[0]->streams()[1]->id(), kStreamId2); 781 781 } 782 TEST_F(PeerConnectionRtpTestUnifiedPlan, TracksDoNotEndWhenSsrcChanges) { 783 constexpr uint32_t kFirstMungedSsrc = 1337u; 784 785 auto caller = CreatePeerConnection(); 786 auto callee = CreatePeerConnection(); 787 788 // Caller offers to receive audio and video. 789 RtpTransceiverInit init; 790 init.direction = RtpTransceiverDirection::kRecvOnly; 791 caller->AddTransceiver(cricket::MEDIA_TYPE_AUDIO, init); 792 caller->AddTransceiver(cricket::MEDIA_TYPE_VIDEO, init); 793 794 // Callee wants to send audio and video tracks. 795 callee->AddTrack(callee->CreateAudioTrack("audio_track"), {}); 796 callee->AddTrack(callee->CreateVideoTrack("video_track"), {}); 797 798 // Do inittial offer/answer exchange. 799 ASSERT_TRUE(callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal())); 800 ASSERT_TRUE( 801 caller->SetRemoteDescription(callee->CreateAnswerAndSetAsLocal())); 802 ASSERT_EQ(caller->observer()->add_track_events_.size(), 2u); 803 ASSERT_EQ(caller->pc()->GetReceivers().size(), 2u); 804 805 // Do a follow-up offer/answer exchange where the SSRCs are modified. 806 ASSERT_TRUE(callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal())); 807 auto answer = callee->CreateAnswer(); 808 auto& contents = answer->description()->contents(); 809 ASSERT_TRUE(!contents.empty()); 810 for (size_t i = 0; i < contents.size(); ++i) { 811 auto& mutable_streams = contents[i].media_description()->mutable_streams(); 812 ASSERT_EQ(mutable_streams.size(), 1u); 813 mutable_streams[0].ssrcs = {kFirstMungedSsrc + static_cast<uint32_t>(i)}; 814 } 815 ASSERT_TRUE( 816 callee->SetLocalDescription(CloneSessionDescription(answer.get()))); 817 ASSERT_TRUE( 818 caller->SetRemoteDescription(CloneSessionDescription(answer.get()))); 819 820 // No furher track events should fire because we never changed direction, only 821 // SSRCs. 822 ASSERT_EQ(caller->observer()->add_track_events_.size(), 2u); 823 // We should have the same number of receivers as before. 824 auto receivers = caller->pc()->GetReceivers(); 825 ASSERT_EQ(receivers.size(), 2u); 826 // The tracks are still alive. 827 EXPECT_EQ(receivers[0]->track()->state(), 828 MediaStreamTrackInterface::TrackState::kLive); 829 EXPECT_EQ(receivers[1]->track()->state(), 830 MediaStreamTrackInterface::TrackState::kLive); 831 } 782 832 783 833 // Tests that with Unified Plan if the the stream id changes for a track when -
trunk/Source/ThirdParty/libwebrtc/Source/webrtc/pc/remote_audio_source.cc
r269642 r278410 52 52 }; 53 53 54 RemoteAudioSource::RemoteAudioSource(rtc::Thread* worker_thread) 54 RemoteAudioSource::RemoteAudioSource( 55 rtc::Thread* worker_thread, 56 OnAudioChannelGoneAction on_audio_channel_gone_action) 55 57 : main_thread_(rtc::Thread::Current()), 56 58 worker_thread_(worker_thread), 59 on_audio_channel_gone_action_(on_audio_channel_gone_action), 57 60 state_(MediaSourceInterface::kLive) { 58 61 RTC_DCHECK(main_thread_); … … 91 94 : media_channel->SetDefaultRawAudioSink(nullptr); 92 95 }); 96 } 97 98 void RemoteAudioSource::SetState(SourceState new_state) { 99 if (state_ != new_state) { 100 state_ = new_state; 101 FireOnChanged(); 102 } 93 103 } 94 104 … … 159 169 160 170 void RemoteAudioSource::OnAudioChannelGone() { 171 if (on_audio_channel_gone_action_ != OnAudioChannelGoneAction::kEnd) { 172 return; 173 } 161 174 // Called when the audio channel is deleted. It may be the worker thread 162 175 // in libjingle or may be a different worker thread. … … 173 186 RTC_DCHECK(main_thread_->IsCurrent()); 174 187 sinks_.clear(); 175 state_ = MediaSourceInterface::kEnded; 176 FireOnChanged(); 188 SetState(MediaSourceInterface::kEnded); 177 189 // Will possibly delete this RemoteAudioSource since it is reference counted 178 190 // in the message. -
trunk/Source/ThirdParty/libwebrtc/Source/webrtc/pc/remote_audio_source.h
r269642 r278410 35 35 rtc::MessageHandler { 36 36 public: 37 explicit RemoteAudioSource(rtc::Thread* worker_thread); 37 // In Unified Plan, receivers map to m= sections and their tracks and sources 38 // survive SSRCs being reconfigured. The life cycle of the remote audio source 39 // is associated with the life cycle of the m= section, and thus even if an 40 // audio channel is destroyed the RemoteAudioSource should kSurvive. 41 // 42 // In Plan B however, remote audio sources map 1:1 with an SSRCs and if an 43 // audio channel is destroyed, the RemoteAudioSource should kEnd. 44 enum class OnAudioChannelGoneAction { 45 kSurvive, 46 kEnd, 47 }; 48 49 explicit RemoteAudioSource( 50 rtc::Thread* worker_thread, 51 OnAudioChannelGoneAction on_audio_channel_gone_action); 38 52 39 53 // Register and unregister remote audio source with the underlying media … … 43 57 void Stop(cricket::VoiceMediaChannel* media_channel, 44 58 absl::optional<uint32_t> ssrc); 59 void SetState(SourceState new_state); 45 60 46 61 // MediaSourceInterface implementation. … … 69 84 rtc::Thread* const main_thread_; 70 85 rtc::Thread* const worker_thread_; 86 const OnAudioChannelGoneAction on_audio_channel_gone_action_; 71 87 std::list<AudioObserver*> audio_observers_; 72 88 Mutex sink_lock_; -
trunk/Source/ThirdParty/libwebrtc/Source/webrtc/pc/rtp_sender_receiver_unittest.cc
r269642 r278410 290 290 std::vector<rtc::scoped_refptr<MediaStreamInterface>> streams = {}) { 291 291 audio_rtp_receiver_ = 292 new AudioRtpReceiver(rtc::Thread::Current(), kAudioTrackId, streams); 292 new AudioRtpReceiver(rtc::Thread::Current(), kAudioTrackId, streams, 293 /*is_unified_plan=*/true); 293 294 audio_rtp_receiver_->SetMediaChannel(voice_media_channel_); 294 295 audio_rtp_receiver_->SetupMediaChannel(kAudioSsrc);
Note:
See TracChangeset
for help on using the changeset viewer.