Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (281795 => 281796)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2021-08-31 08:39:52 UTC (rev 281795)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2021-08-31 09:07:08 UTC (rev 281796)
@@ -1,3 +1,13 @@
+2021-08-31 Youenn Fablet <[email protected]>
+
+ Add support for RTCIceTransport
+ https://bugs.webkit.org/show_bug.cgi?id=229285
+
+ Reviewed by Eric Carlson.
+
+ * web-platform-tests/webrtc/idlharness.https.window-expected.txt:
+ * web-platform-tests/webrtc/protocol/bundle.https-expected.txt:
+
2021-08-30 Johnson Zhou <[email protected]>
Rebaseline for CSS Typed OM, CSSUnparsedValue partially implemented.
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/idlharness.https.window-expected.txt (281795 => 281796)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/idlharness.https.window-expected.txt 2021-08-31 08:39:52 UTC (rev 281795)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/idlharness.https.window-expected.txt 2021-08-31 09:07:08 UTC (rev 281796)
@@ -307,7 +307,7 @@
PASS RTCDtlsTransport interface: existence and properties of interface prototype object
PASS RTCDtlsTransport interface: existence and properties of interface prototype object's "constructor" property
PASS RTCDtlsTransport interface: existence and properties of interface prototype object's @@unscopables property
-FAIL RTCDtlsTransport interface: attribute iceTransport assert_true: The prototype object must have a property "iceTransport" expected true got false
+PASS RTCDtlsTransport interface: attribute iceTransport
PASS RTCDtlsTransport interface: attribute state
PASS RTCDtlsTransport interface: operation getRemoteCertificates()
PASS RTCDtlsTransport interface: attribute onstatechange
@@ -319,14 +319,10 @@
FAIL RTCDtlsTransport interface: idlTestObjects.dtlsTransport must inherit property "getRemoteCertificates()" with the proper type assert_equals: wrong typeof object expected "object" but got "undefined"
FAIL RTCDtlsTransport interface: idlTestObjects.dtlsTransport must inherit property "onstatechange" with the proper type assert_equals: wrong typeof object expected "object" but got "undefined"
FAIL RTCDtlsTransport interface: idlTestObjects.dtlsTransport must inherit property "onerror" with the proper type assert_equals: wrong typeof object expected "object" but got "undefined"
-FAIL RTCIceTransport interface: existence and properties of interface object assert_equals: prototype of RTCIceTransport is not EventTarget expected function "function EventTarget() {
- [native code]
-}" but got function "function () {
- [native code]
-}"
+PASS RTCIceTransport interface: existence and properties of interface object
PASS RTCIceTransport interface object length
PASS RTCIceTransport interface object name
-FAIL RTCIceTransport interface: existence and properties of interface prototype object assert_equals: prototype of RTCIceTransport.prototype is not EventTarget.prototype expected object "[object EventTarget]" but got object "[object Object]"
+PASS RTCIceTransport interface: existence and properties of interface prototype object
PASS RTCIceTransport interface: existence and properties of interface prototype object's "constructor" property
PASS RTCIceTransport interface: existence and properties of interface prototype object's @@unscopables property
FAIL RTCIceTransport interface: attribute role assert_true: The prototype object must have a property "role" expected true got false
@@ -338,8 +334,8 @@
FAIL RTCIceTransport interface: operation getSelectedCandidatePair() assert_own_property: interface prototype object missing non-static operation expected property "getSelectedCandidatePair" missing
FAIL RTCIceTransport interface: operation getLocalParameters() assert_own_property: interface prototype object missing non-static operation expected property "getLocalParameters" missing
FAIL RTCIceTransport interface: operation getRemoteParameters() assert_own_property: interface prototype object missing non-static operation expected property "getRemoteParameters" missing
-FAIL RTCIceTransport interface: attribute onstatechange assert_true: The prototype object must have a property "onstatechange" expected true got false
-FAIL RTCIceTransport interface: attribute ongatheringstatechange assert_true: The prototype object must have a property "ongatheringstatechange" expected true got false
+PASS RTCIceTransport interface: attribute onstatechange
+PASS RTCIceTransport interface: attribute ongatheringstatechange
FAIL RTCIceTransport interface: attribute onselectedcandidatepairchange assert_true: The prototype object must have a property "onselectedcandidatepairchange" expected true got false
FAIL RTCIceTransport must be primary interface of idlTestObjects.iceTransport assert_equals: wrong typeof object expected "object" but got "undefined"
FAIL Stringification of idlTestObjects.iceTransport assert_equals: wrong typeof object expected "object" but got "undefined"
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/protocol/bundle.https-expected.txt (281795 => 281796)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/protocol/bundle.https-expected.txt 2021-08-31 08:39:52 UTC (rev 281795)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/protocol/bundle.https-expected.txt 2021-08-31 09:07:08 UTC (rev 281796)
@@ -1,4 +1,4 @@
-FAIL not negotiating BUNDLE creates two separate ice and dtls transports assert_not_equals: got disallowed value undefined
+PASS not negotiating BUNDLE creates two separate ice and dtls transports
PASS bundles on the first transport and closes the second
Modified: trunk/Source/WebCore/ChangeLog (281795 => 281796)
--- trunk/Source/WebCore/ChangeLog 2021-08-31 08:39:52 UTC (rev 281795)
+++ trunk/Source/WebCore/ChangeLog 2021-08-31 09:07:08 UTC (rev 281796)
@@ -1,3 +1,66 @@
+2021-08-31 Youenn Fablet <[email protected]>
+
+ Add support for RTCIceTransport
+ https://bugs.webkit.org/show_bug.cgi?id=229285
+
+ Reviewed by Eric Carlson.
+
+ Introduce RTCIceTransport as per spec.
+ Reuse the same model as RTCDtlsTransport with a backend and RTCPeerConnection be responsible to reuse or create transports as needed.
+
+ Covered by updated tests.
+
+ * Modules/mediastream/RTCDtlsTransport.cpp:
+ (WebCore::RTCDtlsTransport::RTCDtlsTransport):
+ * Modules/mediastream/RTCDtlsTransport.h:
+ * Modules/mediastream/RTCDtlsTransport.idl:
+ * Modules/mediastream/RTCDtlsTransportBackend.h:
+ * Modules/mediastream/RTCIceTransport.cpp:
+ (WebCore::RTCIceTransport::RTCIceTransport):
+ (WebCore::RTCIceTransport::~RTCIceTransport):
+ (WebCore::RTCIceTransport::stop):
+ (WebCore::RTCIceTransport::virtualHasPendingActivity const):
+ (WebCore::RTCIceTransport::onStateChanged):
+ (WebCore::RTCIceTransport::onGatheringStateChanged):
+ * Modules/mediastream/RTCIceTransport.h:
+ (WebCore::RTCIceTransport::create):
+ (WebCore::RTCIceTransport::state const):
+ (WebCore::RTCIceTransport::backend const):
+ * Modules/mediastream/RTCIceTransport.idl:
+ * Modules/mediastream/RTCIceTransportBackend.h: Added.
+ (WebCore::operator==):
+ * Modules/mediastream/RTCPeerConnection.cpp:
+ (WebCore::RTCPeerConnection::computeConnectionState):
+ (WebCore::RTCPeerConnection::updateConnectionState):
+ (WebCore::isIceTransportUsedByTransceiver):
+ (WebCore::RTCPeerConnection::computeIceConnectionStateFromIceTransports):
+ (WebCore::RTCPeerConnection::processIceTransportStateChange):
+ (WebCore::RTCPeerConnection::getOrCreateIceTransport):
+ (WebCore::RTCPeerConnection::getOrCreateDtlsTransport):
+ * Modules/mediastream/RTCPeerConnection.h:
+ * Modules/mediastream/libwebrtc/LibWebRTCDtlsTransportBackend.cpp:
+ (WebCore::LibWebRTCDtlsTransportBackend::iceTransportBackend):
+ * Modules/mediastream/libwebrtc/LibWebRTCDtlsTransportBackend.h:
+ * Modules/mediastream/libwebrtc/LibWebRTCIceTransportBackend.cpp: Added.
+ (WebCore::toRTCIceTransportState):
+ (WebCore::toRTCIceGatheringState):
+ (WebCore::LibWebRTCIceTransportBackendObserver::LibWebRTCIceTransportBackendObserver):
+ (WebCore::LibWebRTCIceTransportBackendObserver::start):
+ (WebCore::LibWebRTCIceTransportBackendObserver::stop):
+ (WebCore::LibWebRTCIceTransportBackendObserver::onIceTransportStateChanged):
+ (WebCore::LibWebRTCIceTransportBackendObserver::onGatheringStateChanged):
+ (WebCore::LibWebRTCIceTransportBackend::LibWebRTCIceTransportBackend):
+ (WebCore::LibWebRTCIceTransportBackend::~LibWebRTCIceTransportBackend):
+ (WebCore::LibWebRTCIceTransportBackend::registerClient):
+ (WebCore::LibWebRTCIceTransportBackend::unregisterClient):
+ * Modules/mediastream/libwebrtc/LibWebRTCIceTransportBackend.h: Added.
+ * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
+ (WebCore::LibWebRTCMediaEndpoint::OnIceConnectionChange):
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * dom/EventNames.h:
+ * dom/EventTargetFactory.in:
+
2021-08-31 Rob Buis <[email protected]>
Nullptr crash in TypingCommand::willAddTypingToOpenCommand via TypingCommand::deleteKeyPressed
Modified: trunk/Source/WebCore/Modules/mediastream/RTCDtlsTransport.cpp (281795 => 281796)
--- trunk/Source/WebCore/Modules/mediastream/RTCDtlsTransport.cpp 2021-08-31 08:39:52 UTC (rev 281795)
+++ trunk/Source/WebCore/Modules/mediastream/RTCDtlsTransport.cpp 2021-08-31 09:07:08 UTC (rev 281796)
@@ -33,6 +33,7 @@
#include "Logging.h"
#include "NotImplemented.h"
#include "RTCDtlsTransportBackend.h"
+#include "RTCIceTransport.h"
#include "ScriptExecutionContext.h"
#include <wtf/IsoMallocInlines.h>
@@ -40,9 +41,10 @@
WTF_MAKE_ISO_ALLOCATED_IMPL(RTCDtlsTransport);
-RTCDtlsTransport::RTCDtlsTransport(ScriptExecutionContext& context, UniqueRef<RTCDtlsTransportBackend>&& backend)
+RTCDtlsTransport::RTCDtlsTransport(ScriptExecutionContext& context, UniqueRef<RTCDtlsTransportBackend>&& backend, Ref<RTCIceTransport>&& iceTransport)
: ActiveDOMObject(&context)
, m_backend(WTFMove(backend))
+ , m_iceTransport(WTFMove(iceTransport))
{
suspendIfNeeded();
m_backend->registerClient(*this);
Modified: trunk/Source/WebCore/Modules/mediastream/RTCDtlsTransport.h (281795 => 281796)
--- trunk/Source/WebCore/Modules/mediastream/RTCDtlsTransport.h 2021-08-31 08:39:52 UTC (rev 281795)
+++ trunk/Source/WebCore/Modules/mediastream/RTCDtlsTransport.h 2021-08-31 09:07:08 UTC (rev 281796)
@@ -35,6 +35,7 @@
namespace WebCore {
class PeerConnectionBackend;
+class RTCIceTransport;
class RTCPeerConnection;
class ScriptExecutionContext;
@@ -41,12 +42,13 @@
class RTCDtlsTransport final : public RefCounted<RTCDtlsTransport>, public ActiveDOMObject, public EventTargetWithInlineData, public RTCDtlsTransportBackend::Client {
WTF_MAKE_ISO_ALLOCATED(RTCDtlsTransport);
public:
- static Ref<RTCDtlsTransport> create(ScriptExecutionContext& context, UniqueRef<RTCDtlsTransportBackend>&& backend) { return adoptRef(*new RTCDtlsTransport(context, WTFMove(backend))); }
+ static Ref<RTCDtlsTransport> create(ScriptExecutionContext& context, UniqueRef<RTCDtlsTransportBackend>&& backend, Ref<RTCIceTransport>&& iceTransport) { return adoptRef(*new RTCDtlsTransport(context, WTFMove(backend), WTFMove(iceTransport))); }
~RTCDtlsTransport();
using RefCounted<RTCDtlsTransport>::ref;
using RefCounted<RTCDtlsTransport>::deref;
+ RTCIceTransport& iceTransport() { return m_iceTransport.get(); }
RTCDtlsTransportState state() { return m_state; }
Vector<Ref<JSC::ArrayBuffer>> getRemoteCertificates();
@@ -53,7 +55,7 @@
const RTCDtlsTransportBackend& backend() const { return m_backend.get(); }
private:
- RTCDtlsTransport(ScriptExecutionContext&, UniqueRef<RTCDtlsTransportBackend>&&);
+ RTCDtlsTransport(ScriptExecutionContext&, UniqueRef<RTCDtlsTransportBackend>&&, Ref<RTCIceTransport>&&);
// EventTargetWithInlineData
EventTargetInterface eventTargetInterface() const final { return RTCDtlsTransportEventTargetInterfaceType; }
@@ -71,6 +73,7 @@
void onError() final;
UniqueRef<RTCDtlsTransportBackend> m_backend;
+ Ref<RTCIceTransport> m_iceTransport;
RTCDtlsTransportState m_state { RTCDtlsTransportState::New };
Vector<Ref<JSC::ArrayBuffer>> m_remoteCertificates;
};
Modified: trunk/Source/WebCore/Modules/mediastream/RTCDtlsTransport.idl (281795 => 281796)
--- trunk/Source/WebCore/Modules/mediastream/RTCDtlsTransport.idl 2021-08-31 08:39:52 UTC (rev 281795)
+++ trunk/Source/WebCore/Modules/mediastream/RTCDtlsTransport.idl 2021-08-31 09:07:08 UTC (rev 281796)
@@ -28,7 +28,7 @@
EnabledBySetting=PeerConnection,
Exposed=(Window),
] interface RTCDtlsTransport : EventTarget {
- // [SameObject] readonly attribute RTCIceTransport iceTransport;
+ [SameObject] readonly attribute RTCIceTransport iceTransport;
readonly attribute RTCDtlsTransportState state;
sequence<ArrayBuffer> getRemoteCertificates();
attribute EventHandler onstatechange;
Modified: trunk/Source/WebCore/Modules/mediastream/RTCDtlsTransportBackend.h (281795 => 281796)
--- trunk/Source/WebCore/Modules/mediastream/RTCDtlsTransportBackend.h 2021-08-31 08:39:52 UTC (rev 281795)
+++ trunk/Source/WebCore/Modules/mediastream/RTCDtlsTransportBackend.h 2021-08-31 09:07:08 UTC (rev 281796)
@@ -35,12 +35,15 @@
namespace WebCore {
+class RTCIceTransportBackend;
+
class RTCDtlsTransportBackend {
public:
virtual ~RTCDtlsTransportBackend() = default;
virtual const void* backend() const = 0;
-
+ virtual UniqueRef<RTCIceTransportBackend> iceTransportBackend() = 0;
+
class Client : public CanMakeWeakPtr<Client> {
public:
virtual ~Client() = default;
Modified: trunk/Source/WebCore/Modules/mediastream/RTCIceTransport.cpp (281795 => 281796)
--- trunk/Source/WebCore/Modules/mediastream/RTCIceTransport.cpp 2021-08-31 08:39:52 UTC (rev 281795)
+++ trunk/Source/WebCore/Modules/mediastream/RTCIceTransport.cpp 2021-08-31 09:07:08 UTC (rev 281796)
@@ -28,6 +28,9 @@
#if ENABLE(WEB_RTC)
+#include "Event.h"
+#include "EventNames.h"
+#include "RTCPeerConnection.h"
#include <wtf/IsoMallocInlines.h>
namespace WebCore {
@@ -34,10 +37,60 @@
WTF_MAKE_ISO_ALLOCATED_IMPL(RTCIceTransport);
+RTCIceTransport::RTCIceTransport(ScriptExecutionContext& context, UniqueRef<RTCIceTransportBackend>&& backend, RTCPeerConnection& connection)
+ : ActiveDOMObject(&context)
+ , m_backend(WTFMove(backend))
+ , m_connection(makeWeakPtr(connection))
+{
+ suspendIfNeeded();
+ m_backend->registerClient(*this);
+}
+
RTCIceTransport::~RTCIceTransport()
{
+ m_backend->unregisterClient();
}
+void RTCIceTransport::stop()
+{
+ m_isStopped = true;
+ m_transportState = RTCIceTransportState::Closed;
+}
+
+bool RTCIceTransport::virtualHasPendingActivity() const
+{
+ return m_transportState != RTCIceTransportState::Closed && hasEventListeners();
+}
+
+void RTCIceTransport::onStateChanged(RTCIceTransportState state)
+{
+ queueTaskKeepingObjectAlive(*this, TaskSource::Networking, [this, state]() mutable {
+ if (m_isStopped)
+ return;
+
+ if (m_transportState == state)
+ return;
+
+ m_transportState = state;
+ if (m_connection)
+ m_connection->processIceTransportStateChange(*this);
+ });
+}
+
+void RTCIceTransport::onGatheringStateChanged(RTCIceGatheringState state)
+{
+ queueTaskKeepingObjectAlive(*this, TaskSource::Networking, [this, state]() mutable {
+ if (m_isStopped)
+ return;
+
+ if (m_gatheringState == state)
+ return;
+
+ m_gatheringState = state;
+ dispatchEvent(Event::create(eventNames().gatheringstatechangeEvent, Event::CanBubble::Yes, Event::IsCancelable::No));
+ });
+}
+
} // namespace WebCore
#endif // ENABLE(WEB_RTC)
Modified: trunk/Source/WebCore/Modules/mediastream/RTCIceTransport.h (281795 => 281796)
--- trunk/Source/WebCore/Modules/mediastream/RTCIceTransport.h 2021-08-31 08:39:52 UTC (rev 281795)
+++ trunk/Source/WebCore/Modules/mediastream/RTCIceTransport.h 2021-08-31 09:07:08 UTC (rev 281796)
@@ -33,32 +33,56 @@
#if ENABLE(WEB_RTC)
+#include "ActiveDOMObject.h"
+#include "EventTarget.h"
#include "RTCIceGatheringState.h"
+#include "RTCIceTransportBackend.h"
#include "RTCIceTransportState.h"
-#include "ScriptWrappable.h"
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
namespace WebCore {
-class RTCIceTransport : public RefCounted<RTCIceTransport>, public ScriptWrappable {
+class RTCPeerConnection;
+
+class RTCIceTransport : public RefCounted<RTCIceTransport>, public ActiveDOMObject, public EventTargetWithInlineData, public RTCIceTransportBackend::Client {
WTF_MAKE_ISO_ALLOCATED(RTCIceTransport);
public:
- static Ref<RTCIceTransport> create()
+ static Ref<RTCIceTransport> create(ScriptExecutionContext& context, UniqueRef<RTCIceTransportBackend>&& backend, RTCPeerConnection& connection)
{
- return adoptRef(*new RTCIceTransport());
+ return adoptRef(*new RTCIceTransport(context, WTFMove(backend), connection));
}
~RTCIceTransport();
RTCIceTransportState state() const { return m_transportState; }
- void setState(RTCIceTransportState state) { m_transportState = state; }
-
RTCIceGatheringState gatheringState() const { return m_gatheringState; }
- void setGatheringState(RTCIceGatheringState state) { m_gatheringState = state; }
+ const RTCIceTransportBackend& backend() const { return m_backend.get(); }
+
+ using RefCounted<RTCIceTransport>::ref;
+ using RefCounted<RTCIceTransport>::deref;
+
private:
- RTCIceTransport() { };
+ RTCIceTransport(ScriptExecutionContext&, UniqueRef<RTCIceTransportBackend>&&, RTCPeerConnection&);
+ // EventTargetWithInlineData
+ EventTargetInterface eventTargetInterface() const final { return RTCIceTransportEventTargetInterfaceType; }
+ ScriptExecutionContext* scriptExecutionContext() const final { return m_scriptExecutionContext; }
+ void refEventTarget() final { ref(); }
+ void derefEventTarget() final { deref(); }
+
+ // ActiveDOMObject
+ void stop() final;
+ const char* activeDOMObjectName() const final { return "RTCIceTransport"; }
+ bool virtualHasPendingActivity() const final;
+
+ // RTCIceTransportBackend::Client
+ void onStateChanged(RTCIceTransportState) final;
+ void onGatheringStateChanged(RTCIceGatheringState) final;
+
+ bool m_isStopped { false };
+ UniqueRef<RTCIceTransportBackend> m_backend;
+ WeakPtr<RTCPeerConnection> m_connection;
RTCIceTransportState m_transportState { RTCIceTransportState::New };
RTCIceGatheringState m_gatheringState { RTCIceGatheringState::New };
};
Modified: trunk/Source/WebCore/Modules/mediastream/RTCIceTransport.idl (281795 => 281796)
--- trunk/Source/WebCore/Modules/mediastream/RTCIceTransport.idl 2021-08-31 08:39:52 UTC (rev 281795)
+++ trunk/Source/WebCore/Modules/mediastream/RTCIceTransport.idl 2021-08-31 09:07:08 UTC (rev 281796)
@@ -27,15 +27,15 @@
typedef RTCIceGatheringState IceGatheringState;
[
+ ActiveDOMObject,
Conditional=WEB_RTC,
EnabledBySetting=PeerConnection,
Exposed=Window,
SkipVTableValidation
-] interface RTCIceTransport {
+] interface RTCIceTransport : EventTarget {
// FIXME 169662: missing readonly attribute RTCIceRole role;
// FIXME 169662: missing readonly attribute RTCIceComponent component;
readonly attribute IceTransportState state;
- // FIXME 169662: IceGathererState instead of IceGatheringState?
readonly attribute IceGatheringState gatheringState;
// FIXME 169662: missing sequence<RTCIceCandidate> getLocalCandidates();
// FIXME 169662: missing sequence<RTCIceCandidate> getRemoteCandidates();
@@ -42,7 +42,7 @@
// FIXME 169662: missing RTCIceCandidatePair? getSelectedCandidatePair();
// FIXME 169662: missing RTCIceParameters? getLocalParameters();
// FIXME 169662: missing RTCIceParameters? getRemoteParameters();
- // FIXME 169662: missing attribute EventHandler onstatechange;
- // FIXME 169662: missing attribute EventHandler ongatheringstatechange;
+ attribute EventHandler onstatechange;
+ attribute EventHandler ongatheringstatechange;
// FIXME 169662: missing attribute EventHandler onselectedcandidatepairchange;
};
Copied: trunk/Source/WebCore/Modules/mediastream/RTCIceTransportBackend.h (from rev 281795, trunk/Source/WebCore/Modules/mediastream/RTCDtlsTransportBackend.h) (0 => 281796)
--- trunk/Source/WebCore/Modules/mediastream/RTCIceTransportBackend.h (rev 0)
+++ trunk/Source/WebCore/Modules/mediastream/RTCIceTransportBackend.h 2021-08-31 09:07:08 UTC (rev 281796)
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2021 Apple Inc.
+ *
+ * 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 "RTCIceGatheringState.h"
+#include "RTCIceTransportState.h"
+
+namespace WebCore {
+
+class RTCIceTransportBackend {
+public:
+ virtual ~RTCIceTransportBackend() = default;
+ virtual const void* backend() const = 0;
+
+ class Client : public CanMakeWeakPtr<Client> {
+ public:
+ virtual ~Client() = default;
+ virtual void onStateChanged(RTCIceTransportState) = 0;
+ virtual void onGatheringStateChanged(RTCIceGatheringState) = 0;
+ };
+ virtual void registerClient(Client&) = 0;
+ virtual void unregisterClient() = 0;
+};
+
+inline bool operator==(const RTCIceTransportBackend& a, const RTCIceTransportBackend& b)
+{
+ return a.backend() == b.backend();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_RTC)
Modified: trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp (281795 => 281796)
--- trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp 2021-08-31 08:39:52 UTC (rev 281795)
+++ trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp 2021-08-31 09:07:08 UTC (rev 281796)
@@ -654,25 +654,27 @@
});
}
+RTCPeerConnectionState RTCPeerConnection::computeConnectionState()
+{
+ if (m_iceConnectionState == RTCIceConnectionState::Closed)
+ return RTCPeerConnectionState::Closed;
+ if (m_iceConnectionState == RTCIceConnectionState::Disconnected)
+ return RTCPeerConnectionState::Disconnected;
+ if (m_iceConnectionState == RTCIceConnectionState::Failed)
+ return RTCPeerConnectionState::Failed;
+ if (m_iceConnectionState == RTCIceConnectionState::New && m_iceGatheringState == RTCIceGatheringState::New)
+ return RTCPeerConnectionState::New;
+ if (m_iceConnectionState == RTCIceConnectionState::Checking || m_iceGatheringState == RTCIceGatheringState::Gathering)
+ return RTCPeerConnectionState::Connecting;
+ if ((m_iceConnectionState == RTCIceConnectionState::Completed || m_iceConnectionState == RTCIceConnectionState::Connected) && m_iceGatheringState == RTCIceGatheringState::Complete)
+ return RTCPeerConnectionState::Connected;
+ return m_connectionState;
+}
+
void RTCPeerConnection::updateConnectionState()
{
- RTCPeerConnectionState state;
+ auto state = computeConnectionState();
- if (m_iceConnectionState == RTCIceConnectionState::Closed)
- state = RTCPeerConnectionState::Closed;
- else if (m_iceConnectionState == RTCIceConnectionState::Disconnected)
- state = RTCPeerConnectionState::Disconnected;
- else if (m_iceConnectionState == RTCIceConnectionState::Failed)
- state = RTCPeerConnectionState::Failed;
- else if (m_iceConnectionState == RTCIceConnectionState::New && m_iceGatheringState == RTCIceGatheringState::New)
- state = RTCPeerConnectionState::New;
- else if (m_iceConnectionState == RTCIceConnectionState::Checking || m_iceGatheringState == RTCIceGatheringState::Gathering)
- state = RTCPeerConnectionState::Connecting;
- else if ((m_iceConnectionState == RTCIceConnectionState::Completed || m_iceConnectionState == RTCIceConnectionState::Connected) && m_iceGatheringState == RTCIceGatheringState::Complete)
- state = RTCPeerConnectionState::Connected;
- else
- return;
-
if (state == m_connectionState)
return;
@@ -682,6 +684,58 @@
dispatchEventWhenFeasible(Event::create(eventNames().connectionstatechangeEvent, Event::CanBubble::No, Event::IsCancelable::No));
}
+static bool isIceTransportUsedByTransceiver(const RTCIceTransport& iceTransport, RTCRtpTransceiver& transceiver)
+{
+ auto* dtlsTransport = transceiver.sender().transport();
+ return dtlsTransport && &dtlsTransport->iceTransport() == &iceTransport;
+}
+
+// https://w3c.github.io/webrtc-pc/#dom-rtciceconnectionstate
+RTCIceConnectionState RTCPeerConnection::computeIceConnectionStateFromIceTransports()
+{
+ if (isClosed())
+ return RTCIceConnectionState::Closed;
+
+ auto iceTransports = m_iceTransports;
+ iceTransports.removeAllMatching([&](auto& iceTransport) {
+ bool test = allOf(m_transceiverSet.list(), [&iceTransport](auto& transceiver) {
+ return !isIceTransportUsedByTransceiver(iceTransport.get(), *transceiver);
+ });
+ return test;
+ });
+
+ if (anyOf(iceTransports, [](auto& transport) { return transport->state() == RTCIceTransportState::Failed; }))
+ return RTCIceConnectionState::Failed;
+ if (anyOf(iceTransports, [](auto& transport) { return transport->state() == RTCIceTransportState::Disconnected; }))
+ return RTCIceConnectionState::Disconnected;
+ if (allOf(iceTransports, [](auto& transport) { return transport->state() == RTCIceTransportState::New || transport->state() == RTCIceTransportState::Closed; }))
+ return RTCIceConnectionState::New;
+ if (anyOf(iceTransports, [](auto& transport) { return transport->state() == RTCIceTransportState::New || transport->state() == RTCIceTransportState::Checking; }))
+ return RTCIceConnectionState::Checking;
+ if (allOf(iceTransports, [](auto& transport) { return transport->state() == RTCIceTransportState::Completed || transport->state() == RTCIceTransportState::Closed; }))
+ return RTCIceConnectionState::Completed;
+ ASSERT(allOf(iceTransports, [](auto& transport) { return transport->state() == RTCIceTransportState::Connected || transport->state() == RTCIceTransportState::Completed || transport->state() == RTCIceTransportState::Closed; }));
+ return RTCIceConnectionState::Connected;
+}
+
+// https://w3c.github.io/webrtc-pc/#rtcicetransport, algorithm to handle a change of RTCIceTransport state.
+void RTCPeerConnection::processIceTransportStateChange(RTCIceTransport& iceTransport)
+{
+ auto newIceConnectionState = computeIceConnectionStateFromIceTransports();
+ bool iceConnectionStateChanged = m_iceConnectionState != newIceConnectionState;
+ m_iceConnectionState = newIceConnectionState;
+
+ auto newConnectionState = computeConnectionState();
+ bool connectionStateChanged = m_connectionState != newConnectionState;
+ m_connectionState = newConnectionState;
+
+ iceTransport.dispatchEvent(Event::create(eventNames().statechangeEvent, Event::CanBubble::Yes, Event::IsCancelable::No));
+ if (iceConnectionStateChanged)
+ dispatchEventWhenFeasible(Event::create(eventNames().iceconnectionstatechangeEvent, Event::CanBubble::No, Event::IsCancelable::No));
+ if (connectionStateChanged)
+ dispatchEventWhenFeasible(Event::create(eventNames().connectionstatechangeEvent, Event::CanBubble::No, Event::IsCancelable::No));
+}
+
void RTCPeerConnection::scheduleNegotiationNeededEvent()
{
if (m_hasPendingOperation) {
@@ -842,6 +896,18 @@
return downcast<Document>(scriptExecutionContext());
}
+Ref<RTCIceTransport> RTCPeerConnection::getOrCreateIceTransport(UniqueRef<RTCIceTransportBackend>&& backend)
+{
+ auto index = m_iceTransports.findMatching([&backend](auto& transport) { return backend.get() == transport->backend(); });
+ if (index == notFound) {
+ index = m_iceTransports.size();
+ m_iceTransports.append(RTCIceTransport::create(*scriptExecutionContext(), WTFMove(backend), *this));
+ }
+
+ return m_iceTransports[index].copyRef();
+}
+
+
RefPtr<RTCDtlsTransport> RTCPeerConnection::getOrCreateDtlsTransport(std::unique_ptr<RTCDtlsTransportBackend>&& backend)
{
if (!backend)
@@ -851,13 +917,14 @@
if (!context)
return nullptr;
- auto index = m_transports.findMatching([&backend](auto& transport) { return *backend == transport->backend(); });
+ auto index = m_dtlsTransports.findMatching([&backend](auto& transport) { return *backend == transport->backend(); });
if (index == notFound) {
- index = m_transports.size();
- m_transports.append(RTCDtlsTransport::create(*context, makeUniqueRefFromNonNullUniquePtr(WTFMove(backend))));
+ index = m_dtlsTransports.size();
+ auto iceTransportBackend = backend->iceTransportBackend();
+ m_dtlsTransports.append(RTCDtlsTransport::create(*context, makeUniqueRefFromNonNullUniquePtr(WTFMove(backend)), getOrCreateIceTransport(WTFMove(iceTransportBackend))));
}
- return m_transports[index].copyRef();
+ return m_dtlsTransports[index].copyRef();
}
void RTCPeerConnection::updateTransceiverTransports()
Modified: trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.h (281795 => 281796)
--- trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.h 2021-08-31 08:39:52 UTC (rev 281795)
+++ trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.h 2021-08-31 09:07:08 UTC (rev 281796)
@@ -61,6 +61,7 @@
class RTCDtlsTransport;
class RTCDtlsTransportBackend;
class RTCIceCandidate;
+class RTCIceTransportBackend;
class RTCPeerConnectionErrorCallback;
class RTCSessionDescription;
class RTCStatsCallback;
@@ -188,6 +189,8 @@
void updateTransceiversAfterSuccessfulLocalDescription();
void updateTransceiversAfterSuccessfulRemoteDescription();
+ void processIceTransportStateChange(RTCIceTransport&);
+
#if !RELEASE_LOG_DISABLED
const Logger& logger() const final { return m_logger.get(); }
const void* logIdentifier() const final { return m_logIdentifier; }
@@ -219,6 +222,10 @@
bool virtualHasPendingActivity() const final;
void updateConnectionState();
+ bool updateIceConnectionStateFromIceTransports();
+ RTCIceConnectionState computeIceConnectionStateFromIceTransports();
+ RTCPeerConnectionState computeConnectionState();
+
bool doClose();
void doStop();
@@ -230,6 +237,7 @@
ExceptionOr<Vector<MediaEndpointConfiguration::IceServerInfo>> iceServersFromConfiguration(RTCConfiguration& newConfiguration, const RTCConfiguration* existingConfiguration, bool isLocalDescriptionSet);
+ Ref<RTCIceTransport> getOrCreateIceTransport(UniqueRef<RTCIceTransportBackend>&&);
RefPtr<RTCDtlsTransport> getOrCreateDtlsTransport(std::unique_ptr<RTCDtlsTransportBackend>&&);
void updateTransceiverTransports();
@@ -256,7 +264,8 @@
Deque<std::pair<Ref<DeferredPromise>, Function<void(Ref<DeferredPromise>&&)>>> m_operations;
bool m_hasPendingOperation { false };
bool m_shouldFireNegotiationNeededOnceOperationChainIsEmpty { false };
- Vector<Ref<RTCDtlsTransport>> m_transports;
+ Vector<Ref<RTCDtlsTransport>> m_dtlsTransports;
+ Vector<Ref<RTCIceTransport>> m_iceTransports;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCDtlsTransportBackend.cpp (281795 => 281796)
--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCDtlsTransportBackend.cpp 2021-08-31 08:39:52 UTC (rev 281795)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCDtlsTransportBackend.cpp 2021-08-31 09:07:08 UTC (rev 281796)
@@ -27,6 +27,7 @@
#if ENABLE(WEB_RTC) && USE(LIBWEBRTC)
+#include "LibWebRTCIceTransportBackend.h"
#include "LibWebRTCProvider.h"
#include <_javascript_Core/ArrayBuffer.h>
#include <webrtc/api/dtls_transport_interface.h>
@@ -131,7 +132,6 @@
});
}
-
LibWebRTCDtlsTransportBackend::LibWebRTCDtlsTransportBackend(rtc::scoped_refptr<webrtc::DtlsTransportInterface>&& backend)
: m_backend(WTFMove(backend))
{
@@ -144,6 +144,11 @@
m_observer->stop();
}
+UniqueRef<RTCIceTransportBackend> LibWebRTCDtlsTransportBackend::iceTransportBackend()
+{
+ return makeUniqueRef<LibWebRTCIceTransportBackend>(m_backend->ice_transport());
+}
+
void LibWebRTCDtlsTransportBackend::registerClient(Client& client)
{
ASSERT(!m_observer);
Modified: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCDtlsTransportBackend.h (281795 => 281796)
--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCDtlsTransportBackend.h 2021-08-31 08:39:52 UTC (rev 281795)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCDtlsTransportBackend.h 2021-08-31 09:07:08 UTC (rev 281796)
@@ -51,6 +51,7 @@
private:
// RTCDtlsTransportBackend
const void* backend() const final { return m_backend.get(); }
+ UniqueRef<RTCIceTransportBackend> iceTransportBackend() final;
void registerClient(Client&) final;
void unregisterClient() final;
Added: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCIceTransportBackend.cpp (0 => 281796)
--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCIceTransportBackend.cpp (rev 0)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCIceTransportBackend.cpp 2021-08-31 09:07:08 UTC (rev 281796)
@@ -0,0 +1,163 @@
+/*
+ * Copyright (C) 2021 Apple Inc.
+ *
+ * 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.
+ */
+
+#include "config.h"
+#include "LibWebRTCIceTransportBackend.h"
+
+#if ENABLE(WEB_RTC) && USE(LIBWEBRTC)
+
+ALLOW_UNUSED_PARAMETERS_BEGIN
+
+#include <webrtc/api/ice_transport_interface.h>
+#include <webrtc/p2p/base/ice_transport_internal.h>
+
+ALLOW_UNUSED_PARAMETERS_END
+
+namespace WebCore {
+
+static inline RTCIceTransportState toRTCIceTransportState(webrtc::IceTransportState state)
+{
+ switch (state) {
+ case webrtc::IceTransportState::kNew:
+ return RTCIceTransportState::New;
+ case webrtc::IceTransportState::kChecking:
+ return RTCIceTransportState::Checking;
+ case webrtc::IceTransportState::kConnected:
+ return RTCIceTransportState::Connected;
+ case webrtc::IceTransportState::kFailed:
+ return RTCIceTransportState::Failed;
+ case webrtc::IceTransportState::kCompleted:
+ return RTCIceTransportState::Completed;
+ case webrtc::IceTransportState::kDisconnected:
+ return RTCIceTransportState::Disconnected;
+ case webrtc::IceTransportState::kClosed:
+ return RTCIceTransportState::Closed;
+ }
+
+ RELEASE_ASSERT_NOT_REACHED();
+}
+
+static inline RTCIceGatheringState toRTCIceGatheringState(cricket::IceGatheringState state)
+{
+ switch (state) {
+ case cricket::IceGatheringState::kIceGatheringNew:
+ return RTCIceGatheringState::New;
+ case cricket::IceGatheringState::kIceGatheringGathering:
+ return RTCIceGatheringState::Gathering;
+ case cricket::IceGatheringState::kIceGatheringComplete:
+ return RTCIceGatheringState::Complete;
+ }
+
+ RELEASE_ASSERT_NOT_REACHED();
+}
+
+class LibWebRTCIceTransportBackendObserver final : public ThreadSafeRefCounted<LibWebRTCIceTransportBackendObserver>, public sigslot::has_slots<> {
+public:
+ static Ref<LibWebRTCIceTransportBackendObserver> create(RTCIceTransportBackend::Client& client, rtc::scoped_refptr<webrtc::IceTransportInterface> backend) { return adoptRef(*new LibWebRTCIceTransportBackendObserver(client, WTFMove(backend))); }
+
+ void start();
+ void stop();
+
+private:
+ LibWebRTCIceTransportBackendObserver(RTCIceTransportBackend::Client&, rtc::scoped_refptr<webrtc::IceTransportInterface>&&);
+
+ void onIceTransportStateChanged(cricket::IceTransportInternal*);
+ void onGatheringStateChanged(cricket::IceTransportInternal*);
+
+ rtc::scoped_refptr<webrtc::IceTransportInterface> m_backend;
+ WeakPtr<RTCIceTransportBackend::Client> m_client;
+};
+
+LibWebRTCIceTransportBackendObserver::LibWebRTCIceTransportBackendObserver(RTCIceTransportBackend::Client& client, rtc::scoped_refptr<webrtc::IceTransportInterface>&& backend)
+ : m_backend(WTFMove(backend))
+ , m_client(makeWeakPtr(client))
+{
+ ASSERT(m_backend);
+}
+
+void LibWebRTCIceTransportBackendObserver::start()
+{
+ LibWebRTCProvider::callOnWebRTCNetworkThread([this, protectedThis = makeRef(*this)]() mutable {
+ auto* internal = m_backend->internal();
+ if (!internal)
+ return;
+ internal->SignalIceTransportStateChanged.connect(this, &LibWebRTCIceTransportBackendObserver::onIceTransportStateChanged);
+ internal->SignalGatheringState.connect(this, &LibWebRTCIceTransportBackendObserver::onGatheringStateChanged);
+ });
+}
+
+void LibWebRTCIceTransportBackendObserver::stop()
+{
+ m_client = nullptr;
+ LibWebRTCProvider::callOnWebRTCNetworkThread([this, protectedThis = makeRef(*this)] {
+ auto* internal = m_backend->internal();
+ if (!internal)
+ return;
+ internal->SignalIceTransportStateChanged.disconnect(this);
+ internal->SignalGatheringState.disconnect(this);
+ });
+}
+
+void LibWebRTCIceTransportBackendObserver::onIceTransportStateChanged(cricket::IceTransportInternal* internal)
+{
+ callOnMainThread([protectedThis = makeRef(*this), state = internal->GetIceTransportState()] {
+ if (protectedThis->m_client)
+ protectedThis->m_client->onStateChanged(toRTCIceTransportState(state));
+ });
+}
+
+void LibWebRTCIceTransportBackendObserver::onGatheringStateChanged(cricket::IceTransportInternal* internal)
+{
+ callOnMainThread([protectedThis = makeRef(*this), state = internal->gathering_state()] {
+ if (protectedThis->m_client)
+ protectedThis->m_client->onGatheringStateChanged(toRTCIceGatheringState(state));
+ });
+}
+
+LibWebRTCIceTransportBackend::LibWebRTCIceTransportBackend(rtc::scoped_refptr<webrtc::IceTransportInterface>&& backend)
+ : m_backend(WTFMove(backend))
+{
+ ASSERT(m_backend);
+}
+
+LibWebRTCIceTransportBackend::~LibWebRTCIceTransportBackend()
+{
+}
+
+void LibWebRTCIceTransportBackend::registerClient(Client& client)
+{
+ ASSERT(!m_observer);
+ m_observer = LibWebRTCIceTransportBackendObserver::create(client, m_backend);
+ m_observer->start();
+}
+
+void LibWebRTCIceTransportBackend::unregisterClient()
+{
+ ASSERT(m_observer);
+ m_observer->stop();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_RTC) && USE(LIBWEBRTC)
Copied: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCIceTransportBackend.h (from rev 281795, trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCDtlsTransportBackend.h) (0 => 281796)
--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCIceTransportBackend.h (rev 0)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCIceTransportBackend.h 2021-08-31 09:07:08 UTC (rev 281796)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2021 Apple Inc.
+ *
+ * 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 "LibWebRTCMacros.h"
+#include "RTCIceTransportBackend.h"
+
+ALLOW_UNUSED_PARAMETERS_BEGIN
+
+#include <webrtc/api/scoped_refptr.h>
+
+ALLOW_UNUSED_PARAMETERS_END
+
+namespace webrtc {
+class IceTransportInterface;
+}
+
+namespace WebCore {
+
+class LibWebRTCIceTransportBackendObserver;
+
+class LibWebRTCIceTransportBackend final : public RTCIceTransportBackend {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ explicit LibWebRTCIceTransportBackend(rtc::scoped_refptr<webrtc::IceTransportInterface>&&);
+ ~LibWebRTCIceTransportBackend();
+
+private:
+ // RTCIceTransportBackend
+ const void* backend() const final { return m_backend.get(); }
+ void registerClient(Client&) final;
+ void unregisterClient() final;
+
+ rtc::scoped_refptr<webrtc::IceTransportInterface> m_backend;
+ RefPtr<LibWebRTCIceTransportBackendObserver> m_observer;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_RTC)
Modified: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp (281795 => 281796)
--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp 2021-08-31 08:39:52 UTC (rev 281795)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp 2021-08-31 09:07:08 UTC (rev 281796)
@@ -598,8 +598,7 @@
callOnMainThread([protectedThis = makeRef(*this), connectionState] {
if (protectedThis->isStopped())
return;
- if (protectedThis->m_peerConnectionBackend.connection().iceConnectionState() != connectionState)
- protectedThis->m_peerConnectionBackend.connection().updateIceConnectionState(connectionState);
+ protectedThis->m_peerConnectionBackend.connection().updateIceConnectionState(connectionState);
});
}
Modified: trunk/Source/WebCore/Sources.txt (281795 => 281796)
--- trunk/Source/WebCore/Sources.txt 2021-08-31 08:39:52 UTC (rev 281795)
+++ trunk/Source/WebCore/Sources.txt 2021-08-31 09:07:08 UTC (rev 281796)
@@ -188,6 +188,7 @@
Modules/mediastream/UserMediaRequest.cpp
Modules/mediastream/libwebrtc/LibWebRTCCertificateGenerator.cpp
Modules/mediastream/libwebrtc/LibWebRTCDtlsTransportBackend.cpp
+Modules/mediastream/libwebrtc/LibWebRTCIceTransportBackend.cpp
Modules/mediastream/libwebrtc/LibWebRTCRtpReceiverTransformBackend.cpp
Modules/mediastream/libwebrtc/LibWebRTCRtpSenderTransformBackend.cpp
Modules/mediastream/libwebrtc/LibWebRTCRtpTransformBackend.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (281795 => 281796)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-08-31 08:39:52 UTC (rev 281795)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-08-31 09:07:08 UTC (rev 281796)
@@ -7812,6 +7812,9 @@
41418A05256660AF00363417 /* RTCEncodedFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RTCEncodedFrame.cpp; sourceTree = "<group>"; };
41418A06256660B000363417 /* RTCEncodedFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCEncodedFrame.h; sourceTree = "<group>"; };
414460A02412994100814BE7 /* MediaSessionIdentifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaSessionIdentifier.h; sourceTree = "<group>"; };
+ 414516DD26CC040D00AAABE0 /* LibWebRTCIceTransportBackend.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = LibWebRTCIceTransportBackend.h; path = libwebrtc/LibWebRTCIceTransportBackend.h; sourceTree = "<group>"; };
+ 414516DF26CC040D00AAABE0 /* LibWebRTCIceTransportBackend.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = LibWebRTCIceTransportBackend.cpp; path = libwebrtc/LibWebRTCIceTransportBackend.cpp; sourceTree = "<group>"; };
+ 414516E026CC042100AAABE0 /* RTCIceTransportBackend.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RTCIceTransportBackend.h; sourceTree = "<group>"; };
414598BE23C8AAB8002B9CC8 /* SampleBufferDisplayLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SampleBufferDisplayLayer.h; sourceTree = "<group>"; };
414598C023C8AD78002B9CC8 /* LocalSampleBufferDisplayLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocalSampleBufferDisplayLayer.h; sourceTree = "<group>"; };
414598C123C8AD79002B9CC8 /* LocalSampleBufferDisplayLayer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LocalSampleBufferDisplayLayer.mm; sourceTree = "<group>"; };
@@ -17240,6 +17243,7 @@
316DCB881E7A6996001B5F87 /* RTCIceTransport.cpp */,
5E6653091DA437BF00FDD84C /* RTCIceTransport.h */,
316DCB891E7A6996001B5F87 /* RTCIceTransport.idl */,
+ 414516E026CC042100AAABE0 /* RTCIceTransportBackend.h */,
316DCB8E1E7A6C79001B5F87 /* RTCIceTransportState.idl */,
073794DC19EE2C5200E5A045 /* RTCOfferAnswerOptions.h */,
316DCB121E78BE43001B5F87 /* RTCOfferAnswerOptions.idl */,
@@ -19354,6 +19358,8 @@
5CDD83401E43253D00621E92 /* LibWebRTCDataChannelHandler.h */,
4188D56426C5530B004858C8 /* LibWebRTCDtlsTransportBackend.cpp */,
4188D56526C5530B004858C8 /* LibWebRTCDtlsTransportBackend.h */,
+ 414516DF26CC040D00AAABE0 /* LibWebRTCIceTransportBackend.cpp */,
+ 414516DD26CC040D00AAABE0 /* LibWebRTCIceTransportBackend.h */,
417612AB1E3A993B00C3D81D /* LibWebRTCMediaEndpoint.cpp */,
417612AC1E3A993B00C3D81D /* LibWebRTCMediaEndpoint.h */,
415A3B732138E264001B4BAA /* LibWebRTCObservers.h */,
Modified: trunk/Source/WebCore/dom/EventNames.h (281795 => 281796)
--- trunk/Source/WebCore/dom/EventNames.h 2021-08-31 08:39:52 UTC (rev 281795)
+++ trunk/Source/WebCore/dom/EventNames.h 2021-08-31 09:07:08 UTC (rev 281796)
@@ -137,6 +137,7 @@
macro(formdata) \
macro(gamepadconnected) \
macro(gamepaddisconnected) \
+ macro(gatheringstatechange) \
macro(gesturechange) \
macro(gestureend) \
macro(gesturescrollend) \
Modified: trunk/Source/WebCore/dom/EventTargetFactory.in (281795 => 281796)
--- trunk/Source/WebCore/dom/EventTargetFactory.in 2021-08-31 08:39:52 UTC (rev 281795)
+++ trunk/Source/WebCore/dom/EventTargetFactory.in 2021-08-31 09:07:08 UTC (rev 281796)
@@ -41,6 +41,7 @@
RTCDataChannel conditional=WEB_RTC
RTCDtlsTransport conditional=WEB_RTC
RTCDTMFSender conditional=WEB_RTC
+RTCIceTransport conditional=WEB_RTC
RTCPeerConnection conditional=WEB_RTC
RTCRtpSFrameTransform conditional=WEB_RTC
RTCRtpScriptTransform conditional=WEB_RTC