Title: [272276] branches/safari-611-branch
Revision
272276
Author
[email protected]
Date
2021-02-02 17:41:06 -0800 (Tue, 02 Feb 2021)

Log Message

Cherry-pick r271797. rdar://problem/73847580

    Activate simulcast through addTransceiver
    https://bugs.webkit.org/show_bug.cgi?id=173262
    <rdar://problem/32713416>

    Reviewed by Eric Carlson.

    LayoutTests/imported/w3c:

    * web-platform-tests/webrtc/RTCPeerConnection-addTransceiver.https-expected.txt:
    * web-platform-tests/webrtc/RTCPeerConnection-transceivers.https-expected.txt:
    * web-platform-tests/webrtc/protocol/simulcast-offer-expected.txt:

    Source/WebCore:

    Update WebIDL according latest version of the spec.
    Add binding code to go from WebIDL to webrtc backend for sendEncodings parameters.
    Minor refactoring to bring to web pages information on addTransceiver failures.

    Covered by rebased tests.

    * Modules/mediastream/RTCPeerConnection.h:
    * Modules/mediastream/RTCPeerConnection.idl:
    * Modules/mediastream/RTCRtpEncodingParameters.idl:
    * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
    (WebCore::LibWebRTCMediaEndpoint::OnStatsDelivered):
    (WebCore::LibWebRTCMediaEndpoint::createTransceiverBackends):
    (WebCore::LibWebRTCMediaEndpoint::addTransceiver):
    * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
    * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
    (WebCore::LibWebRTCPeerConnectionBackend::addTransceiverFromTrackOrKind):
    * Modules/mediastream/libwebrtc/LibWebRTCUtils.cpp:
    (WebCore::fromRTCEncodingParameters):
    (WebCore::fromRtpTransceiverInit):

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

Modified Paths

Diff

Modified: branches/safari-611-branch/LayoutTests/imported/w3c/ChangeLog (272275 => 272276)


--- branches/safari-611-branch/LayoutTests/imported/w3c/ChangeLog	2021-02-03 01:41:00 UTC (rev 272275)
+++ branches/safari-611-branch/LayoutTests/imported/w3c/ChangeLog	2021-02-03 01:41:06 UTC (rev 272276)
@@ -1,3 +1,56 @@
+2021-02-02  Alan Coon  <[email protected]>
+
+        Cherry-pick r271797. rdar://problem/73847580
+
+    Activate simulcast through addTransceiver
+    https://bugs.webkit.org/show_bug.cgi?id=173262
+    <rdar://problem/32713416>
+    
+    Reviewed by Eric Carlson.
+    
+    LayoutTests/imported/w3c:
+    
+    * web-platform-tests/webrtc/RTCPeerConnection-addTransceiver.https-expected.txt:
+    * web-platform-tests/webrtc/RTCPeerConnection-transceivers.https-expected.txt:
+    * web-platform-tests/webrtc/protocol/simulcast-offer-expected.txt:
+    
+    Source/WebCore:
+    
+    Update WebIDL according latest version of the spec.
+    Add binding code to go from WebIDL to webrtc backend for sendEncodings parameters.
+    Minor refactoring to bring to web pages information on addTransceiver failures.
+    
+    Covered by rebased tests.
+    
+    * Modules/mediastream/RTCPeerConnection.h:
+    * Modules/mediastream/RTCPeerConnection.idl:
+    * Modules/mediastream/RTCRtpEncodingParameters.idl:
+    * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
+    (WebCore::LibWebRTCMediaEndpoint::OnStatsDelivered):
+    (WebCore::LibWebRTCMediaEndpoint::createTransceiverBackends):
+    (WebCore::LibWebRTCMediaEndpoint::addTransceiver):
+    * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
+    * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
+    (WebCore::LibWebRTCPeerConnectionBackend::addTransceiverFromTrackOrKind):
+    * Modules/mediastream/libwebrtc/LibWebRTCUtils.cpp:
+    (WebCore::fromRTCEncodingParameters):
+    (WebCore::fromRtpTransceiverInit):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271797 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-01-25  Youenn Fablet  <[email protected]>
+
+            Activate simulcast through addTransceiver
+            https://bugs.webkit.org/show_bug.cgi?id=173262
+            <rdar://problem/32713416>
+
+            Reviewed by Eric Carlson.
+
+            * web-platform-tests/webrtc/RTCPeerConnection-addTransceiver.https-expected.txt:
+            * web-platform-tests/webrtc/RTCPeerConnection-transceivers.https-expected.txt:
+            * web-platform-tests/webrtc/protocol/simulcast-offer-expected.txt:
+
 2021-02-01  Alan Coon  <[email protected]>
 
         Cherry-pick r271611. rdar://problem/73838923

