Title: [237974] trunk
Revision
237974
Author
you...@apple.com
Date
2018-11-07 18:12:32 -0800 (Wed, 07 Nov 2018)

Log Message

Allow setting RTCRtpTransceiver.direction
https://bugs.webkit.org/show_bug.cgi?id=191346

Reviewed by Eric Carlson.

LayoutTests/imported/w3c:

* web-platform-tests/webrtc/RTCPeerConnection-remote-track-mute.https-expected.txt:
* web-platform-tests/webrtc/RTCPeerConnection-transceivers.https-expected.txt:
* web-platform-tests/webrtc/RTCRtpTransceiver.https-expected.txt:

Source/WebCore:

Remove readonly from the direction attribute.
Keep setDirection for now as it is in use, with an intent to remove it.
Driven-by fix as in some cases, the rtc source track might be changed
and current implementation is not expecting that.
In such a case, stop observing the old track (which should no longer call us)
before observing the new one.

Covered by rebased tests.

* Modules/mediastream/RTCRtpTransceiver.idl:
* platform/mediastream/RealtimeIncomingAudioSource.cpp:
(WebCore::RealtimeIncomingAudioSource::setSourceTrack):
* platform/mediastream/RealtimeIncomingVideoSource.cpp:
(WebCore::RealtimeIncomingVideoSource::setSourceTrack):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (237973 => 237974)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2018-11-08 02:00:49 UTC (rev 237973)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2018-11-08 02:12:32 UTC (rev 237974)
@@ -1,3 +1,14 @@
+2018-11-07  Youenn Fablet  <you...@apple.com>
+
+        Allow setting RTCRtpTransceiver.direction
+        https://bugs.webkit.org/show_bug.cgi?id=191346
+
+        Reviewed by Eric Carlson.
+
+        * web-platform-tests/webrtc/RTCPeerConnection-remote-track-mute.https-expected.txt:
+        * web-platform-tests/webrtc/RTCPeerConnection-transceivers.https-expected.txt:
+        * web-platform-tests/webrtc/RTCRtpTransceiver.https-expected.txt:
+
 2018-11-06  Youenn Fablet  <you...@apple.com>
 
         Reenable imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-ontrack.https.html

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-remote-track-mute.https-expected.txt (237973 => 237974)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-remote-track-mute.https-expected.txt	2018-11-08 02:00:49 UTC (rev 237973)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-remote-track-mute.https-expected.txt	2018-11-08 02:12:32 UTC (rev 237974)
@@ -2,7 +2,7 @@
 Harness Error (TIMEOUT), message = null
 
 FAIL ontrack: track goes from muted to unmuted assert_true: track is muted in ontrack expected true got false
-FAIL Changing transceiver direction to 'inactive' mutes the remote track promise_test: Unhandled rejection with value: object "TypeError: Attempted to assign to readonly property."
-FAIL Changing transceiver direction to 'sendrecv' unmutes the remote track promise_test: Unhandled rejection with value: object "TypeError: Attempted to assign to readonly property."
+PASS Changing transceiver direction to 'inactive' mutes the remote track 
+PASS Changing transceiver direction to 'sendrecv' unmutes the remote track 
 TIMEOUT pc.close() mutes remote tracks Test timed out
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-transceivers.https-expected.txt (237973 => 237974)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-transceivers.https-expected.txt	2018-11-08 02:00:49 UTC (rev 237973)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-transceivers.https-expected.txt	2018-11-08 02:12:32 UTC (rev 237974)
@@ -40,5 +40,5 @@
 PASS addTransceiver does not reuse reusable transceivers 
 PASS Can setup two-way call using a single transceiver 
 PASS Closing the PC stops the transceivers 
