Make LibWebRTCRtpSenderBackend own its libwebrtc RTP sender backend
authoryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Sep 2018 00:04:01 +0000 (00:04 +0000)
committeryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Sep 2018 00:04:01 +0000 (00:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=189270

Reviewed by Eric Carlson.

Previously, the libwebrtc senders were owned in LibWebRTCMediaEndpoint.
This patch makes them be owned by LibWebRTCRtpSenderBackend.
This simplifies the implementation of RTCRtpSender::getParameters.
This will help simplify the implementation of RTCRtpSender::replaceTrack.

removeTrack is also refactored so that LibWebRTCMediaEndpoint directly uses libwebrtc constructs and not WebCore libwebrtc-agnostic ones.

No change of behavior.

* Modules/mediastream/PeerConnectionBackend.h:
(WebCore::PeerConnectionBackend::removeTrack):
(WebCore::PeerConnectionBackend::notifyRemovedTrack): Deleted.
* Modules/mediastream/RTCPeerConnection.cpp:
(WebCore::RTCPeerConnection::removeTrack):
* Modules/mediastream/RTCRtpSender.cpp:
(WebCore::RTCRtpSender::getParameters):
* Modules/mediastream/RTCRtpSender.h:
(WebCore::RTCRtpSender::backend):
* Modules/mediastream/RTCRtpSenderBackend.h:
* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
(WebCore::LibWebRTCMediaEndpoint::addTrack):
(WebCore::LibWebRTCMediaEndpoint::removeTrack):
(WebCore::LibWebRTCMediaEndpoint::doCreateOffer):
(WebCore::LibWebRTCMediaEndpoint::stop):
(WebCore::LibWebRTCMediaEndpoint::shouldOfferAllowToReceiveAudio const): Deleted.
(WebCore::LibWebRTCMediaEndpoint::shouldOfferAllowToReceiveVideo const): Deleted.
(WebCore::LibWebRTCMediaEndpoint::getRTCRtpSenderParameters): Deleted.
* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
* Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
(WebCore::backendFromRTPSender):
(WebCore::LibWebRTCPeerConnectionBackend::addTrack):
(WebCore::LibWebRTCPeerConnectionBackend::addTransceiver):
(WebCore::LibWebRTCPeerConnectionBackend::removeTrack):
(WebCore::LibWebRTCPeerConnectionBackend::shouldOfferAllowToReceive const):
(WebCore::LibWebRTCPeerConnectionBackend::notifyRemovedTrack): Deleted.
(WebCore::LibWebRTCPeerConnectionBackend::getParameters const): Deleted.
* Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
* Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp:
(WebCore::LibWebRTCRtpSenderBackend::getParameters const):
* Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h:

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

12 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediastream/PeerConnectionBackend.h
Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp
Source/WebCore/Modules/mediastream/RTCRtpSender.cpp
Source/WebCore/Modules/mediastream/RTCRtpSender.h
Source/WebCore/Modules/mediastream/RTCRtpSenderBackend.h
Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp
Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h
Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp
Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h
Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp
Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h

index 41f8966..f0368cc 100644 (file)
@@ -1,3 +1,51 @@
+2018-09-04  Youenn Fablet  <youenn@apple.com>
+
+        Make LibWebRTCRtpSenderBackend own its libwebrtc RTP sender backend
+        https://bugs.webkit.org/show_bug.cgi?id=189270
+
+        Reviewed by Eric Carlson.
+
+        Previously, the libwebrtc senders were owned in LibWebRTCMediaEndpoint.
+        This patch makes them be owned by LibWebRTCRtpSenderBackend.
+        This simplifies the implementation of RTCRtpSender::getParameters.
+        This will help simplify the implementation of RTCRtpSender::replaceTrack.
+
+        removeTrack is also refactored so that LibWebRTCMediaEndpoint directly uses libwebrtc constructs and not WebCore libwebrtc-agnostic ones.
+
+        No change of behavior.
+
+        * Modules/mediastream/PeerConnectionBackend.h:
+        (WebCore::PeerConnectionBackend::removeTrack):
+        (WebCore::PeerConnectionBackend::notifyRemovedTrack): Deleted.
+        * Modules/mediastream/RTCPeerConnection.cpp:
+        (WebCore::RTCPeerConnection::removeTrack):
+        * Modules/mediastream/RTCRtpSender.cpp:
+        (WebCore::RTCRtpSender::getParameters):
+        * Modules/mediastream/RTCRtpSender.h:
+        (WebCore::RTCRtpSender::backend):
+        * Modules/mediastream/RTCRtpSenderBackend.h:
+        * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
+        (WebCore::LibWebRTCMediaEndpoint::addTrack):
+        (WebCore::LibWebRTCMediaEndpoint::removeTrack):
+        (WebCore::LibWebRTCMediaEndpoint::doCreateOffer):
+        (WebCore::LibWebRTCMediaEndpoint::stop):
+        (WebCore::LibWebRTCMediaEndpoint::shouldOfferAllowToReceiveAudio const): Deleted.
+        (WebCore::LibWebRTCMediaEndpoint::shouldOfferAllowToReceiveVideo const): Deleted.
+        (WebCore::LibWebRTCMediaEndpoint::getRTCRtpSenderParameters): Deleted.
+        * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
+        * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
+        (WebCore::backendFromRTPSender):
+        (WebCore::LibWebRTCPeerConnectionBackend::addTrack):
+        (WebCore::LibWebRTCPeerConnectionBackend::addTransceiver):
+        (WebCore::LibWebRTCPeerConnectionBackend::removeTrack):
+        (WebCore::LibWebRTCPeerConnectionBackend::shouldOfferAllowToReceive const):
+        (WebCore::LibWebRTCPeerConnectionBackend::notifyRemovedTrack): Deleted.
+        (WebCore::LibWebRTCPeerConnectionBackend::getParameters const): Deleted.
+        * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
+        * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp:
+        (WebCore::LibWebRTCRtpSenderBackend::getParameters const):
+        * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h:
+
 2018-09-04  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         Populate "text/uri-list" with multiple URLs when the pasteboard contains multiple URLs
index 95e0f99..6292de8 100644 (file)
@@ -102,7 +102,7 @@ public:
 
     virtual Ref<RTCRtpReceiver> createReceiver(const String& transceiverMid, const String& trackKind, const String& trackId) = 0;
     virtual ExceptionOr<Ref<RTCRtpSender>> addTrack(RTCRtpSender*, MediaStreamTrack&, const Vector<String>&);
-    virtual void notifyRemovedTrack(RTCRtpSender&) { }
+    virtual void removeTrack(RTCRtpSender&) { }
 
     virtual ExceptionOr<Ref<RTCRtpTransceiver>> addTransceiver(const String&, const RTCRtpTransceiverInit&);
     virtual ExceptionOr<Ref<RTCRtpTransceiver>> addTransceiver(Ref<MediaStreamTrack>&&, const RTCRtpTransceiverInit&);
index 31e69e2..2a5a13e 100644 (file)
@@ -157,9 +157,8 @@ ExceptionOr<void> RTCPeerConnection::removeTrack(RTCRtpSender& sender)
     if (shouldAbort)
         return { };
 
+    m_backend->removeTrack(sender);
     sender.stop();
-
-    m_backend->notifyRemovedTrack(sender);
     return { };
 }
 