Modified: branches/safari-611-branch/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-addTransceiver.https-expected.txt (272275 => 272276)


--- branches/safari-611-branch/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-addTransceiver.https-expected.txt	2021-02-03 01:41:00 UTC (rev 272275)
+++ branches/safari-611-branch/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-addTransceiver.https-expected.txt	2021-02-03 01:41:06 UTC (rev 272276)
@@ -12,13 +12,17 @@
         sendEncodings: [{
           rid: '@Invalid!'
         }]
-      })" did not throw
+      })" threw object "InvalidAccessError: Invalid RID value provided." ("InvalidAccessError") expected instance of function "function TypeError() {
+    [native code]
+}" ("TypeError")
 FAIL addTransceiver() with rid longer than 16 characters should throw TypeError assert_throws_js: function "() =>
       pc.addTransceiver('audio', {
         sendEncodings: [{
           rid: 'a'.repeat(17)
         }]
-      })" did not throw
+      })" threw object "InvalidAccessError: Invalid RID value provided." ("InvalidAccessError") expected instance of function "function TypeError() {
+    [native code]
+}" ("TypeError")
 PASS addTransceiver() with valid rid value should succeed
 PASS addTransceiver() with valid sendEncodings should succeed
 

Modified: branches/safari-611-branch/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-perfect-negotiation.https-expected.txt (272275 => 272276)


--- branches/safari-611-branch/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-perfect-negotiation.https-expected.txt	2021-02-03 01:41:00 UTC (rev 272275)
+++ branches/safari-611-branch/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-perfect-negotiation.https-expected.txt	2021-02-03 01:41:06 UTC (rev 272276)
@@ -1,6 +1,6 @@
 
 PASS Perfect negotiation setup connects
 PASS Perfect negotiation setup connects with roles reversed
-FAIL Perfect negotiation glare Description type incompatible with current signaling state
-FAIL Perfect negotiation glare with roles reversed assert_unreached: Error in iframe: InvalidStateError: Description type incompatible with current signaling state Reached unreachable code
+FAIL Perfect negotiation glare Remote description type 0 is incompatible with current signaling state 1
+FAIL Perfect negotiation glare with roles reversed assert_unreached: Error in iframe: InvalidStateError: Remote description type 0 is incompatible with current signaling state 1 Reached unreachable code
 

Modified: branches/safari-611-branch/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-transceivers.https-expected.txt (272275 => 272276)


--- branches/safari-611-branch/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-transceivers.https-expected.txt	2021-02-03 01:41:00 UTC (rev 272275)
+++ branches/safari-611-branch/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-transceivers.https-expected.txt	2021-02-03 01:41:06 UTC (rev 272276)
@@ -23,7 +23,7 @@
 PASS addTransceiver(track): creates a transceiver for the track
 PASS addTransceiver(track): "transceiver == {sender,receiver}"
 PASS addTransceiver(track, init): initialize direction to inactive
-FAIL addTransceiver(track, init): initialize sendEncodings[0].active to false assert_false: expected false got true
+PASS addTransceiver(track, init): initialize sendEncodings[0].active to false
 PASS addTransceiver(0 streams): ontrack fires with no stream
 PASS addTransceiver(1 stream): ontrack fires with corresponding stream
 PASS addTransceiver(2 streams): ontrack fires with corresponding two streams

