Introduce RTCRtpSendParameters
authoryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Sep 2018 15:31:04 +0000 (15:31 +0000)
committeryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Sep 2018 15:31:04 +0000 (15:31 +0000)
https://bugs.webkit.org/show_bug.cgi?id=189563

Reviewed by Eric Carlson.

Source/WebCore:

Introduce RTCRtpSendParameters to match the WebRTC specification.
Split RTCRtpPrameters fields accordingly and update call sites.

Covered by updated test.

* CMakeLists.txt:
* DerivedSources.make:
* Modules/mediastream/PeerConnectionBackend.h:
* Modules/mediastream/RTCRtpCodingParameters.h: Added
* Modules/mediastream/RTCRtpCodingParameters.idl: Added
* Modules/mediastream/RTCRtpDecodingParameters.h: Added
* Modules/mediastream/RTCRtpDecodingParameters.idl: Added
* Modules/mediastream/RTCRtpEncodingParameters.h:
* Modules/mediastream/RTCRtpEncodingParameters.idl:
* Modules/mediastream/RTCRtpParameters.h:
* Modules/mediastream/RTCRtpParameters.idl:
* Modules/mediastream/RTCRtpReceiver.cpp:
* Modules/mediastream/RTCRtpSendParameters.h: Added.
(WebCore::RTCRtpSendParameters::RTCRtpSendParameters):
* Modules/mediastream/RTCRtpSendParameters.idl: Added.
* Modules/mediastream/RTCRtpSender.cpp:
(WebCore::RTCRtpSender::getParameters):
(WebCore::RTCRtpSender::setParameters):
* Modules/mediastream/RTCRtpSender.h:
* Modules/mediastream/RTCRtpSender.idl:
* Modules/mediastream/RTCRtpSenderBackend.h:
* Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp:
(WebCore::LibWebRTCRtpSenderBackend::getParameters const):
(WebCore::LibWebRTCRtpSenderBackend::setParameters):
* Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h:
* Modules/mediastream/libwebrtc/LibWebRTCUtils.cpp:
(WebCore::toRTCRtpParameters):
(WebCore::toRTCRtpSendParameters):
(WebCore::fromRTCRtpSendParameters):
* Modules/mediastream/libwebrtc/LibWebRTCUtils.h:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:

LayoutTests:

* webrtc/video-getParameters-expected.txt:
* webrtc/video-getParameters.html:

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

28 files changed:
LayoutTests/ChangeLog
LayoutTests/webrtc/video-getParameters-expected.txt
LayoutTests/webrtc/video-getParameters.html
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.make
Source/WebCore/Modules/mediastream/PeerConnectionBackend.h
Source/WebCore/Modules/mediastream/RTCRtpCodingParameters.h [new file with mode: 0644]
Source/WebCore/Modules/mediastream/RTCRtpCodingParameters.idl [new file with mode: 0644]
Source/WebCore/Modules/mediastream/RTCRtpDecodingParameters.h [new file with mode: 0644]
Source/WebCore/Modules/mediastream/RTCRtpDecodingParameters.idl [new file with mode: 0644]
Source/WebCore/Modules/mediastream/RTCRtpEncodingParameters.h
Source/WebCore/Modules/mediastream/RTCRtpEncodingParameters.idl
Source/WebCore/Modules/mediastream/RTCRtpParameters.h
Source/WebCore/Modules/mediastream/RTCRtpParameters.idl
Source/WebCore/Modules/mediastream/RTCRtpReceiver.cpp
Source/WebCore/Modules/mediastream/RTCRtpSendParameters.h [new file with mode: 0644]
Source/WebCore/Modules/mediastream/RTCRtpSendParameters.idl [new file with mode: 0644]
Source/WebCore/Modules/mediastream/RTCRtpSender.cpp
Source/WebCore/Modules/mediastream/RTCRtpSender.h
Source/WebCore/Modules/mediastream/RTCRtpSender.idl
Source/WebCore/Modules/mediastream/RTCRtpSenderBackend.h
Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp
Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h
Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCUtils.cpp
Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCUtils.h
Source/WebCore/Sources.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj

index 0f7913d..a6f3b92 100644 (file)
@@ -1,3 +1,13 @@
+2018-09-13  Youenn Fablet  <youenn@apple.com>
+
+        Introduce RTCRtpSendParameters
+        https://bugs.webkit.org/show_bug.cgi?id=189563
+
+        Reviewed by Eric Carlson.
+
+        * webrtc/video-getParameters-expected.txt:
+        * webrtc/video-getParameters.html:
+
 2018-09-12  Dean Jackson  <dino@grorg.org>
 
         Header parsing for experimental and internal debug features