index 6a3d1bc..5acdd46 100644 (file)
@@ -96,7 +96,7 @@ RTCRtpParameters RTCRtpSender::getParameters()
 {
     if (isStopped())
         return { };
-    return m_backend->getParameters(*this);
+    return m_backend->getParameters();
 }
 
 } // namespace WebCore
index 4e1e4b5..a5d3092 100644 (file)
@@ -57,6 +57,7 @@ public:
     void replaceTrack(RefPtr<MediaStreamTrack>&&, DOMPromiseDeferred<void>&&);
 
     RTCRtpParameters getParameters();
+    RTCRtpSenderBackend* backend() { return m_backend.get(); }
 
 private:
     RTCRtpSender(String&& trackKind, Vector<String>&& mediaStreamIds, std::unique_ptr<RTCRtpSenderBackend>&&);
index 5d258a4..476543c 100644 (file)
@@ -37,7 +37,7 @@ class RTCRtpSender;
 class RTCRtpSenderBackend {
 public:
     virtual void replaceTrack(RTCRtpSender&, RefPtr<MediaStreamTrack>&&, DOMPromiseDeferred<void>&&) = 0;
-    virtual RTCRtpParameters getParameters(RTCRtpSender&) const = 0;
+    virtual RTCRtpParameters getParameters() const = 0;
     virtual ~RTCRtpSenderBackend() = default;
 };
 