Modified: branches/safari-611-branch/LayoutTests/imported/w3c/web-platform-tests/webrtc/protocol/simulcast-offer-expected.txt (272275 => 272276)


--- branches/safari-611-branch/LayoutTests/imported/w3c/web-platform-tests/webrtc/protocol/simulcast-offer-expected.txt	2021-02-03 01:41:00 UTC (rev 272275)
+++ branches/safari-611-branch/LayoutTests/imported/w3c/web-platform-tests/webrtc/protocol/simulcast-offer-expected.txt	2021-02-03 01:41:06 UTC (rev 272276)
@@ -1,3 +1,3 @@
 
-FAIL createOffer() with multiple send encodings should create simulcast offer assert_not_equals: RID attribute for 'foo' missing. got disallowed value undefined
+PASS createOffer() with multiple send encodings should create simulcast offer
 

Modified: branches/safari-611-branch/Source/WebCore/ChangeLog (272275 => 272276)


--- branches/safari-611-branch/Source/WebCore/ChangeLog	2021-02-03 01:41:00 UTC (rev 272275)
+++ branches/safari-611-branch/Source/WebCore/ChangeLog	2021-02-03 01:41:06 UTC (rev 272276)
@@ -1,5 +1,75 @@
 2021-02-02  Alan Coon  <[email protected]>
 
+        Cherry-pick r271797. rdar://problem/73847580
+
+    Activate simulcast through addTransceiver
+    https://bugs.webkit.org/show_bug.cgi?id=173262
+    <rdar://problem/32713416>
+    
+    Reviewed by Eric Carlson.
+    
+    LayoutTests/imported/w3c:
+    
+    * web-platform-tests/webrtc/RTCPeerConnection-addTransceiver.https-expected.txt:
+    * web-platform-tests/webrtc/RTCPeerConnection-transceivers.https-expected.txt:
+    * web-platform-tests/webrtc/protocol/simulcast-offer-expected.txt:
+    
+    Source/WebCore:
+    
+    Update WebIDL according latest version of the spec.
+    Add binding code to go from WebIDL to webrtc backend for sendEncodings parameters.
+    Minor refactoring to bring to web pages information on addTransceiver failures.
+    
+    Covered by rebased tests.
+    
+    * Modules/mediastream/RTCPeerConnection.h:
+    * Modules/mediastream/RTCPeerConnection.idl:
+    * Modules/mediastream/RTCRtpEncodingParameters.idl:
+    * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
+    (WebCore::LibWebRTCMediaEndpoint::OnStatsDelivered):
+    (WebCore::LibWebRTCMediaEndpoint::createTransceiverBackends):
+    (WebCore::LibWebRTCMediaEndpoint::addTransceiver):
+    * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
+    * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
+    (WebCore::LibWebRTCPeerConnectionBackend::addTransceiverFromTrackOrKind):
+    * Modules/mediastream/libwebrtc/LibWebRTCUtils.cpp:
+    (WebCore::fromRTCEncodingParameters):
+    (WebCore::fromRtpTransceiverInit):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271797 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-01-25  Youenn Fablet  <[email protected]>
+
+            Activate simulcast through addTransceiver
+            https://bugs.webkit.org/show_bug.cgi?id=173262
+            <rdar://problem/32713416>
+
+            Reviewed by Eric Carlson.
+
+            Update WebIDL according latest version of the spec.
+            Add binding code to go from WebIDL to webrtc backend for sendEncodings parameters.
+            Minor refactoring to bring to web pages information on addTransceiver failures.
+
+            Covered by rebased tests.
+
+
+            * Modules/mediastream/RTCPeerConnection.h:
+            * Modules/mediastream/RTCPeerConnection.idl:
+            * Modules/mediastream/RTCRtpEncodingParameters.idl:
+            * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
+            (WebCore::LibWebRTCMediaEndpoint::OnStatsDelivered):
+            (WebCore::LibWebRTCMediaEndpoint::createTransceiverBackends):
+            (WebCore::LibWebRTCMediaEndpoint::addTransceiver):
+            * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
+            * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
+            (WebCore::LibWebRTCPeerConnectionBackend::addTransceiverFromTrackOrKind):
+            * Modules/mediastream/libwebrtc/LibWebRTCUtils.cpp:
+            (WebCore::fromRTCEncodingParameters):
+            (WebCore::fromRtpTransceiverInit):
+
+2021-02-02  Alan Coon  <[email protected]>
+
         Cherry-pick r271796. rdar://problem/73847788
 
     AX: @alt and bounds ignored when using img[src] points to an inaccessible SVG

