RTCTrackEvent should be delayed until the whole remote description is set
authoryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 29 Apr 2019 16:24:31 +0000 (16:24 +0000)
committeryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 29 Apr 2019 16:24:31 +0000 (16:24 +0000)
commit8f1f26fa744bb68687d4724d6fc9c9bbd824527b
tree2d0eeaa0bda343987e0d2f14bcc48ebc4dcb31c3
parent8824755d0e1e39b3a5c211a568a0e570e30886a0
RTCTrackEvent should be delayed until the whole remote description is set
https://bugs.webkit.org/show_bug.cgi?id=196808
<rdar://problem/49802649>

Reviewed by Eric Carlson.

Source/WebCore:

As per https://w3c.github.io/webrtc-pc/#set-description,
fire events just before resolving the setRemoteDescription promise.
This ensures that the exposed stream has all necessary tracks from the beginning.
Pending track events are created in LibWebRTCMediaEndpoint and stored in PeerConnectionBackend.

Covered by updated test.

* Modules/mediastream/PeerConnectionBackend.cpp:
(WebCore::PeerConnectionBackend::setRemoteDescriptionSucceeded):
(WebCore::PeerConnectionBackend::setRemoteDescriptionFailed):
(WebCore::PeerConnectionBackend::addPendingTrackEvent):
(WebCore::PeerConnectionBackend::stop):
* Modules/mediastream/PeerConnectionBackend.h:
* Modules/mediastream/RTCPeerConnection.cpp:
* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
(WebCore::LibWebRTCMediaEndpoint::addRemoteTrack):
(WebCore::LibWebRTCMediaEndpoint::addPendingTrackEvent):
(WebCore::LibWebRTCMediaEndpoint::newTransceiver):
* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:

LayoutTests:

* webrtc/video-addTrack.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244736 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/webrtc/video-addTrack.html
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediastream/PeerConnectionBackend.cpp
Source/WebCore/Modules/mediastream/PeerConnectionBackend.h
Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp
Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp
Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h