index b5ebb7d..98cbee5 100644 (file)
@@ -194,9 +194,10 @@ void LibWebRTCMediaEndpoint::doSetRemoteDescription(RTCSessionDescription& descr
     startLoggingStats();
 }
 
-bool LibWebRTCMediaEndpoint::addTrack(RTCRtpSender& sender, MediaStreamTrack& track, const Vector<String>& mediaStreamIds)
+bool LibWebRTCMediaEndpoint::addTrack(LibWebRTCRtpSenderBackend& sender, MediaStreamTrack& track, const Vector<String>& mediaStreamIds)
 {
     ASSERT(m_backend);
+    ASSERT(!sender.rtcSender());
 
     if (!RuntimeEnabledFeatures::sharedFeatures().webRTCUnifiedPlanEnabled()) {
         String mediaStreamId = mediaStreamIds.isEmpty() ? createCanonicalUUIDString() : mediaStreamIds[0];
@@ -217,18 +218,20 @@ bool LibWebRTCMediaEndpoint::addTrack(RTCRtpSender& sender, MediaStreamTrack& tr
         auto audioTrack = m_peerConnectionFactory.CreateAudioTrack(track.id().utf8().data(), trackSource.ptr());
         m_peerConnectionBackend.addAudioSource(WTFMove(trackSource));
         auto rtpSender = m_backend->AddTrack(audioTrack.get(), WTFMove(ids));
-        if (rtpSender.ok())
-            m_senders.add(&sender, rtpSender.MoveValue());
-        return rtpSender.ok();
+        if (!rtpSender.ok())
+            return false;
+        sender.setRTCSender(rtpSender.MoveValue());
+        return true;
     }
     case RealtimeMediaSource::Type::Video: {
         auto videoSource = RealtimeOutgoingVideoSource::create(track.privateTrack());
         auto videoTrack = m_peerConnectionFactory.CreateVideoTrack(track.id().utf8().data(), videoSource.ptr());
         m_peerConnectionBackend.addVideoSource(WTFMove(videoSource));
         auto rtpSender = m_backend->AddTrack(videoTrack.get(), WTFMove(ids));
-        if (rtpSender.ok())
-            m_senders.add(&sender, rtpSender.MoveValue());
-        return rtpSender.ok();
+        if (!rtpSender.ok())
+            return false;
+        sender.setRTCSender(rtpSender.MoveValue());
+        return true;
     }
     case RealtimeMediaSource::Type::None:
         ASSERT_NOT_REACHED();
@@ -236,46 +239,10 @@ bool LibWebRTCMediaEndpoint::addTrack(RTCRtpSender& sender, MediaStreamTrack& tr
     return false;
 }
 
-void LibWebRTCMediaEndpoint::removeTrack(RTCRtpSender& sender)
+void LibWebRTCMediaEndpoint::removeTrack(LibWebRTCRtpSenderBackend& sender)
 {
     ASSERT(m_backend);
-
-    auto rtcSender = m_senders.get(&sender);
-    if (!rtcSender)
-        return;
-    m_backend->RemoveTrack(rtcSender.get());
-}
-
-bool LibWebRTCMediaEndpoint::shouldOfferAllowToReceiveAudio() const
-{
-    ASSERT(!RuntimeEnabledFeatures::sharedFeatures().webRTCUnifiedPlanEnabled());
-    for (const auto& transceiver : m_peerConnectionBackend.connection().getTransceivers()) {
-        if (transceiver->sender().trackKind() != "audio")
-            continue;
-
-        if (transceiver->direction() == RTCRtpTransceiverDirection::Recvonly)
-            return true;
-
-        if (transceiver->direction() == RTCRtpTransceiverDirection::Sendrecv && !m_senders.contains(&transceiver->sender()))
-            return true;
-    }
-    return false;
-}
-
-bool LibWebRTCMediaEndpoint::shouldOfferAllowToReceiveVideo() const
-{
-    ASSERT(!RuntimeEnabledFeatures::sharedFeatures().webRTCUnifiedPlanEnabled());
-    for (const auto& transceiver : m_peerConnectionBackend.connection().getTransceivers()) {
-        if (transceiver->sender().trackKind() != "video")
-            continue;
-
-        if (transceiver->direction() == RTCRtpTransceiverDirection::Recvonly)
-            return true;
-
-        if (transceiver->direction() == RTCRtpTransceiverDirection::Sendrecv && !m_senders.contains(&transceiver->sender()))
-            return true;
-    }
-    return false;
+    m_backend->RemoveTrack(sender.rtcSender());
 }
 
 void LibWebRTCMediaEndpoint::doCreateOffer(const RTCOfferOptions& options)
@@ -288,9 +255,9 @@ void LibWebRTCMediaEndpoint::doCreateOffer(const RTCOfferOptions& options)
     rtcOptions.voice_activity_detection = options.voiceActivityDetection;
 
     if (!RuntimeEnabledFeatures::sharedFeatures().webRTCUnifiedPlanEnabled()) {
-        if (shouldOfferAllowToReceiveAudio())
+        if (m_peerConnectionBackend.shouldOfferAllowToReceive("audio"_s))
             rtcOptions.offer_to_receive_audio = webrtc::PeerConnectionInterface::RTCOfferAnswerOptions::kOfferToReceiveMediaTrue;
-        if (shouldOfferAllowToReceiveVideo())
+        if (m_peerConnectionBackend.shouldOfferAllowToReceive("video"_s))
             rtcOptions.offer_to_receive_video = webrtc::PeerConnectionInterface::RTCOfferAnswerOptions::kOfferToReceiveMediaTrue;
     }
     m_backend->CreateOffer(&m_createSessionDescriptionObserver, rtcOptions);
@@ -470,7 +437,6 @@ void LibWebRTCMediaEndpoint::stop()
     m_backend->Close();
     m_backend = nullptr;
     m_streams.clear();
-    m_senders.clear();
 }
 
 void LibWebRTCMediaEndpoint::OnRenegotiationNeeded()
@@ -614,14 +580,6 @@ void LibWebRTCMediaEndpoint::setRemoteSessionDescriptionFailed(const std::string
     });
 }
 