Modified: branches/safari-611-branch/Source/WebCore/Modules/mediastream/RTCPeerConnection.h (272275 => 272276)


--- branches/safari-611-branch/Source/WebCore/Modules/mediastream/RTCPeerConnection.h	2021-02-03 01:41:00 UTC (rev 272275)
+++ branches/safari-611-branch/Source/WebCore/Modules/mediastream/RTCPeerConnection.h	2021-02-03 01:41:06 UTC (rev 272276)
@@ -45,6 +45,7 @@
 #include "RTCIceConnectionState.h"
 #include "RTCIceGatheringState.h"
 #include "RTCPeerConnectionState.h"
+#include "RTCRtpEncodingParameters.h"
 #include "RTCRtpTransceiver.h"
 #include "RTCSignalingState.h"
 #include <_javascript_Core/Uint8Array.h>
@@ -71,6 +72,7 @@
 struct RTCRtpTransceiverInit {
     RTCRtpTransceiverDirection direction { RTCRtpTransceiverDirection::Sendrecv };
     Vector<RefPtr<MediaStream>> streams;
+    Vector<RTCRtpEncodingParameters> sendEncodings;
 };
 
 class RTCPeerConnection final

Modified: branches/safari-611-branch/Source/WebCore/Modules/mediastream/RTCPeerConnection.idl (272275 => 272276)


--- branches/safari-611-branch/Source/WebCore/Modules/mediastream/RTCPeerConnection.idl	2021-02-03 01:41:00 UTC (rev 272275)
+++ branches/safari-611-branch/Source/WebCore/Modules/mediastream/RTCPeerConnection.idl	2021-02-03 01:41:06 UTC (rev 272276)
@@ -67,7 +67,7 @@
 ] dictionary RTCRtpTransceiverInit {
     RtpTransceiverDirection direction = "sendrecv";
     sequence<MediaStream> streams = [];
-    // FIXME 169662: missing sendEncodings
+    sequence<RTCRtpEncodingParameters> sendEncodings = [];
 };
 
 [

Modified: branches/safari-611-branch/Source/WebCore/Modules/mediastream/RTCRtpEncodingParameters.idl (272275 => 272276)


--- branches/safari-611-branch/Source/WebCore/Modules/mediastream/RTCRtpEncodingParameters.idl	2021-02-03 01:41:00 UTC (rev 272275)
+++ branches/safari-611-branch/Source/WebCore/Modules/mediastream/RTCRtpEncodingParameters.idl	2021-02-03 01:41:06 UTC (rev 272276)
@@ -32,7 +32,7 @@
     RTCRtpRtxParameters rtx;
     RTCRtpFecParameters fec;
     RTCDtxStatus dtx;
-    boolean active;
+    boolean active = true;
     RTCPriorityType priority;
     unsigned long maxBitrate;
     unsigned long maxFramerate;

Modified: branches/safari-611-branch/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp (272275 => 272276)


--- branches/safari-611-branch/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp	2021-02-03 01:41:00 UTC (rev 272275)
+++ branches/safari-611-branch/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp	2021-02-03 01:41:06 UTC (rev 272276)
@@ -430,17 +430,17 @@
 }
 
 template<typename T>