index 9e43930..a5043a4 100644 (file)
@@ -40,17 +40,19 @@ promise_test((test) => {
         assert_true(!!senderParameters, "sender parameters should not be undefined or null");
         assert_true(!!receiverParameters, "receiver parameters should not be undefined or null");
 
+        assert_array_equals(receiverParameters.codecs, [], "receiver codecs");
+        assert_array_equals(receiverParameters.headerExtensions, [], "receiver header extensions");
+
+        senderParameters.encodings[0].ssrc = 1;
         senderParameters.encodings[0].fec.ssrc = 1;
         senderParameters.encodings[0].rtx.ssrc = 1;
 
-        senderParameters.transactionId = "";
-        receiverParameters.transactionId = "";
-
-        senderParameters.encodings[0].ssrc = 1;
-        assert_equals(JSON.stringify(senderParameters), '{"codecs":[],"degradationPreference":"balanced","encodings":[{"active":true,"fec":{"ssrc":1},"maxBitrate":0,"maxFramerate":0,"priority":"medium","rid":"","rtx":{"ssrc":1},"scaleResolutionDownBy":1,"ssrc":1}],"headerExtensions":[],"transactionId":""}', "Testing sanitized sender parameters");
-        assert_equals(JSON.stringify(receiverParameters), '{"codecs":[],"degradationPreference":"balanced","encodings":[],"headerExtensions":[],"transactionId":""}', "Testing sanitized receiver parameters");
+        assert_true(!!senderParameters.transactionId, "sender transaction");
+        assert_array_equals(senderParameters.codecs, [], "sender codecs");
+        assert_array_equals(senderParameters.headerExtensions, [], "sender header extensions");
+        assert_equals(senderParameters.degradationPreference, "balanced", "sender degradation");
     });
-}, "Basic video stats");
+}, "Sender and receiver parameters");
         </script>
     </body>
 </html>