-FAIL Changing transceiver direction to 'sendrecv' makes ontrack fire promise_test: Unhandled rejection with value: object "TypeError: Attempted to assign to readonly property."
+PASS Changing transceiver direction to 'sendrecv' makes ontrack fire 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCRtpTransceiver.https-expected.txt (237973 => 237974)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCRtpTransceiver.https-expected.txt	2018-11-08 02:00:49 UTC (rev 237973)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCRtpTransceiver.https-expected.txt	2018-11-08 02:12:32 UTC (rev 237974)
@@ -9,14 +9,14 @@
 FAIL checkAddTransceiverWithOfferToReceiveAudio assert_equals: expected "[{currentDirection:null,direction:\"recvonly\",mid:null,receiver:{track:{kind:\"audio\"}},sender:{track:null},stopped:false}]" but got "[]"
 FAIL checkAddTransceiverWithOfferToReceiveVideo assert_equals: expected "[{currentDirection:null,direction:\"recvonly\",mid:null,receiver:{track:{kind:\"video\"}},sender:{track:null},stopped:false}]" but got "[]"
 FAIL checkAddTransceiverWithOfferToReceiveBoth assert_equals: expected "[{currentDirection:null,direction:\"recvonly\",mid:null,receiver:{track:{kind:\"audio\"}},sender:{track:null},stopped:false},{currentDirection:null,direction:\"recvonly\",mid:null,receiver:{track:{kind:\"video\"}},sender:{track:null},stopped:false}]" but got "[]"
-FAIL checkAddTransceiverWithSetRemoteOfferSending assert_equals: expected "[{streams:[{id:\"2f636d69-e5d0-46d6-b49b-bad547d32229\"}],track:{}}]" but got "[{streams:[],track:{}}]"
-FAIL checkAddTransceiverWithSetRemoteOfferNoSend promise_test: Unhandled rejection with value: object "TypeError: Attempted to assign to readonly property."
+FAIL checkAddTransceiverWithSetRemoteOfferSending assert_equals: expected "[{streams:[{id:\"117b0a30-7f2b-4595-8183-98bd8a7599bb\"}],track:{}}]" but got "[{streams:[],track:{}}]"
+FAIL checkAddTransceiverWithSetRemoteOfferNoSend assert_equals: expected "[{currentDirection:null,direction:\"recvonly\",receiver:{track:{kind:\"audio\"}},sender:{track:null},stopped:false}]" but got "[]"
 PASS checkAddTransceiverBadKind 
 FAIL checkNoMidOffer promise_test: Unhandled rejection with value: object "OperationError: Failed to set remote offer sdp: The BUNDLE group contains MID:0 matching no m= section."
-FAIL checkSetDirection promise_test: Unhandled rejection with value: object "TypeError: Attempted to assign to readonly property."
-FAIL checkCurrentDirection promise_test: Unhandled rejection with value: object "TypeError: Attempted to assign to readonly property."
-FAIL checkSendrecvWithNoSendTrack promise_test: Unhandled rejection with value: object "TypeError: Attempted to assign to readonly property."
-FAIL checkSendrecvWithTracklessStream assert_equals: expected "[{streams:[{id:\"bd494b8b-c2a2-4c08-b2a5-ecda5bacf4e4\"}],track:{}}]" but got "[{streams:[],track:{}}]"
+PASS checkSetDirection 
+PASS checkCurrentDirection 
+PASS checkSendrecvWithNoSendTrack 
+FAIL checkSendrecvWithTracklessStream assert_equals: expected "[{streams:[{id:\"8a46ae8c-120e-42a0-9272-94c79a7745be\"}],track:{}}]" but got "[{streams:[],track:{}}]"
 PASS checkAddTransceiverNoTrackDoesntPair 
 PASS checkAddTransceiverWithTrackDoesntPair 
 PASS checkAddTransceiverThenReplaceTrackDoesntPair 
@@ -25,7 +25,7 @@
 PASS checkReplaceTrackNullDoesntPreventPairing 
 PASS checkRemoveAndReadd 
 PASS checkAddTrackExistingTransceiverThenRemove 
-FAIL checkRemoveTrackNegotiation promise_test: Unhandled rejection with value: object "TypeError: Attempted to assign to readonly property."
+FAIL checkRemoveTrackNegotiation promise_test: Unhandled rejection with value: object "InvalidStateError: Description type incompatible with current signaling state"
 TIMEOUT checkMute Test timed out
 NOTRUN checkOnAddStream 
 NOTRUN checkStop 

Modified: trunk/Source/WebCore/ChangeLog (237973 => 237974)