-Optional<LibWebRTCMediaEndpoint::Backends> LibWebRTCMediaEndpoint::createTransceiverBackends(T&& trackOrKind, const RTCRtpTransceiverInit& init, LibWebRTCRtpSenderBackend::Source&& source)
+ExceptionOr<LibWebRTCMediaEndpoint::Backends> LibWebRTCMediaEndpoint::createTransceiverBackends(T&& trackOrKind, const RTCRtpTransceiverInit& init, LibWebRTCRtpSenderBackend::Source&& source)
 {
     auto result = m_backend->AddTransceiver(WTFMove(trackOrKind), fromRtpTransceiverInit(init));
     if (!result.ok())
-        return WTF::nullopt;
+        return toException(result.error());
 
     auto transceiver = makeUnique<LibWebRTCRtpTransceiverBackend>(result.MoveValue());
     return LibWebRTCMediaEndpoint::Backends { transceiver->createSenderBackend(m_peerConnectionBackend, WTFMove(source)), transceiver->createReceiverBackend(), WTFMove(transceiver) };
 }
 
-Optional<LibWebRTCMediaEndpoint::Backends> LibWebRTCMediaEndpoint::addTransceiver(const String& trackKind, const RTCRtpTransceiverInit& init)
+ExceptionOr<LibWebRTCMediaEndpoint::Backends> LibWebRTCMediaEndpoint::addTransceiver(const String& trackKind, const RTCRtpTransceiverInit& init)
 {
     auto type = trackKind == "audio" ? cricket::MediaType::MEDIA_TYPE_AUDIO : cricket::MediaType::MEDIA_TYPE_VIDEO;
     return createTransceiverBackends(type, init, nullptr);
@@ -470,7 +470,7 @@
     return std::make_pair(WTFMove(source), WTFMove(rtcTrack));
 }
 
-Optional<LibWebRTCMediaEndpoint::Backends> LibWebRTCMediaEndpoint::addTransceiver(MediaStreamTrack& track, const RTCRtpTransceiverInit& init)
+ExceptionOr<LibWebRTCMediaEndpoint::Backends> LibWebRTCMediaEndpoint::addTransceiver(MediaStreamTrack& track, const RTCRtpTransceiverInit& init)
 {
     auto sourceAndTrack = createSourceAndRTCTrack(track);
     return createTransceiverBackends(WTFMove(sourceAndTrack.second), init, WTFMove(sourceAndTrack.first));

Modified: branches/safari-611-branch/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h (272275 => 272276)


--- branches/safari-611-branch/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h	2021-02-03 01:41:00 UTC (rev 272275)
+++ branches/safari-611-branch/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h	2021-02-03 01:41:06 UTC (rev 272276)
@@ -110,8 +110,8 @@
         std::unique_ptr<LibWebRTCRtpReceiverBackend> receiverBackend;
         std::unique_ptr<LibWebRTCRtpTransceiverBackend> transceiverBackend;
     };
-    Optional<Backends> addTransceiver(const String& trackKind, const RTCRtpTransceiverInit&);
-    Optional<Backends> addTransceiver(MediaStreamTrack&, const RTCRtpTransceiverInit&);
+    ExceptionOr<Backends> addTransceiver(const String& trackKind, const RTCRtpTransceiverInit&);
+    ExceptionOr<Backends> addTransceiver(MediaStreamTrack&, const RTCRtpTransceiverInit&);
     std::unique_ptr<LibWebRTCRtpTransceiverBackend> transceiverBackendFromSender(LibWebRTCRtpSenderBackend&);
 
     void setSenderSourceFromTrack(LibWebRTCRtpSenderBackend&, MediaStreamTrack&);
@@ -147,7 +147,7 @@
     void addPendingTrackEvent(Ref<RTCRtpReceiver>&&, MediaStreamTrack&, const std::vector<rtc::scoped_refptr<webrtc::MediaStreamInterface>>&, RefPtr<RTCRtpTransceiver>&&);
 
     template<typename T>