index 741be35..b6ae949 100644 (file)
@@ -327,6 +327,7 @@ set(WebCore_NON_SVG_IDL_FILES
     Modules/mediastream/RTCRtpParameters.idl
     Modules/mediastream/RTCRtpReceiver.idl
     Modules/mediastream/RTCRtpRtxParameters.idl
+    Modules/mediastream/RTCRtpSendParameters.idl
     Modules/mediastream/RTCRtpSender.idl
     Modules/mediastream/RTCRtpTransceiver.idl
     Modules/mediastream/RTCRtpTransceiverDirection.idl
index 88320c4..b478dc2 100644 (file)
@@ -1,3 +1,48 @@
+2018-09-13  Youenn Fablet  <youenn@apple.com>
+
+        Introduce RTCRtpSendParameters
+        https://bugs.webkit.org/show_bug.cgi?id=189563
+
+        Reviewed by Eric Carlson.
+
+        Introduce RTCRtpSendParameters to match the WebRTC specification.
+        Split RTCRtpPrameters fields accordingly and update call sites.
+
+        Covered by updated test.
+
+        * CMakeLists.txt:
+        * DerivedSources.make:
+        * Modules/mediastream/PeerConnectionBackend.h:
+        * Modules/mediastream/RTCRtpCodingParameters.h: Added
+        * Modules/mediastream/RTCRtpCodingParameters.idl: Added
+        * Modules/mediastream/RTCRtpDecodingParameters.h: Added
+        * Modules/mediastream/RTCRtpDecodingParameters.idl: Added
+        * Modules/mediastream/RTCRtpEncodingParameters.h:
+        * Modules/mediastream/RTCRtpEncodingParameters.idl:
+        * Modules/mediastream/RTCRtpParameters.h:
+        * Modules/mediastream/RTCRtpParameters.idl:
+        * Modules/mediastream/RTCRtpReceiver.cpp:
+        * Modules/mediastream/RTCRtpSendParameters.h: Added.
+        (WebCore::RTCRtpSendParameters::RTCRtpSendParameters):
+        * Modules/mediastream/RTCRtpSendParameters.idl: Added.
+        * Modules/mediastream/RTCRtpSender.cpp:
+        (WebCore::RTCRtpSender::getParameters):
+        (WebCore::RTCRtpSender::setParameters):
+        * Modules/mediastream/RTCRtpSender.h:
+        * Modules/mediastream/RTCRtpSender.idl:
+        * Modules/mediastream/RTCRtpSenderBackend.h:
+        * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp:
+        (WebCore::LibWebRTCRtpSenderBackend::getParameters const):
+        (WebCore::LibWebRTCRtpSenderBackend::setParameters):
+        * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h:
+        * Modules/mediastream/libwebrtc/LibWebRTCUtils.cpp:
+        (WebCore::toRTCRtpParameters):
+        (WebCore::toRTCRtpSendParameters):
+        (WebCore::fromRTCRtpSendParameters):
+        * Modules/mediastream/libwebrtc/LibWebRTCUtils.h:
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+
 2018-09-13  Xabier Rodriguez Calvar  <calvaris@igalia.com>
 
         [GStreamer][EME] decrypt-key-needed message renamed to drm-cdm-instance-needed
index 47355fe..92cc15b 100644 (file)
@@ -251,6 +251,7 @@ JS_BINDING_IDLS = \
     $(WebCore)/Modules/mediastream/RTCRtpParameters.idl \
     $(WebCore)/Modules/mediastream/RTCRtpReceiver.idl \
     $(WebCore)/Modules/mediastream/RTCRtpRtxParameters.idl \
+    $(WebCore)/Modules/mediastream/RTCRtpSendParameters.idl \
     $(WebCore)/Modules/mediastream/RTCRtpSender.idl \
     $(WebCore)/Modules/mediastream/RTCRtpTransceiver.idl \
     $(WebCore)/Modules/mediastream/RTCRtpTransceiverDirection.idl \
index 284a64a..06e9272 100644 (file)
@@ -35,7 +35,7 @@
 
 #include "JSDOMPromiseDeferred.h"
 #include "LibWebRTCProvider.h"
-#include "RTCRtpParameters.h"
+#include "RTCRtpSendParameters.h"
 #include "RTCSessionDescription.h"
 #include "RTCSignalingState.h"
 #include <wtf/LoggerHelper.h>
diff --git a/Source/WebCore/Modules/mediastream/RTCRtpCodingParameters.h b/Source/WebCore/Modules/mediastream/RTCRtpCodingParameters.h
new file mode 100644 (file)
index 0000000..4d8f7f1
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(WEB_RTC)
+
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+struct RTCRtpCodingParameters {
+    String rid;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_RTC)
diff --git a/Source/WebCore/Modules/mediastream/RTCRtpCodingParameters.idl b/Source/WebCore/Modules/mediastream/RTCRtpCodingParameters.idl
new file mode 100644 (file)
index 0000000..789be95
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+* Copyright (C) 2018 Apple Inc. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+* 1. Redistributions of source code must retain the above copyright
+*    notice, this list of conditions and the following disclaimer.
+* 2. Redistributions in binary form must reproduce the above copyright
+*    notice, this list of conditions and the following disclaimer in the
+*    documentation and/or other materials provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+* THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+[
+    Conditional=WEB_RTC,
+    EnabledAtRuntime=PeerConnection,
+    JSGenerateToJSObject,
+] dictionary RTCRtpCodingParameters {
+    DOMString rid;
+};
diff --git a/Source/WebCore/Modules/mediastream/RTCRtpDecodingParameters.h b/Source/WebCore/Modules/mediastream/RTCRtpDecodingParameters.h
new file mode 100644 (file)
index 0000000..ee3c3ec
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(WEB_RTC)
+
+#include "RTCRtpCodingParameters.h"
+
+namespace WebCore {
+
+struct RTCRtpDecodingParameters : RTCRtpCodingParameters {
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_RTC)
diff --git a/Source/WebCore/Modules/mediastream/RTCRtpDecodingParameters.idl b/Source/WebCore/Modules/mediastream/RTCRtpDecodingParameters.idl
new file mode 100644 (file)
index 0000000..17640a8
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+* Copyright (C) 2018 Apple Inc. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+* 1. Redistributions of source code must retain the above copyright
+*    notice, this list of conditions and the following disclaimer.
+* 2. Redistributions in binary form must reproduce the above copyright
+*    notice, this list of conditions and the following disclaimer in the
+*    documentation and/or other materials provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+* THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+[
+    Conditional=WEB_RTC,
+    EnabledAtRuntime=PeerConnection,
+    JSGenerateToJSObject,
+] dictionary RTCRtpDecodingParameters : RTCRtpCodingParameters {
+};
index a31a4c5..7a5c7dc 100644 (file)
 
 #include "RTCDtxStatus.h"
 #include "RTCPriorityType.h"
+#include "RTCRtpCodingParameters.h"
 #include "RTCRtpFecParameters.h"
 #include "RTCRtpRtxParameters.h"
 
 namespace WebCore {
 
-struct RTCRtpEncodingParameters {
+struct RTCRtpEncodingParameters : RTCRtpCodingParameters {
     unsigned long ssrc { 0 };
     RTCRtpRtxParameters rtx;
     RTCRtpFecParameters fec;
@@ -43,7 +44,6 @@ struct RTCRtpEncodingParameters {
     RTCPriorityType priority { RTCPriorityType::Medium };
     unsigned long maxBitrate { 0 };
     unsigned long maxFramerate { 0 };
-    String rid;
     double scaleResolutionDownBy { 1 };
 };
 
index a78e304..c804aca 100644 (file)
@@ -27,7 +27,7 @@
     Conditional=WEB_RTC,
     EnabledAtRuntime=PeerConnection,
     JSGenerateToJSObject,
-] dictionary RTCRtpEncodingParameters {
+] dictionary RTCRtpEncodingParameters : RTCRtpCodingParameters {
     unsigned long ssrc;
     RTCRtpRtxParameters rtx;
     RTCRtpFecParameters fec;
@@ -36,6 +36,5 @@
     RTCPriorityType priority;
     unsigned long maxBitrate;
     unsigned long maxFramerate;
-    DOMString rid;
     double scaleResolutionDownBy = 1;
 };
index 1975c47..a978203 100644 (file)
 
 #if ENABLE(WEB_RTC)
 
-#include "RTCDegradationPreference.h"
 #include "RTCRtpCodecParameters.h"
-#include "RTCRtpEncodingParameters.h"
 #include "RTCRtpHeaderExtensionParameters.h"
 #include <wtf/Vector.h>
-#include <wtf/text/WTFString.h>
 
 namespace WebCore {
 
 struct RTCRtpParameters {
-    String transactionId;
-    Vector<RTCRtpEncodingParameters> encodings;
     Vector<RTCRtpHeaderExtensionParameters> headerExtensions;
     Vector<RTCRtpCodecParameters> codecs;
-    RTCDegradationPreference degradationPreference { RTCDegradationPreference::Balanced };
 };
 
 
index 468b11a..b7e8b7a 100644 (file)
     EnabledAtRuntime=PeerConnection,
     JSGenerateToJSObject,
 ] dictionary RTCRtpParameters {
-    DOMString transactionId;
-    sequence<RTCRtpEncodingParameters> encodings;
     sequence<RTCRtpHeaderExtensionParameters> headerExtensions;
     // FIXME: Add RTCRtcpParameters rtcp;
     sequence<RTCRtpCodecParameters> codecs;
-    RTCDegradationPreference degradationPreference = "balanced";
 };
index bfb6163..58f42ca 100644 (file)
@@ -33,8 +33,6 @@
 
 #if ENABLE(WEB_RTC)
 
-#include "RTCRtpParameters.h"
-
 namespace WebCore {
 
 RTCRtpReceiver::RTCRtpReceiver(Ref<MediaStreamTrack>&& track, std::unique_ptr<RTCRtpReceiverBackend>&& backend)
diff --git a/Source/WebCore/Modules/mediastream/RTCRtpSendParameters.h b/Source/WebCore/Modules/mediastream/RTCRtpSendParameters.h
new file mode 100644 (file)
index 0000000..61f33de
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(WEB_RTC)
+
+#include "RTCDegradationPreference.h"
+#include "RTCRtpEncodingParameters.h"
+#include "RTCRtpParameters.h"
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+struct RTCRtpSendParameters : RTCRtpParameters {
+    RTCRtpSendParameters() = default;
+    explicit RTCRtpSendParameters(RTCRtpParameters&& parameters)
+        : RTCRtpParameters(WTFMove(parameters))
+    {
+    }
+
+    String transactionId;
+    Vector<RTCRtpEncodingParameters> encodings;
+    RTCDegradationPreference degradationPreference { RTCDegradationPreference::Balanced };
+};
+
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_RTC)
diff --git a/Source/WebCore/Modules/mediastream/RTCRtpSendParameters.idl b/Source/WebCore/Modules/mediastream/RTCRtpSendParameters.idl
new file mode 100644 (file)
index 0000000..4ca1503
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+* Copyright (C) 2018 Apple Inc. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+* 1. Redistributions of source code must retain the above copyright
+*    notice, this list of conditions and the following disclaimer.
+* 2. Redistributions in binary form must reproduce the above copyright
+*    notice, this list of conditions and the following disclaimer in the
+*    documentation and/or other materials provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+* THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+[
+    Conditional=WEB_RTC,
+    EnabledAtRuntime=PeerConnection,
+    JSGenerateToJSObject,
+] dictionary RTCRtpSendParameters : RTCRtpParameters {
+    required DOMString transactionId;
+    required sequence<RTCRtpEncodingParameters> encodings;
+    RTCDegradationPreference degradationPreference = "balanced";
+};
index 1908176..7ebddd9 100644 (file)
@@ -94,14 +94,14 @@ void RTCRtpSender::replaceTrack(ScriptExecutionContext& context, RefPtr<MediaStr
     m_backend->replaceTrack(context, *this, WTFMove(withTrack), WTFMove(promise));
 }
 
-RTCRtpParameters RTCRtpSender::getParameters()
+RTCRtpSendParameters RTCRtpSender::getParameters()
 {
     if (isStopped())
         return { };
     return m_backend->getParameters();
 }
 
-void RTCRtpSender::setParameters(const RTCRtpParameters& parameters, DOMPromiseDeferred<void>&& promise)
+void RTCRtpSender::setParameters(const RTCRtpSendParameters& parameters, DOMPromiseDeferred<void>&& promise)
 {
     if (isStopped()) {
         promise.reject(InvalidStateError);
index bab39dc..20bbfde 100644 (file)
@@ -59,8 +59,8 @@ public:
 
     void replaceTrack(ScriptExecutionContext&, RefPtr<MediaStreamTrack>&&, DOMPromiseDeferred<void>&&);
 
-    RTCRtpParameters getParameters();
-    void setParameters(const RTCRtpParameters&, DOMPromiseDeferred<void>&&);
+    RTCRtpSendParameters getParameters();
+    void setParameters(const RTCRtpSendParameters&, DOMPromiseDeferred<void>&&);
 
     RTCRtpSenderBackend* backend() { return m_backend.get(); }
 
index 2398a78..91f65b3 100644 (file)
@@ -39,7 +39,7 @@
     // FIXME 169662: missing rtcpTransport
     // FIXME 169662: missing getCapabilities
     // FIXME 169662: missing setStreams
-    RTCRtpParameters getParameters();
-    Promise<void> setParameters(RTCRtpParameters parameters);
+    RTCRtpSendParameters getParameters();
+    Promise<void> setParameters(RTCRtpSendParameters parameters);
     [CallWith=ScriptExecutionContext] Promise<void> replaceTrack(MediaStreamTrack? withTrack);
 };
index 6812936..7ece5b1 100644 (file)
 #if ENABLE(WEB_RTC)
 
 #include "JSDOMPromiseDeferred.h"
-#include "RTCRtpParameters.h"
 
 namespace WebCore {
 
 class MediaStreamTrack;
 class RTCRtpSender;
+struct RTCRtpSendParameters;
 class ScriptExecutionContext;
 
 class RTCRtpSenderBackend {
 public:
     virtual void replaceTrack(ScriptExecutionContext&, RTCRtpSender&, RefPtr<MediaStreamTrack>&&, DOMPromiseDeferred<void>&&) = 0;
-    virtual RTCRtpParameters getParameters() const = 0;
-    virtual void setParameters(const RTCRtpParameters&, DOMPromiseDeferred<void>&&) = 0;
+    virtual RTCRtpSendParameters getParameters() const = 0;
+    virtual void setParameters(const RTCRtpSendParameters&, DOMPromiseDeferred<void>&&) = 0;
     virtual ~RTCRtpSenderBackend() = default;
 };
 
index a0e1488..8990489 100644 (file)
@@ -100,21 +100,21 @@ void LibWebRTCRtpSenderBackend::replaceTrack(ScriptExecutionContext& context, RT
     });
 }
 
-RTCRtpParameters LibWebRTCRtpSenderBackend::getParameters() const
+RTCRtpSendParameters LibWebRTCRtpSenderBackend::getParameters() const
 {
     if (!m_rtcSender)
         return { };
 
-    return toRTCRtpParameters(m_rtcSender->GetParameters());
+    return toRTCRtpSendParameters(m_rtcSender->GetParameters());
 }
 
-void LibWebRTCRtpSenderBackend::setParameters(const RTCRtpParameters& parameters, DOMPromiseDeferred<void>&& promise)
+void LibWebRTCRtpSenderBackend::setParameters(const RTCRtpSendParameters& parameters, DOMPromiseDeferred<void>&& promise)
 {
     if (!m_rtcSender) {
         promise.reject(NotSupportedError);
         return;
     }
-    auto error = m_rtcSender->SetParameters(fromRTCRtpParameters(parameters));
+    auto error = m_rtcSender->SetParameters(fromRTCRtpSendParameters(parameters));
     if (!error.ok()) {
         promise.reject(Exception { InvalidStateError, error.message() });
         return;
index 0b0937f..8c9ea61 100644 (file)
@@ -96,8 +96,8 @@ public:
 
 private:
     void replaceTrack(ScriptExecutionContext&, RTCRtpSender&, RefPtr<MediaStreamTrack>&&, DOMPromiseDeferred<void>&&) final;
-    RTCRtpParameters getParameters() const final;
-    void setParameters(const RTCRtpParameters&, DOMPromiseDeferred<void>&&) final;
+    RTCRtpSendParameters getParameters() const final;
+    void setParameters(const RTCRtpSendParameters&, DOMPromiseDeferred<void>&&) final;
 
     WeakPtr<LibWebRTCPeerConnectionBackend> m_peerConnectionBackend;
     rtc::scoped_refptr<webrtc::RtpSenderInterface> m_rtcSender;
index 08ce22b..9203411 100644 (file)
@@ -29,7 +29,7 @@
 
 #include "LibWebRTCMacros.h"
 #include "RTCPeerConnection.h"
-#include "RTCRtpParameters.h"
+#include "RTCRtpSendParameters.h"
 #include <wtf/text/WTFString.h>
 
 ALLOW_UNUSED_PARAMETERS_BEGIN
@@ -135,14 +135,22 @@ RTCRtpParameters toRTCRtpParameters(const webrtc::RtpParameters& rtcParameters)
 {
     RTCRtpParameters parameters;
 
-    parameters.transactionId = fromStdString(rtcParameters.transaction_id);
-    for (auto& rtcEncoding : rtcParameters.encodings)
-        parameters.encodings.append(toRTCEncodingParameters(rtcEncoding));
     for (auto& extension : rtcParameters.header_extensions)
         parameters.headerExtensions.append(toRTCHeaderExtensionParameters(extension));
     for (auto& codec : rtcParameters.codecs)
         parameters.codecs.append(toRTCCodecParameters(codec));
 
+    return parameters;
+}
+
+RTCRtpSendParameters toRTCRtpSendParameters(const webrtc::RtpParameters& rtcParameters)
+{
+    RTCRtpSendParameters parameters { toRTCRtpParameters(rtcParameters) };
+
+    parameters.transactionId = fromStdString(rtcParameters.transaction_id);
+    for (auto& rtcEncoding : rtcParameters.encodings)
+        parameters.encodings.append(toRTCEncodingParameters(rtcEncoding));
+
     switch (rtcParameters.degradation_preference) {
     // FIXME: Support DegradationPreference::DISABLED.
     case webrtc::DegradationPreference::DISABLED:
@@ -159,7 +167,7 @@ RTCRtpParameters toRTCRtpParameters(const webrtc::RtpParameters& rtcParameters)
     return parameters;
 }
 
-webrtc::RtpParameters fromRTCRtpParameters(const RTCRtpParameters& parameters)
+webrtc::RtpParameters fromRTCRtpSendParameters(const RTCRtpSendParameters& parameters)
 {
     webrtc::RtpParameters rtcParameters;
     rtcParameters.transaction_id = parameters.transactionId.utf8().data();
index c1b307c..8436747 100644 (file)
@@ -38,12 +38,15 @@ enum class RtpTransceiverDirection;
 namespace WebCore {
 
 struct RTCRtpParameters;
+struct RTCRtpSendParameters;
 struct RTCRtpTransceiverInit;
 
 enum class RTCRtpTransceiverDirection;
 
 RTCRtpParameters toRTCRtpParameters(const webrtc::RtpParameters&);
 webrtc::RtpParameters fromRTCRtpParameters(const RTCRtpParameters&);
+RTCRtpSendParameters toRTCRtpSendParameters(const webrtc::RtpParameters&);
+webrtc::RtpParameters fromRTCRtpSendParameters(const RTCRtpSendParameters&);
 
 RTCRtpTransceiverDirection toRTCRtpTransceiverDirection(webrtc::RtpTransceiverDirection);
 webrtc::RtpTransceiverDirection fromRTCRtpTransceiverDirection(RTCRtpTransceiverDirection);
index c3a44bf..789006d 100644 (file)
@@ -2884,6 +2884,7 @@ JSRTCRtpHeaderExtensionParameters.cpp
 JSRTCRtpParameters.cpp
 JSRTCRtpRtxParameters.cpp
 JSRTCRtpReceiver.cpp
+JSRTCRtpSendParameters.cpp
 JSRTCRtpSender.cpp
 JSRTCRtpTransceiver.cpp
 JSRTCRtpTransceiverDirection.cpp
index 27a7157..6547d0a 100644 (file)
                4147E2B41C89912600A7E715 /* FetchLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FetchLoader.cpp; sourceTree = "<group>"; };
                4147E2B51C89912600A7E715 /* FetchLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FetchLoader.h; sourceTree = "<group>"; };
                4147E2B61C89912600A7E715 /* FetchLoaderClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FetchLoaderClient.h; sourceTree = "<group>"; };
+               414AD3FC2149842000521676 /* RTCRtpSendParameters.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RTCRtpSendParameters.h; sourceTree = "<group>"; };
+               414AD3FE2149842000521676 /* RTCRtpSendParameters.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = RTCRtpSendParameters.idl; sourceTree = "<group>"; };
+               414AD3FF21498D3000521676 /* RTCRtpCodingParameters.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RTCRtpCodingParameters.h; sourceTree = "<group>"; };
+               414AD40021498D3100521676 /* RTCRtpDecodingParameters.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RTCRtpDecodingParameters.h; sourceTree = "<group>"; };
+               414AD40121498D3100521676 /* RTCRtpDecodingParameters.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = RTCRtpDecodingParameters.idl; sourceTree = "<group>"; };
+               414AD40221498D3200521676 /* RTCRtpCodingParameters.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = RTCRtpCodingParameters.idl; sourceTree = "<group>"; };
                414B82021D6DF0D90077EBE3 /* StructuredClone.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StructuredClone.cpp; sourceTree = "<group>"; };
                414B82031D6DF0D90077EBE3 /* StructuredClone.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StructuredClone.h; sourceTree = "<group>"; };
                414DEDE51F9FE9150047C40D /* EmptyFrameLoaderClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EmptyFrameLoaderClient.h; sourceTree = "<group>"; };
                                41E593FD214865A900D3CB61 /* RTCPriorityType.idl */,
                                41FCB75F214866FF0038ADC6 /* RTCRtpCodecParameters.h */,
                                41FCB759214865D30038ADC6 /* RTCRtpCodecParameters.idl */,
+                               414AD3FF21498D3000521676 /* RTCRtpCodingParameters.h */,
+                               414AD40221498D3200521676 /* RTCRtpCodingParameters.idl */,
+                               414AD40021498D3100521676 /* RTCRtpDecodingParameters.h */,
+                               414AD40121498D3100521676 /* RTCRtpDecodingParameters.idl */,
                                41FCB761214867000038ADC6 /* RTCRtpEncodingParameters.h */,
                                41E593FF214865AA00D3CB61 /* RTCRtpEncodingParameters.idl */,
                                41FCB75B214866FD0038ADC6 /* RTCRtpFecParameters.h */,
                                5E2C435A1BCEE30D0001E2BC /* RTCRtpSender.h */,
                                5E2C435B1BCEE30D0001E2BC /* RTCRtpSender.idl */,
                                41D1A046213EDDEB0063FB6B /* RTCRtpSenderBackend.h */,
+                               414AD3FC2149842000521676 /* RTCRtpSendParameters.h */,
+                               414AD3FE2149842000521676 /* RTCRtpSendParameters.idl */,
                                5E5E2B101CFC3E4B000C0D85 /* RTCRtpTransceiver.cpp */,
                                5E5E2B111CFC3E4B000C0D85 /* RTCRtpTransceiver.h */,
                                5E5E2B121CFC3E4B000C0D85 /* RTCRtpTransceiver.idl */,