Changeset 207052 in webkit
- Timestamp:
- Oct 10, 2016 11:39:15 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r207045 r207052 1 2016-10-10 Adam Bergkvist <adam.bergkvist@ericsson.com> and Alejandro G. Castro <alex@igalia.com> 2 3 WebRTC: Make MediaEndpointPeerConnection handle remotely assigned mids correctly 4 https://bugs.webkit.org/show_bug.cgi?id=163202 5 6 Reviewed by Eric Carlson. 7 8 Test the case when an RTCRtpTransceiver gets its mid assigned from a remote session 9 description. 10 11 * fast/mediastream/RTCPeerConnection-remotely-assigned-transceiver-mid-expected.txt: Added. 12 * fast/mediastream/RTCPeerConnection-remotely-assigned-transceiver-mid.html: Added. 13 * platform/mac/TestExpectations: 14 Skip above test until the Mac port builds with WEB_RTC. 15 1 16 2016-10-10 Gyuyoung Kim <gyuyoung.kim@navercorp.com> 2 17 -
trunk/LayoutTests/platform/mac/TestExpectations
r207031 r207052 209 209 fast/mediastream/RTCPeerConnection-icecandidate-event.html 210 210 fast/mediastream/RTCPeerConnection-iceconnectionstatechange-event.html 211 fast/mediastream/RTCPeerConnection-remotely-assigned-transceiver-mid.html 211 212 212 213 # Asserts in debug. -
trunk/Source/WebCore/ChangeLog
r207050 r207052 1 2016-10-10 Adam Bergkvist <adam.bergkvist@ericsson.com> and Alejandro G. Castro <alex@igalia.com> 2 3 WebRTC: Make MediaEndpointPeerConnection handle remotely assigned mids correctly 4 https://bugs.webkit.org/show_bug.cgi?id=163202 5 6 Reviewed by Eric Carlson. 7 8 An RTCRtpTransceiver has a null mid until it's been associated with a 9 media description (with a mid) [1]. During that time, it's identified by 10 a provisional mid that might become its real mid, but the transceiver 11 can also get its mid assigned by a remote media description. In the 12 second case, the mid value is initially unknown. A transceiver's 13 RTCRtpSender must directly (synchronously in the script) provide a muted 14 remote source that is playable by, for example, a media element. This 15 source is initially registered in the MediaEndpoint (WebRTC backend) 16 with the transceiver's provisional mid. So, if the real mid is set by a 17 remote description, the registered mid must be updated to preserve the 18 association between the registered source and the transceiver. 19 20 [1] https://w3c.github.io/webrtc-pc/archives/20160913/webrtc.html#dom-rtcrtptransceiver-mid 21 22 Test: fast/mediastream/RTCPeerConnection-remotely-assigned-transceiver-mid.html 23 24 * Modules/mediastream/MediaEndpointPeerConnection.cpp: 25 Don't break after finding the first transceiver in the loop that builds the send source map. 26 Update the mid used to register the muted remote source if the a transceiver's mid gets 27 assigned by a remote media description. 28 (WebCore::createSourceMap): 29 (WebCore::MediaEndpointPeerConnection::setRemoteDescriptionTask): 30 * platform/mediastream/MediaEndpoint.cpp: 31 * platform/mediastream/MediaEndpoint.h: 32 * platform/mock/MockMediaEndpoint.cpp: 33 (WebCore::MockMediaEndpoint::MockMediaEndpoint): 34 (WebCore::MockMediaEndpoint::updateReceiveConfiguration): 35 (WebCore::MockMediaEndpoint::updateSendConfiguration): 36 (WebCore::MockMediaEndpoint::createMutedRemoteSource): 37 (WebCore::MockMediaEndpoint::replaceMutedRemoteSourceMid): 38 (WebCore::MockMediaEndpoint::emulatePlatformEvent): 39 Add "unmute-remote-sources-by-mid" action that emulates data arriving on media descriptions 40 which unmutes the remote sources. 41 (WebCore::MockMediaEndpoint::updateConfigurationMids): 42 (WebCore::MockMediaEndpoint::unmuteRemoteSourcesByMid): 43 (WebCore::MockMediaEndpoint::unmuteTimerFired): 44 * platform/mock/MockMediaEndpoint.h: 45 1 46 2016-10-10 Darin Adler <darin@apple.com> 2 47 -
trunk/Source/WebCore/Modules/mediastream/MediaEndpointPeerConnection.cpp
r206976 r207052 304 304 if (transceiver->hasSendingDirection() && transceiver->sender()->track()) 305 305 sourceMap.set(transceiver->mid(), &transceiver->sender()->track()->source()); 306 break;307 306 } 308 307 } … … 501 500 }); 502 501 503 if (transceiver) 502 if (transceiver) { 503 // This transceiver was created locally with a provisional mid. Its real mid will now be set by the remote 504 // description so we need to update the mid of the transceiver's muted source to preserve the association. 504 505 transceiver->setMid(mediaDescription->mid()); 505 else 506 m_mediaEndpoint->replaceMutedRemoteSourceMid(transceiver->provisionalMid(), mediaDescription->mid()); 507 } else 506 508 receiveOnlyFlag = true; 507 509 } -
trunk/Source/WebCore/platform/mediastream/MediaEndpoint.cpp
r202624 r207052 72 72 Ref<RealtimeMediaSource> createMutedRemoteSource(const String&, RealtimeMediaSource::Type) override { return EmptyRealtimeMediaSource::create(); } 73 73 void replaceSendSource(RealtimeMediaSource&, const String&) override { } 74 void replaceMutedRemoteSourceMid(const String&, const String&) override { }; 74 75 75 76 void stop() override { } -
trunk/Source/WebCore/platform/mediastream/MediaEndpoint.h
r206908 r207052 78 78 virtual Ref<RealtimeMediaSource> createMutedRemoteSource(const String& mid, RealtimeMediaSource::Type) = 0; 79 79 virtual void replaceSendSource(RealtimeMediaSource&, const String& mid) = 0; 80 virtual void replaceMutedRemoteSourceMid(const String& oldMid, const String& newMid) = 0; 80 81 81 82 virtual void stop() = 0; -
trunk/Source/WebCore/platform/mock/MockMediaEndpoint.cpp
r206908 r207052 38 38 #include "MockRealtimeAudioSource.h" 39 39 #include "MockRealtimeVideoSource.h" 40 #include "RealtimeMediaSource.h" 40 41 #include <wtf/MainThread.h> 41 42 … … 54 55 , m_iceCandidateTimer(*this, &MockMediaEndpoint::iceCandidateTimerFired) 55 56 , m_iceTransportTimer(*this, &MockMediaEndpoint::iceTransportTimerFired) 57 , m_unmuteTimer(*this, &MockMediaEndpoint::unmuteTimerFired) 56 58 { 57 59 } … … 164 166 UNUSED_PARAM(isInitiator); 165 167 166 Vector<String> mids; 167 for (const RefPtr<PeerMediaDescription>& mediaDescription : configuration->mediaDescriptions()) 168 mids.append(mediaDescription->mid()); 169 m_mids.swap(mids); 170 168 updateConfigurationMids(*configuration); 171 169 return UpdateResult::Success; 172 170 } … … 174 172 MediaEndpoint::UpdateResult MockMediaEndpoint::updateSendConfiguration(MediaEndpointSessionConfiguration* configuration, const RealtimeMediaSourceMap& sendSourceMap, bool isInitiator) 175 173 { 176 UNUSED_PARAM(configuration);177 174 UNUSED_PARAM(sendSourceMap); 178 175 UNUSED_PARAM(isInitiator); 179 176 177 updateConfigurationMids(*configuration); 180 178 return UpdateResult::Success; 181 179 } … … 189 187 } 190 188 191 Ref<RealtimeMediaSource> MockMediaEndpoint::createMutedRemoteSource(const String&, RealtimeMediaSource::Type type) 192 { 193 if (type == RealtimeMediaSource::Audio) 194 return MockRealtimeAudioSource::createMuted("remote audio"); 195 196 ASSERT(type == RealtimeMediaSource::Video); 197 return MockRealtimeVideoSource::createMuted("remote video"); 189 Ref<RealtimeMediaSource> MockMediaEndpoint::createMutedRemoteSource(const String& mid, RealtimeMediaSource::Type type) 190 { 191 RefPtr<RealtimeMediaSource> source; 192 193 switch (type) { 194 case RealtimeMediaSource::Audio: source = MockRealtimeAudioSource::createMuted("remote audio"); break; 195 case RealtimeMediaSource::Video: source = MockRealtimeVideoSource::createMuted("remote video"); break; 196 case RealtimeMediaSource::None: 197 ASSERT_NOT_REACHED(); 198 } 199 200 m_mutedRemoteSources.set(mid, source); 201 return *source; 198 202 } 199 203 … … 202 206 UNUSED_PARAM(newSource); 203 207 UNUSED_PARAM(mid); 208 } 209 210 void MockMediaEndpoint::replaceMutedRemoteSourceMid(const String& oldMid, const String& newMid) 211 { 212 RefPtr<RealtimeMediaSource> remoteSource = m_mutedRemoteSources.take(oldMid); 213 m_mutedRemoteSources.set(newMid, WTFMove(remoteSource)); 204 214 } 205 215 … … 214 224 else if (action == "step-ice-transport-states") 215 225 stepIceTransportStates(); 226 else if (action == "unmute-remote-sources-by-mid") 227 unmuteRemoteSourcesByMid(); 228 } 229 230 void MockMediaEndpoint::updateConfigurationMids(const MediaEndpointSessionConfiguration& configuration) 231 { 232 Vector<String> mids; 233 for (const RefPtr<PeerMediaDescription>& mediaDescription : configuration.mediaDescriptions()) 234 mids.append(mediaDescription->mid()); 235 m_mids.swap(mids); 216 236 } 217 237 … … 317 337 } 318 338 339 void MockMediaEndpoint::unmuteRemoteSourcesByMid() 340 { 341 if (m_mids.isEmpty()) 342 return; 343 344 // Looking up each source by its mid, instead of simply iterating over the list of muted sources, 345 // emulates remote media arriving on a media description with a specific mid (RTCRtpTransceiver). 346 347 // Copy values in reverse order to maintain the original order while using takeLast() 348 for (int i = m_mids.size() - 1; i >= 0; --i) 349 m_midsOfSourcesToUnmute.append(m_mids[i]); 350 351 m_unmuteTimer.startOneShot(0); 352 } 353 354 void MockMediaEndpoint::unmuteTimerFired() 355 { 356 RefPtr<RealtimeMediaSource> source = m_mutedRemoteSources.get(m_midsOfSourcesToUnmute.takeLast()); 357 if (source) 358 source->setMuted(false); 359 360 if (!m_midsOfSourcesToUnmute.isEmpty()) 361 m_unmuteTimer.startOneShot(0); 362 } 363 319 364 } // namespace WebCore 320 365 -
trunk/Source/WebCore/platform/mock/MockMediaEndpoint.h
r206908 r207052 60 60 Ref<RealtimeMediaSource> createMutedRemoteSource(const String& mid, RealtimeMediaSource::Type) override; 61 61 void replaceSendSource(RealtimeMediaSource&, const String& mid) override; 62 void replaceMutedRemoteSourceMid(const String& oldMid, const String& newMid) override; 62 63 63 64 void stop() override; … … 66 67 67 68 private: 69 void updateConfigurationMids(const MediaEndpointSessionConfiguration&); 70 68 71 void dispatchFakeIceCandidates(); 69 72 void iceCandidateTimerFired(); … … 72 75 void iceTransportTimerFired(); 73 76 77 void unmuteRemoteSourcesByMid(); 78 void unmuteTimerFired(); 79 74 80 MediaEndpointClient& m_client; 75 81 Vector<String> m_mids; 82 HashMap<String, RefPtr<RealtimeMediaSource>> m_mutedRemoteSources; 76 83 77 84 Vector<RefPtr<IceCandidate>> m_fakeIceCandidates; … … 80 87 Vector<std::pair<String, MediaEndpoint::IceTransportState>> m_iceTransportStateChanges; 81 88 Timer m_iceTransportTimer; 89 90 Vector<String> m_midsOfSourcesToUnmute; 91 Timer m_unmuteTimer; 82 92 }; 83 93
Note: See TracChangeset
for help on using the changeset viewer.