-    Optional<Backends> createTransceiverBackends(T&&, const RTCRtpTransceiverInit&, LibWebRTCRtpSenderBackend::Source&&);
+    ExceptionOr<Backends> createTransceiverBackends(T&&, const RTCRtpTransceiverInit&, LibWebRTCRtpSenderBackend::Source&&);
 
     void OnStatsDelivered(const rtc::scoped_refptr<const webrtc::RTCStatsReport>&) final;
     void gatherStatsForLogging();

Modified: branches/safari-611-branch/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp (272275 => 272276)


--- branches/safari-611-branch/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp	2021-02-03 01:41:00 UTC (rev 272275)
+++ branches/safari-611-branch/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp	2021-02-03 01:41:06 UTC (rev 272276)
@@ -387,13 +387,14 @@
 template<typename T>
 ExceptionOr<Ref<RTCRtpTransceiver>> LibWebRTCPeerConnectionBackend::addTransceiverFromTrackOrKind(T&& trackOrKind, const RTCRtpTransceiverInit& init)
 {
-    auto backends = m_endpoint->addTransceiver(trackOrKind, init);
-    if (!backends)
-        return Exception { InvalidAccessError, "Unable to add transceiver"_s };
+    auto result = m_endpoint->addTransceiver(trackOrKind, init);
+    if (result.hasException())
+        return result.releaseException();
 
-    auto sender = RTCRtpSender::create(m_peerConnection, WTFMove(trackOrKind), WTFMove(backends->senderBackend));
-    auto receiver = createReceiver(WTFMove(backends->receiverBackend));
-    auto transceiver = RTCRtpTransceiver::create(WTFMove(sender), WTFMove(receiver), WTFMove(backends->transceiverBackend));
+    auto backends = result.releaseReturnValue();
+    auto sender = RTCRtpSender::create(m_peerConnection, WTFMove(trackOrKind), WTFMove(backends.senderBackend));
+    auto receiver = createReceiver(WTFMove(backends.receiverBackend));
+    auto transceiver = RTCRtpTransceiver::create(WTFMove(sender), WTFMove(receiver), WTFMove(backends.transceiverBackend));
     m_peerConnection.addInternalTransceiver(transceiver.copyRef());
     return transceiver;
 }

Modified: branches/safari-611-branch/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCUtils.cpp (272275 => 272276)


--- branches/safari-611-branch/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCUtils.cpp	2021-02-03 01:41:00 UTC (rev 272275)
+++ branches/safari-611-branch/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCUtils.cpp	2021-02-03 01:41:06 UTC (rev 272276)
@@ -64,6 +64,25 @@
     return parameters;
 }
 
+static inline webrtc::RtpEncodingParameters fromRTCEncodingParameters(const RTCRtpEncodingParameters& parameters)
+{
+    webrtc::RtpEncodingParameters rtcParameters;
+
+    if (parameters.ssrc)
+        rtcParameters.ssrc = parameters.ssrc;
+
+    rtcParameters.active = parameters.active;
+    if (parameters.maxBitrate)
+        rtcParameters.max_bitrate_bps = parameters.maxBitrate;
+    if (parameters.maxFramerate)
+        rtcParameters.max_framerate = parameters.maxFramerate;
+    rtcParameters.rid = parameters.rid.utf8().data();
+    if (parameters.scaleResolutionDownBy)
+        rtcParameters.scale_resolution_down_by = parameters.scaleResolutionDownBy;
+
+    return rtcParameters;
+}
+
 static inline RTCRtpHeaderExtensionParameters toRTCHeaderExtensionParameters(const webrtc::RtpExtension& rtcParameters)
 {
     RTCRtpHeaderExtensionParameters parameters;
@@ -227,6 +246,8 @@
     rtcInit.direction = fromRTCRtpTransceiverDirection(init.direction);
     for (auto& stream : init.streams)
         rtcInit.stream_ids.push_back(stream->id().utf8().data());
+    for (auto& encoding : init.sendEncodings)
+        rtcInit.send_encodings.push_back(fromRTCEncodingParameters(encoding));
     return rtcInit;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to