--- trunk/Source/WebCore/ChangeLog	2018-11-08 02:00:49 UTC (rev 237973)
+++ trunk/Source/WebCore/ChangeLog	2018-11-08 02:12:32 UTC (rev 237974)
@@ -1,3 +1,25 @@
+2018-11-07  Youenn Fablet  <you...@apple.com>
+
+        Allow setting RTCRtpTransceiver.direction
+        https://bugs.webkit.org/show_bug.cgi?id=191346
+
+        Reviewed by Eric Carlson.
+
+        Remove readonly from the direction attribute.
+        Keep setDirection for now as it is in use, with an intent to remove it.
+        Driven-by fix as in some cases, the rtc source track might be changed
+        and current implementation is not expecting that.
+        In such a case, stop observing the old track (which should no longer call us)
+        before observing the new one.
+
+        Covered by rebased tests.
+
+        * Modules/mediastream/RTCRtpTransceiver.idl:
+        * platform/mediastream/RealtimeIncomingAudioSource.cpp:
+        (WebCore::RealtimeIncomingAudioSource::setSourceTrack):
+        * platform/mediastream/RealtimeIncomingVideoSource.cpp:
+        (WebCore::RealtimeIncomingVideoSource::setSourceTrack):
+
 2018-11-07  Sihui Liu  <sihui_...@apple.com>
 
         RELEASE_ASSERT(!m_hardClosedForUserDelete) fails in WebCore::IDBServer::UniqueIDBDatabase::invokeOperationAndTransactionTimer

Modified: trunk/Source/WebCore/Modules/mediastream/RTCRtpTransceiver.idl (237973 => 237974)


--- trunk/Source/WebCore/Modules/mediastream/RTCRtpTransceiver.idl	2018-11-08 02:00:49 UTC (rev 237973)
+++ trunk/Source/WebCore/Modules/mediastream/RTCRtpTransceiver.idl	2018-11-08 02:12:32 UTC (rev 237974)
@@ -39,8 +39,9 @@
     [SameObject] readonly attribute RTCRtpSender sender;
     [SameObject] readonly attribute RTCRtpReceiver receiver;
     readonly attribute boolean stopped;
-    readonly attribute RtpTransceiverDirection direction;
+    attribute RtpTransceiverDirection direction;
     [EnabledAtRuntime=WebRTCUnifiedPlan] readonly attribute RTCRtpTransceiverDirection? currentDirection;
+    // FIXME: Remove setDirection
     void setDirection(RtpTransceiverDirection direction);
     void stop();
     // FIXME 169662: missing setCodecPreferences

Modified: trunk/Source/WebCore/platform/mediastream/RealtimeIncomingAudioSource.cpp (237973 => 237974)


--- trunk/Source/WebCore/platform/mediastream/RealtimeIncomingAudioSource.cpp	2018-11-08 02:00:49 UTC (rev 237973)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeIncomingAudioSource.cpp	2018-11-08 02:12:32 UTC (rev 237974)
@@ -63,9 +63,11 @@
 
 void RealtimeIncomingAudioSource::setSourceTrack(rtc::scoped_refptr<webrtc::AudioTrackInterface>&& track)
 {
-    ASSERT(!m_audioTrack);
     ASSERT(track);
 
+    if (m_audioTrack && isProducingData())
+        m_audioTrack->RemoveSink(this);
+
     m_audioTrack = WTFMove(track);
     notifyMutedChange(!m_audioTrack);
     if (isProducingData())

Modified: trunk/Source/WebCore/platform/mediastream/RealtimeIncomingVideoSource.cpp (237973 => 237974)


--- trunk/Source/WebCore/platform/mediastream/RealtimeIncomingVideoSource.cpp	2018-11-08 02:00:49 UTC (rev 237973)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeIncomingVideoSource.cpp	2018-11-08 02:12:32 UTC (rev 237974)
@@ -58,9 +58,10 @@
 
 void RealtimeIncomingVideoSource::setSourceTrack(rtc::scoped_refptr<webrtc::VideoTrackInterface>&& track)
 {
-    ASSERT(!m_videoTrack);
     ASSERT(track);
 
+    if (m_videoTrack && isProducingData())
+        m_videoTrack->RemoveSink(this);
     m_videoTrack = WTFMove(track);
     notifyMutedChange(!m_videoTrack);
     if (isProducingData())
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to