-RTCRtpParameters LibWebRTCMediaEndpoint::getRTCRtpSenderParameters(RTCRtpSender& sender)
-{
-    auto rtcSender = m_senders.get(&sender);
-    if (!rtcSender)
-        return { };
-    return fillRtpParameters(rtcSender->GetParameters());
-}
-
 void LibWebRTCMediaEndpoint::gatherStatsForLogging()
 {
     LibWebRTCProvider::callOnWebRTCSignalingThread([protectedThis = makeRef(*this)] {
index b717495..f2ba6bc 100644 (file)
@@ -61,6 +61,7 @@ namespace WebCore {
 
 class LibWebRTCProvider;
 class LibWebRTCPeerConnectionBackend;
+class LibWebRTCRtpSenderBackend;
 class MediaStreamTrack;
 class RTCSessionDescription;
 
@@ -97,9 +98,8 @@ public:
     RefPtr<RTCSessionDescription> pendingLocalDescription() const;
     RefPtr<RTCSessionDescription> pendingRemoteDescription() const;
 
-    bool addTrack(RTCRtpSender&, MediaStreamTrack&, const Vector<String>&);
-    void removeTrack(RTCRtpSender&);
-    RTCRtpParameters getRTCRtpSenderParameters(RTCRtpSender&);
+    bool addTrack(LibWebRTCRtpSenderBackend&, MediaStreamTrack&, const Vector<String>&);
+    void removeTrack(LibWebRTCRtpSenderBackend&);
 
 private:
     LibWebRTCMediaEndpoint(LibWebRTCPeerConnectionBackend&, LibWebRTCProvider&);
@@ -142,9 +142,6 @@ private:
         : rtc::RefCountReleaseStatus::kDroppedLastRef;
     }
 
-    bool shouldOfferAllowToReceiveAudio() const;
-    bool shouldOfferAllowToReceiveVideo() const;
-
 #if !RELEASE_LOG_DISABLED
     const Logger& logger() const final { return m_logger.get(); }
     const void* logIdentifier() const final { return m_logIdentifier; }
@@ -167,7 +164,6 @@ private:
     SetRemoteSessionDescriptionObserver<LibWebRTCMediaEndpoint> m_setRemoteSessionDescriptionObserver;
 
     HashMap<webrtc::MediaStreamInterface*, RefPtr<MediaStream>> m_streams;
-    HashMap<RTCRtpSender*, rtc::scoped_refptr<webrtc::RtpSenderInterface>> m_senders;
 
     bool m_isInitiator { false };
     Timer m_statsLogTimer;
index c7c0644..461eb5a 100644 (file)
@@ -43,6 +43,7 @@
 #include "RealtimeIncomingVideoSource.h"
 #include "RealtimeOutgoingAudioSource.h"
 #include "RealtimeOutgoingVideoSource.h"
+#include "RuntimeEnabledFeatures.h"
 
 namespace WebCore {
 
@@ -331,6 +332,11 @@ RefPtr<RTCSessionDescription> LibWebRTCPeerConnectionBackend::remoteDescription(
     return m_endpoint->remoteDescription();
 }
 
+static inline LibWebRTCRtpSenderBackend& backendFromRTPSender(RTCRtpSender& sender)
+{
+    return static_cast<LibWebRTCRtpSenderBackend&>(*sender.backend());
+}
+
 ExceptionOr<Ref<RTCRtpSender>> LibWebRTCPeerConnectionBackend::addTrack(RTCRtpSender* sender, MediaStreamTrack& track, const Vector<String>& mediaStreamIds)
 {
     if (!sender) {
@@ -351,7 +357,7 @@ ExceptionOr<Ref<RTCRtpSender>> LibWebRTCPeerConnectionBackend::addTrack(RTCRtpSe
         m_peerConnection.addInternalTransceiver(WTFMove(transceiver));
     }
 
-    if (!m_endpoint->addTrack(*sender, track, mediaStreamIds))
+    if (!m_endpoint->addTrack(backendFromRTPSender(*sender), track, mediaStreamIds))
         return Exception { TypeError, "Unable to add track"_s };
 
     return makeRef(*sender);
@@ -367,8 +373,9 @@ ExceptionOr<Ref<RTCRtpTransceiver>> LibWebRTCPeerConnectionBackend::addTransceiv
 ExceptionOr<Ref<RTCRtpTransceiver>> LibWebRTCPeerConnectionBackend::addTransceiver(Ref<MediaStreamTrack>&& track, const RTCRtpTransceiverInit& init)
 {
     auto senderBackend = std::make_unique<LibWebRTCRtpSenderBackend>(*this, nullptr);
+    auto& backend = *senderBackend;
     auto sender = RTCRtpSender::create(track.copyRef(), Vector<String>(), WTFMove(senderBackend));
-    if (!m_endpoint->addTrack(sender.get(), track, Vector<String> { }))
+    if (!m_endpoint->addTrack(backend, track, Vector<String> { }))
         return Exception { InvalidAccessError, "Unable to add track"_s };
 
     return completeAddTransceiver(WTFMove(sender), init, track->id(), track->kind());
@@ -386,9 +393,9 @@ Ref<RTCRtpTransceiver> LibWebRTCPeerConnectionBackend::completeAddTransceiver(Re
     return transceiver;
 }
 
-void LibWebRTCPeerConnectionBackend::notifyRemovedTrack(RTCRtpSender& sender)
+void LibWebRTCPeerConnectionBackend::removeTrack(RTCRtpSender& sender)
 {
-    m_endpoint->removeTrack(sender);
+    m_endpoint->removeTrack(backendFromRTPSender(sender));
 }
 
 template<typename Source>
@@ -444,17 +451,32 @@ void LibWebRTCPeerConnectionBackend::replaceTrack(RTCRtpSender& sender, RefPtr<M
     }
 }
 
-RTCRtpParameters LibWebRTCPeerConnectionBackend::getParameters(RTCRtpSender& sender) const
-{
-    return m_endpoint->getRTCRtpSenderParameters(sender);
-}
-
 void LibWebRTCPeerConnectionBackend::applyRotationForOutgoingVideoSources()
 {
     for (auto& source : m_videoSources)
         source->setApplyRotation(true);
 }
 
+bool LibWebRTCPeerConnectionBackend::shouldOfferAllowToReceive(const char* kind) const
+{
+    ASSERT(!RuntimeEnabledFeatures::sharedFeatures().webRTCUnifiedPlanEnabled());
+    for (const auto& transceiver : m_peerConnection.getTransceivers()) {
+        if (transceiver->sender().trackKind() != kind)
+            continue;
+
+        if (transceiver->direction() == RTCRtpTransceiverDirection::Recvonly)
+            return true;
+
+        if (transceiver->direction() != RTCRtpTransceiverDirection::Sendrecv)
+            continue;
+
+        auto& backend = static_cast<LibWebRTCRtpSenderBackend&>(*transceiver->sender().backend());
+        if (!backend.rtcSender())
+            return true;
+    }
+    return false;
+}
+
 } // namespace WebCore
 
 #endif // USE(LIBWEBRTC)
index d10bb1a..b55f0cf 100644 (file)
@@ -56,7 +56,8 @@ public:
     bool hasVideoSources() const { return m_videoSources.size(); }
 
     void replaceTrack(RTCRtpSender&, RefPtr<MediaStreamTrack>&&, DOMPromiseDeferred<void>&&);
-    RTCRtpParameters getParameters(RTCRtpSender&) const;
+
+    bool shouldOfferAllowToReceive(const char*) const;
 
 private:
     void doCreateOffer(RTCOfferOptions&&) final;
@@ -90,7 +91,7 @@ private:
     void getStatsSucceeded(const DeferredPromise&, Ref<RTCStatsReport>&&);
 
     ExceptionOr<Ref<RTCRtpSender>> addTrack(RTCRtpSender*, MediaStreamTrack&, const Vector<String>&) final;
-    void notifyRemovedTrack(RTCRtpSender&) final;
+    void removeTrack(RTCRtpSender&) final;
 
     ExceptionOr<Ref<RTCRtpTransceiver>> addTransceiver(const String&, const RTCRtpTransceiverInit&) final;
     ExceptionOr<Ref<RTCRtpTransceiver>> addTransceiver(Ref<MediaStreamTrack>&&, const RTCRtpTransceiverInit&) final;
index 36863a9..2b2735c 100644 (file)
@@ -49,14 +49,11 @@ void LibWebRTCRtpSenderBackend::replaceTrack(RTCRtpSender& sender, RefPtr<MediaS
     m_peerConnectionBackend->replaceTrack(sender, WTFMove(track), WTFMove(promise));
 }
 
-RTCRtpParameters LibWebRTCRtpSenderBackend::getParameters(RTCRtpSender& sender) const
+RTCRtpParameters LibWebRTCRtpSenderBackend::getParameters() const
 {
-    if (!m_rtcSender) {
-        // FIXME: We should not need to go through the backend and should directly have m_rtcSender here.
-        if (!m_peerConnectionBackend)
-            return { };
-        return m_peerConnectionBackend->getParameters(sender);
-    }
+    if (!m_rtcSender)
+        return { };
+
     return fillRtpParameters(m_rtcSender->GetParameters());
 }
 
index 3fd331a..24b1b1b 100644 (file)
@@ -50,10 +50,12 @@ public:
     {
     }
 
-private:
     void setRTCSender(rtc::scoped_refptr<webrtc::RtpSenderInterface>&& rtcSender) { m_rtcSender = WTFMove(rtcSender); }
+    webrtc::RtpSenderInterface* rtcSender() { return m_rtcSender.get(); }
+
+private:
     void replaceTrack(RTCRtpSender&, RefPtr<MediaStreamTrack>&&, DOMPromiseDeferred<void>&&) final;
-    RTCRtpParameters getParameters(RTCRtpSender&) const final;
+    RTCRtpParameters getParameters() const final;
 
     WeakPtr<LibWebRTCPeerConnectionBackend> m_peerConnectionBackend;
     rtc::scoped_refptr<webrtc::RtpSenderInterface> m_rtcSender;