Diff
Modified: trunk/LayoutTests/ChangeLog (213519 => 213520)
--- trunk/LayoutTests/ChangeLog 2017-03-07 17:11:06 UTC (rev 213519)
+++ trunk/LayoutTests/ChangeLog 2017-03-07 17:15:06 UTC (rev 213520)
@@ -1,3 +1,13 @@
+2017-03-07 Youenn Fablet <[email protected]>
+
+ Expose WebRTC current/pending description getters
+ https://bugs.webkit.org/show_bug.cgi?id=169216
+
+ Reviewed by Alex Christensen.
+
+ * webrtc/descriptionGetters-expected.txt: Added.
+ * webrtc/descriptionGetters.html: Added.
+
2017-03-07 Chris Dumez <[email protected]>
Align initEvent / initCustomEvent / initMessageEvent with the latest specification
Added: trunk/LayoutTests/webrtc/descriptionGetters-expected.txt (0 => 213520)
--- trunk/LayoutTests/webrtc/descriptionGetters-expected.txt (rev 0)
+++ trunk/LayoutTests/webrtc/descriptionGetters-expected.txt 2017-03-07 17:15:06 UTC (rev 213520)
@@ -0,0 +1,3 @@
+
+PASS description getters when changing description from video to video & data channel
+
Added: trunk/LayoutTests/webrtc/descriptionGetters.html (0 => 213520)
--- trunk/LayoutTests/webrtc/descriptionGetters.html (rev 0)
+++ trunk/LayoutTests/webrtc/descriptionGetters.html 2017-03-07 17:15:06 UTC (rev 213520)
@@ -0,0 +1,84 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Testing basic video exchange from offerer to receiver</title>
+ <script src=""
+ <script src=""
+ </head>
+ <body>
+ <script>
+if (window.testRunner)
+ testRunner.setUserMediaPermission(true);
+
+promise_test((test) => {
+ if (window.internals)
+ internals.useMockRTCPeerConnectionFactory("TwoRealPeerConnections");
+
+ var localConnection = new RTCPeerConnection();
+ var remoteConnection = new RTCPeerConnection();
+ var currentSDP;
+ return navigator.mediaDevices.getUserMedia({ video: true}).then((stream) => {
+
+ localConnection.addStream(stream);
+ return localConnection.createOffer();
+ }).then((desc) => {
+ currentSDP = desc.sdp;
+
+ assert_equals(localConnection.currentLocalDescription, null);
+ assert_equals(localConnection.pendingLocalDescription, null);
+ assert_equals(localConnection.localDescription, null);
+
+ assert_equals(remoteConnection.currentRemoteDescription, null);
+ assert_equals(remoteConnection.pendingRemoteDescription, null);
+ assert_equals(remoteConnection.remoteDescription, null);
+
+ localDescriptionPromise = localConnection.setLocalDescription(desc);
+ remoteDescriptionPromise = remoteConnection.setRemoteDescription(desc);
+
+ assert_equals(localConnection.currentLocalDescription, null);
+ assert_equals(localConnection.pendingLocalDescription.sdp, currentSDP);
+ assert_equals(localConnection.localDescription.sdp, currentSDP);
+
+ assert_equals(remoteConnection.currentRemoteDescription, null);
+ assert_equals(remoteConnection.pendingRemoteDescription.sdp, currentSDP);
+ assert_equals(remoteConnection.remoteDescription.sdp, currentSDP);
+
+ return Promise.all([localDescriptionPromise, remoteDescriptionPromise]);
+ }).then(() => {
+ return remoteConnection.createAnswer();
+ }).then((desc) => {
+ assert_equals(localConnection.currentLocalDescription, null);
+ assert_equals(localConnection.pendingLocalDescription.sdp, currentSDP);
+ assert_equals(localConnection.localDescription.sdp, currentSDP);
+
+ localConnection.setRemoteDescription(desc);
+
+ assert_equals(localConnection.currentLocalDescription.sdp, currentSDP);
+ assert_equals(localConnection.pendingLocalDescription, null);
+ assert_equals(localConnection.localDescription.sdp, currentSDP);
+
+ assert_equals(remoteConnection.currentRemoteDescription, null);
+ assert_equals(remoteConnection.pendingRemoteDescription.sdp, currentSDP);
+ assert_equals(remoteConnection.remoteDescription.sdp, currentSDP);
+
+ remoteConnection.setLocalDescription(desc);
+
+ assert_equals(remoteConnection.currentRemoteDescription.sdp, currentSDP);
+ assert_equals(remoteConnection.pendingRemoteDescription, null);
+ assert_equals(remoteConnection.remoteDescription.sdp, currentSDP);
+
+ localConnection.createDataChannel("test");
+
+ assert_equals(localConnection.currentLocalDescription.sdp, currentSDP);
+ assert_equals(localConnection.pendingLocalDescription, null);
+ assert_equals(localConnection.localDescription.sdp, currentSDP);
+
+ assert_equals(remoteConnection.currentRemoteDescription.sdp, currentSDP);
+ assert_equals(remoteConnection.pendingRemoteDescription, null);
+ assert_equals(remoteConnection.remoteDescription.sdp, currentSDP);
+ });
+}, "description getters when changing description from video to video & data channel");
+ </script>
+ </body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (213519 => 213520)
--- trunk/Source/WebCore/ChangeLog 2017-03-07 17:11:06 UTC (rev 213519)
+++ trunk/Source/WebCore/ChangeLog 2017-03-07 17:15:06 UTC (rev 213520)
@@ -1,3 +1,22 @@
+2017-03-07 Youenn Fablet <[email protected]>
+
+ Expose WebRTC current/pending description getters
+ https://bugs.webkit.org/show_bug.cgi?id=169216
+
+ Reviewed by Alex Christensen.
+
+ Test: webrtc/descriptionGetters.html
+
+ Implement pending and current description getters through libwebrtc.
+ These getters do not yet match the spec as can be seen from the test, which is written to match the implemented behavior.
+
+ * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
+ (WebCore::LibWebRTCPeerConnectionBackend::currentLocalDescription):
+ (WebCore::LibWebRTCPeerConnectionBackend::currentRemoteDescription):
+ (WebCore::LibWebRTCPeerConnectionBackend::pendingLocalDescription):
+ (WebCore::LibWebRTCPeerConnectionBackend::pendingRemoteDescription):
+ * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
+
2017-03-07 Chris Dumez <[email protected]>
Port DOMTimer from std::chrono::milliseconds to WTF::Seconds type
Modified: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp (213519 => 213520)
--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp 2017-03-07 17:11:06 UTC (rev 213519)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp 2017-03-07 17:15:06 UTC (rev 213520)
@@ -101,9 +101,29 @@
return RTCSessionDescription::create(fromSessionDescriptionType(*description), WTFMove(sdpString));
}
+// FIXME: We might want to create a new object only if the session actually changed for all description getters.
+RefPtr<RTCSessionDescription> LibWebRTCMediaEndpoint::currentLocalDescription() const
+{
+ return fromSessionDescription(m_backend->current_local_description());
+}
+
+RefPtr<RTCSessionDescription> LibWebRTCMediaEndpoint::currentRemoteDescription() const
+{
+ return fromSessionDescription(m_backend->current_remote_description());
+}
+
+RefPtr<RTCSessionDescription> LibWebRTCMediaEndpoint::pendingLocalDescription() const
+{
+ return fromSessionDescription(m_backend->pending_local_description());
+}
+
+RefPtr<RTCSessionDescription> LibWebRTCMediaEndpoint::pendingRemoteDescription() const
+{
+ return fromSessionDescription(m_backend->pending_remote_description());
+}
+
RefPtr<RTCSessionDescription> LibWebRTCMediaEndpoint::localDescription() const
{
- // FIXME: We might want to create a new object only if the session actually changed.
return fromSessionDescription(m_backend->local_description());
}
Modified: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h (213519 => 213520)
--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h 2017-03-07 17:11:06 UTC (rev 213519)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h 2017-03-07 17:15:06 UTC (rev 213520)
@@ -74,6 +74,10 @@
RefPtr<RTCSessionDescription> localDescription() const;
RefPtr<RTCSessionDescription> remoteDescription() const;
+ RefPtr<RTCSessionDescription> currentLocalDescription() const;
+ RefPtr<RTCSessionDescription> currentRemoteDescription() const;
+ RefPtr<RTCSessionDescription> pendingLocalDescription() const;
+ RefPtr<RTCSessionDescription> pendingRemoteDescription() const;
private:
LibWebRTCMediaEndpoint(LibWebRTCPeerConnectionBackend&, LibWebRTCProvider&);
Modified: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp (213519 => 213520)
--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp 2017-03-07 17:11:06 UTC (rev 213519)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp 2017-03-07 17:15:06 UTC (rev 213520)
@@ -218,6 +218,26 @@
return m_endpoint->createDataChannel(label, options);
}
+RefPtr<RTCSessionDescription> LibWebRTCPeerConnectionBackend::currentLocalDescription() const
+{
+ return m_endpoint->currentLocalDescription();
+}
+
+RefPtr<RTCSessionDescription> LibWebRTCPeerConnectionBackend::currentRemoteDescription() const
+{
+ return m_endpoint->currentRemoteDescription();
+}
+
+RefPtr<RTCSessionDescription> LibWebRTCPeerConnectionBackend::pendingLocalDescription() const
+{
+ return m_endpoint->pendingLocalDescription();
+}
+
+RefPtr<RTCSessionDescription> LibWebRTCPeerConnectionBackend::pendingRemoteDescription() const
+{
+ return m_endpoint->pendingRemoteDescription();
+}
+
RefPtr<RTCSessionDescription> LibWebRTCPeerConnectionBackend::localDescription() const
{
return m_endpoint->localDescription();
Modified: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h (213519 => 213520)
--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h 2017-03-07 17:11:06 UTC (rev 213519)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h 2017-03-07 17:15:06 UTC (rev 213520)
@@ -60,12 +60,12 @@
Ref<RTCRtpReceiver> createReceiver(const String& transceiverMid, const String& trackKind, const String& trackId) final;
RefPtr<RTCSessionDescription> localDescription() const final;
- RefPtr<RTCSessionDescription> currentLocalDescription() const final { return localDescription(); }
- RefPtr<RTCSessionDescription> pendingLocalDescription() const final { return localDescription(); }
+ RefPtr<RTCSessionDescription> currentLocalDescription() const final;
+ RefPtr<RTCSessionDescription> pendingLocalDescription() const final;
RefPtr<RTCSessionDescription> remoteDescription() const final;
- RefPtr<RTCSessionDescription> currentRemoteDescription() const final { return remoteDescription(); }
- RefPtr<RTCSessionDescription> pendingRemoteDescription() const final { return remoteDescription(); }
+ RefPtr<RTCSessionDescription> currentRemoteDescription() const final;
+ RefPtr<RTCSessionDescription> pendingRemoteDescription() const final;
// FIXME: API to implement for real
Vector<RefPtr<MediaStream>> getRemoteStreams() const final { return { }; }