Allow setting RTCRtpTransceiver.direction
authoryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 Nov 2018 02:12:32 +0000 (02:12 +0000)
committeryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 Nov 2018 02:12:32 +0000 (02:12 +0000)
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):

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

LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-remote-track-mute.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-transceivers.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCRtpTransceiver.https-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediastream/RTCRtpTransceiver.idl
Source/WebCore/platform/mediastream/RealtimeIncomingAudioSource.cpp
Source/WebCore/platform/mediastream/RealtimeIncomingVideoSource.cpp

index 0722e34..cbf93e3 100644 (file)
@@ -1,3 +1,14 @@
+2018-11-07  Youenn Fablet  <youenn@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  <youenn@apple.com>
 
         Reenable imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-ontrack.https.html
index aa7cf89..b951790 100644 (file)
@@ -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
 
index 75d5b73..a109620 100644 (file)
@@ -40,5 +40,5 @@ PASS addTrack reuses reusable transceivers
 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 
 
index 53fa4eb..ffaa6cb 100644 (file)
@@ -9,14 +9,14 @@ FAIL checkAddTransceiverWithStream assert_true: offer contains the expected audi
 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 checkAddTrackPairs
 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 
index 580a331..4af229f 100644 (file)
@@ -1,3 +1,25 @@
+2018-11-07  Youenn Fablet  <youenn@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_liu@apple.com>
 
         RELEASE_ASSERT(!m_hardClosedForUserDelete) fails in WebCore::IDBServer::UniqueIDBDatabase::invokeOperationAndTransactionTimer
index 157e05a..cc640f4 100644 (file)
@@ -39,8 +39,9 @@ typedef RTCRtpTransceiverDirection RtpTransceiverDirection;
     [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
index c63bf79..74ad296 100644 (file)
@@ -63,9 +63,11 @@ void RealtimeIncomingAudioSource::stopProducingData()
 
 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())
index b678280..d4115b2 100644 (file)
@@ -58,9 +58,10 @@ void RealtimeIncomingVideoSource::startProducingData()
 
 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())