Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (248281 => 248282)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2019-08-06 00:31:57 UTC (rev 248281)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2019-08-06 00:34:14 UTC (rev 248282)
@@ -1,3 +1,14 @@
+2019-08-05 Youenn Fablet <[email protected]>
+
+ Support RTCRtpSender.dtmf
+ https://bugs.webkit.org/show_bug.cgi?id=200431
+
+ Reviewed by Eric Carlson.
+
+ * web-platform-tests/webrtc/RTCDTMFSender-insertDTMF.https-expected.txt:
+ * web-platform-tests/webrtc/RTCDTMFSender-ontonechange-long.https-expected.txt:
+ * web-platform-tests/webrtc/RTCDTMFSender-ontonechange.https-expected.txt:
+
2019-07-24 Alicia Boya GarcĂa <[email protected]>
Unreviewed: Added missing expectation file for video_crash_empty_src.html
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCDTMFSender-insertDTMF.https-expected.txt (248281 => 248282)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCDTMFSender-insertDTMF.https-expected.txt 2019-08-06 00:31:57 UTC (rev 248281)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCDTMFSender-insertDTMF.https-expected.txt 2019-08-06 00:34:14 UTC (rev 248282)
@@ -1,10 +1,9 @@
-FAIL insertDTMF() should succeed if tones contains valid DTMF characters promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: RTCDTMFSender"
-FAIL insertDTMF() should throw InvalidCharacterError if tones contains invalid DTMF characters promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: RTCDTMFSender"
-FAIL insertDTMF() should throw InvalidStateError if transceiver is stopped assert_throws: function "() => dtmfSender.insertDTMF('')" threw object "TypeError: undefined is not an object (evaluating 'dtmfSender.insertDTMF')" that is not a DOMException InvalidStateError: property "code" is equal to undefined, expected 11
-FAIL insertDTMF() should throw InvalidStateError if transceiver.currentDirection is recvonly assert_throws: function "() => dtmfSender.insertDTMF('')" threw object "TypeError: undefined is not an object (evaluating 'dtmfSender.insertDTMF')" that is not a DOMException InvalidStateError: property "code" is equal to undefined, expected 11
-FAIL insertDTMF() should throw InvalidStateError if transceiver.currentDirection is inactive assert_throws: function "() => dtmfSender.insertDTMF('')" threw object "TypeError: undefined is not an object (evaluating 'dtmfSender.insertDTMF')" that is not a DOMException InvalidStateError: property "code" is equal to undefined, expected 11
-FAIL insertDTMF() should set toneBuffer to provided tones normalized, with old tones overridden promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: RTCDTMFSender"
-FAIL insertDTMF() after remove and close should reject assert_throws: function "() =>
- dtmfSender.insertDTMF('123')" threw object "TypeError: undefined is not an object (evaluating 'dtmfSender.insertDTMF')" that is not a DOMException InvalidStateError: property "code" is equal to undefined, expected 11
+PASS insertDTMF() should succeed if tones contains valid DTMF characters
+PASS insertDTMF() should throw InvalidCharacterError if tones contains invalid DTMF characters
+PASS insertDTMF() should throw InvalidStateError if transceiver is stopped
+PASS insertDTMF() should throw InvalidStateError if transceiver.currentDirection is recvonly
+PASS insertDTMF() should throw InvalidStateError if transceiver.currentDirection is inactive
+PASS insertDTMF() should set toneBuffer to provided tones normalized, with old tones overridden
+PASS insertDTMF() after remove and close should reject
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCDTMFSender-ontonechange-long.https-expected.txt (248281 => 248282)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCDTMFSender-ontonechange-long.https-expected.txt 2019-08-06 00:31:57 UTC (rev 248281)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCDTMFSender-ontonechange-long.https-expected.txt 2019-08-06 00:34:14 UTC (rev 248282)
@@ -1,3 +1,3 @@
-FAIL insertDTMF with duration greater than 6000 should be clamped to 6000 assert_unreached: Unexpected promise rejection: ReferenceError: Can't find variable: RTCDTMFSender Reached unreachable code
+PASS insertDTMF with duration greater than 6000 should be clamped to 6000
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCDTMFSender-ontonechange.https-expected.txt (248281 => 248282)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCDTMFSender-ontonechange.https-expected.txt 2019-08-06 00:31:57 UTC (rev 248281)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCDTMFSender-ontonechange.https-expected.txt 2019-08-06 00:34:14 UTC (rev 248282)
@@ -1,15 +1,15 @@
-FAIL insertDTMF() with default duration and intertoneGap should fire tonechange events at the expected time assert_unreached: Unexpected promise rejection: ReferenceError: Can't find variable: RTCDTMFSender Reached unreachable code
-FAIL insertDTMF() with explicit duration and intertoneGap should fire tonechange events at the expected time assert_unreached: Unexpected promise rejection: ReferenceError: Can't find variable: RTCDTMFSender Reached unreachable code
-FAIL insertDTMF('') should not fire any tonechange event, including for '' tone assert_unreached: Unexpected promise rejection: ReferenceError: Can't find variable: RTCDTMFSender Reached unreachable code
-FAIL insertDTMF() with duration less than 40 should be clamped to 40 assert_unreached: Unexpected promise rejection: ReferenceError: Can't find variable: RTCDTMFSender Reached unreachable code
-FAIL insertDTMF() with interToneGap less than 30 should be clamped to 30 assert_unreached: Unexpected promise rejection: ReferenceError: Can't find variable: RTCDTMFSender Reached unreachable code
-FAIL insertDTMF with comma should delay next tonechange event for a constant 2000ms assert_unreached: Unexpected promise rejection: ReferenceError: Can't find variable: RTCDTMFSender Reached unreachable code
-FAIL insertDTMF() with transceiver stopped in the middle should stop future tonechange events from firing assert_unreached: Unexpected promise rejection: ReferenceError: Can't find variable: RTCDTMFSender Reached unreachable code
-FAIL Calling insertDTMF() in the middle of tonechange events should cause future tonechanges to be updated to new tones assert_unreached: Unexpected promise rejection: ReferenceError: Can't find variable: RTCDTMFSender Reached unreachable code
-FAIL Calling insertDTMF() multiple times in the middle of tonechange events should cause future tonechanges to be updated the last provided tones assert_unreached: Unexpected promise rejection: ReferenceError: Can't find variable: RTCDTMFSender Reached unreachable code
-FAIL Calling insertDTMF('') in the middle of tonechange events should stop future tonechange events from firing assert_unreached: Unexpected promise rejection: ReferenceError: Can't find variable: RTCDTMFSender Reached unreachable code
-FAIL Setting transceiver.currentDirection to recvonly in the middle of tonechange events should stop future tonechange events from firing undefined is not an object (evaluating 'dtmfSender.addEventListener')
-FAIL Tone change event constructor works Can't find variable: RTCDTMFToneChangeEvent
-FAIL Tone change event with unexpected name should not crash Can't find variable: RTCDTMFToneChangeEvent
+PASS insertDTMF() with default duration and intertoneGap should fire tonechange events at the expected time
+PASS insertDTMF() with explicit duration and intertoneGap should fire tonechange events at the expected time
+PASS insertDTMF('') should not fire any tonechange event, including for '' tone
+PASS insertDTMF() with duration less than 40 should be clamped to 40
+PASS insertDTMF() with interToneGap less than 30 should be clamped to 30
+PASS insertDTMF with comma should delay next tonechange event for a constant 2000ms
+PASS insertDTMF() with transceiver stopped in the middle should stop future tonechange events from firing
+PASS Calling insertDTMF() in the middle of tonechange events should cause future tonechanges to be updated to new tones
+PASS Calling insertDTMF() multiple times in the middle of tonechange events should cause future tonechanges to be updated the last provided tones
+PASS Calling insertDTMF('') in the middle of tonechange events should stop future tonechange events from firing
+FAIL Setting transceiver.currentDirection to recvonly in the middle of tonechange events should stop future tonechange events from firing Cannot insert DTMF
+PASS Tone change event constructor works
+PASS Tone change event with unexpected name should not crash
Modified: trunk/Source/WebCore/ChangeLog (248281 => 248282)
--- trunk/Source/WebCore/ChangeLog 2019-08-06 00:31:57 UTC (rev 248281)
+++ trunk/Source/WebCore/ChangeLog 2019-08-06 00:34:14 UTC (rev 248282)
@@ -1,3 +1,70 @@
+2019-08-05 Youenn Fablet <[email protected]>
+
+ Support RTCRtpSender.dtmf
+ https://bugs.webkit.org/show_bug.cgi?id=200431
+
+ Reviewed by Eric Carlson.
+
+ Add a new backend interface to RTCDTMFSender and implementation of it using libwebrtc.
+ Update RTCDTMFSender to use that new backend and make RTCRtpSender return a RTCDTMFSender
+ conditionally on a newly added runtime flag.
+ Update RTCDTMFSender implementation based on https://w3c.github.io/webrtc-pc/#peer-to-peer-dtmf.
+
+ Covered by rebased tests.
+
+ * Modules/mediastream/PeerConnectionBackend.cpp:
+ (WebCore::PeerConnectionBackend::context const):
+ (WebCore::PeerConnectionBackend::transceiverFromSender):
+ * Modules/mediastream/PeerConnectionBackend.h:
+ * Modules/mediastream/RTCDTMFSender.cpp:
+ (WebCore::RTCDTMFSender::RTCDTMFSender):
+ (WebCore::RTCDTMFSender::canInsertDTMF const):
+ (WebCore::RTCDTMFSender::toneBuffer const):
+ (WebCore::isToneCharacterInvalid):
+ (WebCore::RTCDTMFSender::insertDTMF):
+ (WebCore::RTCDTMFSender::playNextTone):
+ (WebCore::RTCDTMFSender::onTonePlayed):
+ (WebCore::RTCDTMFSender::toneTimerFired):
+ (WebCore::RTCDTMFSender::stop):
+ (WebCore::RTCDTMFSender::activeDOMObjectName const):
+ (WebCore::RTCDTMFSender::canSuspendForDocumentSuspension const):
+ * Modules/mediastream/RTCDTMFSender.h:
+ * Modules/mediastream/RTCDTMFSender.idl:
+ * Modules/mediastream/RTCDTMFToneChangeEvent.cpp:
+ * Modules/mediastream/RTCDTMFToneChangeEvent.h:
+ * Modules/mediastream/RTCDTMFToneChangeEvent.idl:
+ * Modules/mediastream/RTCRtpSender.cpp:
+ (WebCore::RTCRtpSender::dtmf):
+ (WebCore::RTCRtpSender::currentTransceiverDirection const):
+ * Modules/mediastream/RTCRtpSender.h:
+ * Modules/mediastream/RTCRtpSender.idl:
+ * Modules/mediastream/RTCRtpSenderBackend.h:
+ * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp:
+ (WebCore::LibWebRTCRtpSenderBackend::createDTMFBackend):
+ * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h:
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * dom/EventNames.in:
+ * dom/EventTargetFactory.in:
+ * page/RuntimeEnabledFeatures.h:
+ (WebCore::RuntimeEnabledFeatures::webRTCDTMFEnabled const):
+ (WebCore::RuntimeEnabledFeatures::setWebRTCDTMFEnabled):
+ * platform/mediastream/RTCDTMFSenderBackend.h: Added.
+ * platform/mediastream/RTCDTMFSenderHandler.h: Removed.
+ * platform/mediastream/RTCDTMFSenderHandlerClient.h: Removed.
+ * platform/mediastream/libwebrtc/LibWebRTCDTMFSenderBackend.cpp: Added.
+ (WebCore::toWTFString):
+ (WebCore::LibWebRTCDTMFSenderBackend::LibWebRTCDTMFSenderBackend):
+ (WebCore::LibWebRTCDTMFSenderBackend::~LibWebRTCDTMFSenderBackend):
+ (WebCore::LibWebRTCDTMFSenderBackend::canInsertDTMF):
+ (WebCore::LibWebRTCDTMFSenderBackend::playTone):
+ (WebCore::LibWebRTCDTMFSenderBackend::tones const):
+ (WebCore::LibWebRTCDTMFSenderBackend::duration const):
+ (WebCore::LibWebRTCDTMFSenderBackend::interToneGap const):
+ (WebCore::LibWebRTCDTMFSenderBackend::OnToneChange):
+ (WebCore::LibWebRTCDTMFSenderBackend::onTonePlayed):
+ * platform/mediastream/libwebrtc/LibWebRTCDTMFSenderBackend.h: Added.
+
2019-08-05 Saam Barati <[email protected]>
[WHLSL] Inline all native function calls
Modified: trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.cpp (248281 => 248282)
--- trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.cpp 2019-08-06 00:31:57 UTC (rev 248281)
+++ trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.cpp 2019-08-06 00:34:14 UTC (rev 248282)
@@ -561,6 +561,20 @@
#endif
}
+ScriptExecutionContext* PeerConnectionBackend::context() const
+{
+ return m_peerConnection.scriptExecutionContext();
+}
+
+RTCRtpTransceiver* PeerConnectionBackend::transceiverFromSender(const RTCRtpSender& sender)
+{
+ for (auto& transceiver : m_peerConnection.currentTransceivers()) {
+ if (&transceiver->sender() == &sender)
+ return transceiver.get();
+ }
+ return nullptr;
+}
+
#if !RELEASE_LOG_DISABLED
WTFLogChannel& PeerConnectionBackend::logChannel() const
{
Modified: trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.h (248281 => 248282)
--- trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.h 2019-08-06 00:31:57 UTC (rev 248281)
+++ trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.h 2019-08-06 00:34:14 UTC (rev 248282)
@@ -169,6 +169,9 @@
virtual void collectTransceivers() { };
+ ScriptExecutionContext* context() const;
+ RTCRtpTransceiver* transceiverFromSender(const RTCRtpSender&);
+
protected:
void fireICECandidateEvent(RefPtr<RTCIceCandidate>&&, String&& url);
void doneGatheringCandidates();
Modified: trunk/Source/WebCore/Modules/mediastream/RTCDTMFSender.cpp (248281 => 248282)
--- trunk/Source/WebCore/Modules/mediastream/RTCDTMFSender.cpp 2019-08-06 00:31:57 UTC (rev 248281)
+++ trunk/Source/WebCore/Modules/mediastream/RTCDTMFSender.cpp 2019-08-06 00:34:14 UTC (rev 248282)
@@ -26,10 +26,9 @@
#include "config.h"
#include "RTCDTMFSender.h"
-#if ENABLE(WEB_RTC_DTMF)
+#if ENABLE(WEB_RTC)
-#include "MediaStreamTrack.h"
-#include "RTCDTMFSenderHandler.h"
+#include "RTCDTMFSenderBackend.h"
#include "RTCDTMFToneChangeEvent.h"
#include "ScriptExecutionContext.h"
#include <wtf/IsoMallocInlines.h>
@@ -38,20 +37,20 @@
WTF_MAKE_ISO_ALLOCATED_IMPL(RTCDTMFSender);
-static const long minToneDurationMs = 40;
-static const long defaultToneDurationMs = 100;
-static const long maxToneDurationMs = 6000;
-static const long minInterToneGapMs = 30;
-static const long defaultInterToneGapMs = 70;
+static const unsigned long minToneDurationMs = 40;
+static const unsigned long maxToneDurationMs = 6000;
+static const unsigned long minInterToneGapMs = 30;
-RTCDTMFSender::RTCDTMFSender(ScriptExecutionContext& context, RefPtr<MediaStreamTrack>&& track)
+RTCDTMFSender::RTCDTMFSender(ScriptExecutionContext& context, RTCRtpSender& sender, std::unique_ptr<RTCDTMFSenderBackend>&& backend)
: ActiveDOMObject(&context)
- , m_track(WTFMove(track))
- , m_duration(defaultToneDurationMs)
- , m_interToneGap(defaultInterToneGapMs)
- , m_stopped(false)
- , m_scheduledEventTimer(*this, &RTCDTMFSender::scheduledEventTimerFired)
+ , m_toneTimer(*this, &RTCDTMFSender::toneTimerFired)
+ , m_sender(makeWeakPtr(sender))
+ , m_backend(WTFMove(backend))
{
+ m_backend->onTonePlayed([this](const String&) {
+ onTonePlayed();
+ });
+ suspendIfNeeded();
}
RTCDTMFSender::~RTCDTMFSender() = default;
@@ -58,75 +57,99 @@
bool RTCDTMFSender::canInsertDTMF() const
{
- return false;
+ if (!m_sender || m_sender->isStopped())
+ return false;
+
+ auto currentDirection = m_sender->currentTransceiverDirection();
+ if (!currentDirection)
+ return false;
+ if (*currentDirection != RTCRtpTransceiverDirection::Sendrecv && *currentDirection != RTCRtpTransceiverDirection::Sendonly)
+ return false;
+
+ return m_backend && m_backend->canInsertDTMF();
}
-MediaStreamTrack* RTCDTMFSender::track() const
+String RTCDTMFSender::toneBuffer() const
{
- return m_track.get();
+ return m_tones;
}
-String RTCDTMFSender::toneBuffer() const
+static inline bool isToneCharacterInvalid(UChar character)
{
- return { };
+ if (character >= '0' && character <= '9')
+ return false;
+ if (character >= 'A' && character <= 'D')
+ return false;
+ return character != '#' && character != '*' && character != ',';
}
-ExceptionOr<void> RTCDTMFSender::insertDTMF(const String&, Optional<int> duration, Optional<int> interToneGap)
+ExceptionOr<void> RTCDTMFSender::insertDTMF(const String& tones, size_t duration, size_t interToneGap)
{
if (!canInsertDTMF())
- return Exception { NotSupportedError };
+ return Exception { InvalidStateError, "Cannot insert DTMF"_s };
- if (duration && (duration.value() > maxToneDurationMs || duration.value() < minToneDurationMs))
- return Exception { SyntaxError };
+ auto normalizedTones = tones.convertToUppercaseWithoutLocale();
+ if (normalizedTones.find(isToneCharacterInvalid) != notFound)
+ return Exception { InvalidCharacterError, "Tones are not valid"_s };
- if (interToneGap && interToneGap.value() < minInterToneGapMs)
- return Exception { SyntaxError };
+ m_tones = WTFMove(normalizedTones);
+ m_duration = clampTo(duration, minToneDurationMs, maxToneDurationMs);
+ m_interToneGap = std::max(interToneGap, minInterToneGapMs);
- m_duration = duration.valueOr(defaultToneDurationMs);
- m_interToneGap = interToneGap.valueOr(defaultInterToneGapMs);
+ if (m_tones.isEmpty() || m_isPendingPlayoutTask)
+ return { };
- return Exception { SyntaxError };
+ m_isPendingPlayoutTask = true;
+ scriptExecutionContext()->postTask([this, protectedThis = makeRef(*this)](auto&) {
+ playNextTone();
+ });
+ return { };
}
-void RTCDTMFSender::didPlayTone(const String& tone)
+void RTCDTMFSender::playNextTone()
{
- scheduleDispatchEvent(RTCDTMFToneChangeEvent::create(tone));
+ if (m_tones.isEmpty()) {
+ m_isPendingPlayoutTask = false;
+ dispatchEvent(RTCDTMFToneChangeEvent::create({ }));
+ return;
+ }
+
+ if (!canInsertDTMF()) {
+ m_isPendingPlayoutTask = false;
+ return;
+ }
+
+ auto currentTone = m_tones.substring(0, 1);
+ m_tones.remove(0);
+
+ m_backend->playTone(currentTone, m_duration, m_interToneGap);
+ dispatchEvent(RTCDTMFToneChangeEvent::create(currentTone));
}
-void RTCDTMFSender::stop()
+void RTCDTMFSender::onTonePlayed()
{
- m_stopped = true;
+ m_toneTimer.startOneShot(1_ms * m_interToneGap);
}
-const char* RTCDTMFSender::activeDOMObjectName() const
+void RTCDTMFSender::toneTimerFired()
{
- return "RTCDTMFSender";
+ playNextTone();
}
-bool RTCDTMFSender::canSuspendForDocumentSuspension() const
+void RTCDTMFSender::stop()
{
- // FIXME: We should try and do better here.
- return false;
+ m_backend = nullptr;
+ m_toneTimer.stop();
}
-void RTCDTMFSender::scheduleDispatchEvent(Ref<Event>&& event)
+const char* RTCDTMFSender::activeDOMObjectName() const
{
- m_scheduledEvents.append(WTFMove(event));
-
- if (!m_scheduledEventTimer.isActive())
- m_scheduledEventTimer.startOneShot(0_s);
+ return "RTCDTMFSender";
}
-void RTCDTMFSender::scheduledEventTimerFired()
+bool RTCDTMFSender::canSuspendForDocumentSuspension() const
{
- if (m_stopped)
- return;
-
- Vector<Ref<Event>> events;
- events.swap(m_scheduledEvents);
-
- for (auto& event : events)
- dispatchEvent(event);
+ return !m_sender || m_sender->isStopped();
}
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/mediastream/RTCDTMFSender.h (248281 => 248282)
--- trunk/Source/WebCore/Modules/mediastream/RTCDTMFSender.h 2019-08-06 00:31:57 UTC (rev 248281)
+++ trunk/Source/WebCore/Modules/mediastream/RTCDTMFSender.h 2019-08-06 00:34:14 UTC (rev 248282)
@@ -25,7 +25,7 @@
#pragma once
-#if ENABLE(WEB_RTC_DTMF)
+#if ENABLE(WEB_RTC)
#include "ActiveDOMObject.h"
#include "EventTarget.h"
@@ -36,25 +36,25 @@
namespace WebCore {
class MediaStreamTrack;
+class RTCDTMFSenderBackend;
+class RTCRtpSender;
class RTCDTMFSender final : public RefCounted<RTCDTMFSender>, public EventTargetWithInlineData, public ActiveDOMObject {
WTF_MAKE_ISO_ALLOCATED(RTCDTMFSender);
public:
+ static Ref<RTCDTMFSender> create(ScriptExecutionContext& context, RTCRtpSender& sender, std::unique_ptr<RTCDTMFSenderBackend>&& backend) { return adoptRef(* new RTCDTMFSender(context, sender, WTFMove(backend))); }
virtual ~RTCDTMFSender();
bool canInsertDTMF() const;
- MediaStreamTrack* track() const;
String toneBuffer() const;
- int duration() const { return m_duration; }
- int interToneGap() const { return m_interToneGap; }
- ExceptionOr<void> insertDTMF(const String& tones, Optional<int> duration, Optional<int> interToneGap);
+ ExceptionOr<void> insertDTMF(const String& tones, size_t duration, size_t interToneGap);
using RefCounted::ref;
using RefCounted::deref;
private:
- RTCDTMFSender(ScriptExecutionContext&, RefPtr<MediaStreamTrack>&&);
+ RTCDTMFSender(ScriptExecutionContext&, RTCRtpSender&, std::unique_ptr<RTCDTMFSenderBackend>&&);
void stop() final;
const char* activeDOMObjectName() const final;
@@ -66,19 +66,19 @@
void refEventTarget() final { ref(); }
void derefEventTarget() final { deref(); }
- void didPlayTone(const String&);
+ bool isStopped() const { return !m_sender; }
- void scheduleDispatchEvent(Ref<Event>&&);
- void scheduledEventTimerFired();
+ void playNextTone();
+ void onTonePlayed();
+ void toneTimerFired();
- RefPtr<MediaStreamTrack> m_track;
- int m_duration;
- int m_interToneGap;
-
- bool m_stopped;
-
- Timer m_scheduledEventTimer;
- Vector<Ref<Event>> m_scheduledEvents;
+ Timer m_toneTimer;
+ WeakPtr<RTCRtpSender> m_sender;
+ std::unique_ptr<RTCDTMFSenderBackend> m_backend;
+ String m_tones;
+ size_t m_duration;
+ size_t m_interToneGap;
+ bool m_isPendingPlayoutTask { false };
};
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/mediastream/RTCDTMFSender.idl (248281 => 248282)
--- trunk/Source/WebCore/Modules/mediastream/RTCDTMFSender.idl 2019-08-06 00:31:57 UTC (rev 248281)
+++ trunk/Source/WebCore/Modules/mediastream/RTCDTMFSender.idl 2019-08-06 00:34:14 UTC (rev 248282)
@@ -26,21 +26,12 @@
[
ActiveDOMObject,
- Conditional=WEB_RTC_DTMF,
+ Conditional=WEB_RTC,
EnabledAtRuntime=PeerConnection,
] interface RTCDTMFSender : EventTarget {
- // FIXME 169662: change to unsigned long with defaults
- [MayThrowException] void insertDTMF(DOMString tones, optional long duration, optional long interToneGap);
+ [MayThrowException] void insertDTMF(DOMString tones, optional unsigned long duration = 100, optional unsigned long interToneGap = 70);
attribute EventHandler ontonechange;
- readonly attribute DOMString toneBuffer;
- // Legacy
- // FIXME 169662: remove
readonly attribute boolean canInsertDTMF;
- // FIXME 169662: remove
- readonly attribute MediaStreamTrack track;
- // FIXME 169662: remove
- readonly attribute long duration;
- // FIXME 169662: remove
- readonly attribute long interToneGap;
+ readonly attribute DOMString toneBuffer;
};
Modified: trunk/Source/WebCore/Modules/mediastream/RTCDTMFToneChangeEvent.cpp (248281 => 248282)
--- trunk/Source/WebCore/Modules/mediastream/RTCDTMFToneChangeEvent.cpp 2019-08-06 00:31:57 UTC (rev 248281)
+++ trunk/Source/WebCore/Modules/mediastream/RTCDTMFToneChangeEvent.cpp 2019-08-06 00:34:14 UTC (rev 248282)
@@ -26,7 +26,7 @@
#include "config.h"
#include "RTCDTMFToneChangeEvent.h"
-#if ENABLE(WEB_RTC_DTMF)
+#if ENABLE(WEB_RTC)
#include "EventNames.h"
Modified: trunk/Source/WebCore/Modules/mediastream/RTCDTMFToneChangeEvent.h (248281 => 248282)
--- trunk/Source/WebCore/Modules/mediastream/RTCDTMFToneChangeEvent.h 2019-08-06 00:31:57 UTC (rev 248281)
+++ trunk/Source/WebCore/Modules/mediastream/RTCDTMFToneChangeEvent.h 2019-08-06 00:34:14 UTC (rev 248282)
@@ -25,7 +25,7 @@
#pragma once
-#if ENABLE(WEB_RTC_DTMF)
+#if ENABLE(WEB_RTC)
#include "Event.h"
#include <wtf/text/AtomString.h>
Modified: trunk/Source/WebCore/Modules/mediastream/RTCDTMFToneChangeEvent.idl (248281 => 248282)
--- trunk/Source/WebCore/Modules/mediastream/RTCDTMFToneChangeEvent.idl 2019-08-06 00:31:57 UTC (rev 248281)
+++ trunk/Source/WebCore/Modules/mediastream/RTCDTMFToneChangeEvent.idl 2019-08-06 00:34:14 UTC (rev 248282)
@@ -25,7 +25,7 @@
*/
[
- Conditional=WEB_RTC_DTMF,
+ Conditional=WEB_RTC,
Constructor(DOMString type, optional RTCDTMFToneChangeEventInit eventInitDict),
EnabledAtRuntime=PeerConnection,
] interface RTCDTMFToneChangeEvent : Event {
@@ -33,8 +33,8 @@
};
[
- Conditional=WEB_RTC_DTMF,
+ Conditional=WEB_RTC,
EnabledAtRuntime=PeerConnection
] dictionary RTCDTMFToneChangeEventInit : EventInit {
- required DOMString tone;
+ DOMString tone;
};
Modified: trunk/Source/WebCore/Modules/mediastream/RTCRtpSender.cpp (248281 => 248282)
--- trunk/Source/WebCore/Modules/mediastream/RTCRtpSender.cpp 2019-08-06 00:31:57 UTC (rev 248281)
+++ trunk/Source/WebCore/Modules/mediastream/RTCRtpSender.cpp 2019-08-06 00:34:14 UTC (rev 248282)
@@ -33,6 +33,8 @@
#if ENABLE(WEB_RTC)
+#include "RTCDTMFSender.h"
+#include "RTCDTMFSenderBackend.h"
#include "RTCRtpCapabilities.h"
#include "RuntimeEnabledFeatures.h"
#include <wtf/IsoMallocInlines.h>
@@ -62,6 +64,8 @@
ASSERT(!RuntimeEnabledFeatures::sharedFeatures().webRTCUnifiedPlanEnabled() || m_backend);
}
+RTCRtpSender::~RTCRtpSender() = default;
+
void RTCRtpSender::setTrackToNull()
{
ASSERT(m_track);
@@ -135,6 +139,26 @@
return PeerConnectionBackend::senderCapabilities(context, kind);
}
+RTCDTMFSender* RTCRtpSender::dtmf()
+{
+ if (!m_dtmfSender && m_connection && m_connection->context() && m_backend)
+ m_dtmfSender = RTCDTMFSender::create(*m_connection->context(), *this, m_backend->createDTMFBackend());
+
+ return m_dtmfSender.get();
+}
+
+Optional<RTCRtpTransceiverDirection> RTCRtpSender::currentTransceiverDirection() const
+{
+ if (!m_connection)
+ return { };
+
+ auto* transceiver = m_connection->transceiverFromSender(*this);
+ if (!transceiver)
+ return { };
+
+ return transceiver->currentDirection();
+}
+
} // namespace WebCore
#endif // ENABLE(WEB_RTC)
Modified: trunk/Source/WebCore/Modules/mediastream/RTCRtpSender.h (248281 => 248282)
--- trunk/Source/WebCore/Modules/mediastream/RTCRtpSender.h 2019-08-06 00:31:57 UTC (rev 248281)
+++ trunk/Source/WebCore/Modules/mediastream/RTCRtpSender.h 2019-08-06 00:34:14 UTC (rev 248282)
@@ -35,18 +35,22 @@
#include "MediaStreamTrack.h"
#include "PeerConnectionBackend.h"
#include "RTCRtpSenderBackend.h"
+#include "RTCRtpTransceiverDirection.h"
#include "ScriptWrappable.h"
+#include <wtf/WeakPtr.h>
namespace WebCore {
class PeerConnectionBackend;
+class RTCDTMFSender;
struct RTCRtpCapabilities;
-class RTCRtpSender final : public RefCounted<RTCRtpSender>, public ScriptWrappable {
+class RTCRtpSender final : public RefCounted<RTCRtpSender>, public ScriptWrappable, public CanMakeWeakPtr<RTCRtpSender> {
WTF_MAKE_ISO_ALLOCATED(RTCRtpSender);
public:
static Ref<RTCRtpSender> create(PeerConnectionBackend&, Ref<MediaStreamTrack>&&, Vector<String>&& mediaStreamIds, std::unique_ptr<RTCRtpSenderBackend>&&);
static Ref<RTCRtpSender> create(PeerConnectionBackend&, String&& trackKind, Vector<String>&& mediaStreamIds, std::unique_ptr<RTCRtpSenderBackend>&&);
+ ~RTCRtpSender();
static Optional<RTCRtpCapabilities> getCapabilities(ScriptExecutionContext&, const String& kind);
@@ -74,6 +78,9 @@
bool isCreatedBy(const PeerConnectionBackend&) const;
+ RTCDTMFSender* dtmf();
+ Optional<RTCRtpTransceiverDirection> currentTransceiverDirection() const;
+
private:
RTCRtpSender(PeerConnectionBackend&, String&& trackKind, Vector<String>&& mediaStreamIds, std::unique_ptr<RTCRtpSenderBackend>&&);
@@ -83,6 +90,7 @@
Vector<String> m_mediaStreamIds;
std::unique_ptr<RTCRtpSenderBackend> m_backend;
WeakPtr<PeerConnectionBackend> m_connection;
+ RefPtr<RTCDTMFSender> m_dtmfSender;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/mediastream/RTCRtpSender.idl (248281 => 248282)
--- trunk/Source/WebCore/Modules/mediastream/RTCRtpSender.idl 2019-08-06 00:31:57 UTC (rev 248281)
+++ trunk/Source/WebCore/Modules/mediastream/RTCRtpSender.idl 2019-08-06 00:34:14 UTC (rev 248282)
@@ -43,4 +43,6 @@
Promise<void> setParameters(RTCRtpSendParameters parameters);
[CallWith=ScriptExecutionContext] Promise<void> replaceTrack(MediaStreamTrack? withTrack);
Promise<RTCStatsReport> getStats();
+
+ [Conditional=WEB_RTC, EnabledAtRuntime=WebRTCDTMF] readonly attribute RTCDTMFSender? dtmf;
};
Modified: trunk/Source/WebCore/Modules/mediastream/RTCRtpSenderBackend.h (248281 => 248282)
--- trunk/Source/WebCore/Modules/mediastream/RTCRtpSenderBackend.h 2019-08-06 00:31:57 UTC (rev 248281)
+++ trunk/Source/WebCore/Modules/mediastream/RTCRtpSenderBackend.h 2019-08-06 00:34:14 UTC (rev 248282)
@@ -31,6 +31,7 @@
namespace WebCore {
class MediaStreamTrack;
+class RTCDTMFSenderBackend;
class RTCRtpSender;
struct RTCRtpSendParameters;
class ScriptExecutionContext;
@@ -40,6 +41,7 @@
virtual void replaceTrack(ScriptExecutionContext&, RTCRtpSender&, RefPtr<MediaStreamTrack>&&, DOMPromiseDeferred<void>&&) = 0;
virtual RTCRtpSendParameters getParameters() const = 0;
virtual void setParameters(const RTCRtpSendParameters&, DOMPromiseDeferred<void>&&) = 0;
+ virtual std::unique_ptr<RTCDTMFSenderBackend> createDTMFBackend() = 0;
virtual ~RTCRtpSenderBackend() = default;
};
Modified: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp (248281 => 248282)
--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp 2019-08-06 00:31:57 UTC (rev 248281)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp 2019-08-06 00:34:14 UTC (rev 248282)
@@ -27,6 +27,7 @@
#if ENABLE(WEB_RTC) && USE(LIBWEBRTC)
+#include "LibWebRTCDTMFSenderBackend.h"
#include "LibWebRTCPeerConnectionBackend.h"
#include "LibWebRTCUtils.h"
#include "RTCPeerConnection.h"
@@ -145,6 +146,11 @@
promise.resolve();
}
+std::unique_ptr<RTCDTMFSenderBackend> LibWebRTCRtpSenderBackend::createDTMFBackend()
+{
+ return std::make_unique<LibWebRTCDTMFSenderBackend>(m_rtcSender->GetDtmfSender());
+}
+
} // namespace WebCore
#endif // ENABLE(WEB_RTC) && USE(LIBWEBRTC)
Modified: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h (248281 => 248282)
--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h 2019-08-06 00:31:57 UTC (rev 248281)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h 2019-08-06 00:34:14 UTC (rev 248282)
@@ -111,6 +111,7 @@
void replaceTrack(ScriptExecutionContext&, RTCRtpSender&, RefPtr<MediaStreamTrack>&&, DOMPromiseDeferred<void>&&) final;
RTCRtpSendParameters getParameters() const final;
void setParameters(const RTCRtpSendParameters&, DOMPromiseDeferred<void>&&) final;
+ std::unique_ptr<RTCDTMFSenderBackend> createDTMFBackend() final;
WeakPtr<LibWebRTCPeerConnectionBackend> m_peerConnectionBackend;
rtc::scoped_refptr<webrtc::RtpSenderInterface> m_rtcSender;
Modified: trunk/Source/WebCore/Sources.txt (248281 => 248282)
--- trunk/Source/WebCore/Sources.txt 2019-08-06 00:31:57 UTC (rev 248281)
+++ trunk/Source/WebCore/Sources.txt 2019-08-06 00:34:14 UTC (rev 248282)
@@ -1931,6 +1931,7 @@
platform/mediastream/RealtimeVideoSource.cpp
platform/mediastream/libwebrtc/LibWebRTCProvider.cpp
+platform/mediastream/libwebrtc/LibWebRTCDTMFSenderBackend.cpp
platform/mock/DeviceOrientationClientMock.cpp
platform/mock/GeolocationClientMock.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (248281 => 248282)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2019-08-06 00:31:57 UTC (rev 248281)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2019-08-06 00:34:14 UTC (rev 248282)
@@ -166,8 +166,6 @@
078E093A17D16E1C00420AA1 /* MediaConstraints.h in Headers */ = {isa = PBXBuildFile; fileRef = 07221B9917CF0AD400848E51 /* MediaConstraints.h */; settings = {ATTRIBUTES = (Private, ); }; };
078E093C17D16E1C00420AA1 /* RTCDataChannelHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 07221BA217CF0AD400848E51 /* RTCDataChannelHandler.h */; settings = {ATTRIBUTES = (Private, ); }; };
078E093D17D16E1C00420AA1 /* RTCDataChannelHandlerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 07221BA317CF0AD400848E51 /* RTCDataChannelHandlerClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 078E093E17D16E1C00420AA1 /* RTCDTMFSenderHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 07221BA417CF0AD400848E51 /* RTCDTMFSenderHandler.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 078E093F17D16E1C00420AA1 /* RTCDTMFSenderHandlerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 07221BA517CF0AD400848E51 /* RTCDTMFSenderHandlerClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
078E094017D16E1C00420AA1 /* RTCIceCandidateDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 07221BA717CF0AD400848E51 /* RTCIceCandidateDescriptor.h */; settings = {ATTRIBUTES = (Private, ); }; };
078E094217D16E1C00420AA1 /* RTCPeerConnectionHandlerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 07221BAA17CF0AD400848E51 /* RTCPeerConnectionHandlerClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
078E094317D16E1C00420AA1 /* RTCSessionDescriptionDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 07221BAC17CF0AD400848E51 /* RTCSessionDescriptionDescriptor.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -5314,8 +5312,6 @@
07221B9D17CF0AD400848E51 /* MediaStreamPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaStreamPrivate.h; sourceTree = "<group>"; };
07221BA217CF0AD400848E51 /* RTCDataChannelHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCDataChannelHandler.h; sourceTree = "<group>"; };
07221BA317CF0AD400848E51 /* RTCDataChannelHandlerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCDataChannelHandlerClient.h; sourceTree = "<group>"; };
- 07221BA417CF0AD400848E51 /* RTCDTMFSenderHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCDTMFSenderHandler.h; sourceTree = "<group>"; };
- 07221BA517CF0AD400848E51 /* RTCDTMFSenderHandlerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCDTMFSenderHandlerClient.h; sourceTree = "<group>"; };
07221BA617CF0AD400848E51 /* RTCIceCandidateDescriptor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RTCIceCandidateDescriptor.cpp; sourceTree = "<group>"; };
07221BA717CF0AD400848E51 /* RTCIceCandidateDescriptor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCIceCandidateDescriptor.h; sourceTree = "<group>"; };
07221BAA17CF0AD400848E51 /* RTCPeerConnectionHandlerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCPeerConnectionHandlerClient.h; sourceTree = "<group>"; };
@@ -7392,6 +7388,9 @@
41F062130F5F192600A07EAC /* InspectorDatabaseResource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorDatabaseResource.cpp; sourceTree = "<group>"; };
41F1D21D0EF35C2A00DA8753 /* ScriptCachedFrameData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptCachedFrameData.h; sourceTree = "<group>"; };
41F1D21E0EF35C2A00DA8753 /* ScriptCachedFrameData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptCachedFrameData.cpp; sourceTree = "<group>"; };
+ 41F2354422F5503300B4FCDB /* RTCDTMFSenderBackend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCDTMFSenderBackend.h; sourceTree = "<group>"; };
+ 41F2354522F550BE00B4FCDB /* LibWebRTCDTMFSenderBackend.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = LibWebRTCDTMFSenderBackend.cpp; path = libwebrtc/LibWebRTCDTMFSenderBackend.cpp; sourceTree = "<group>"; };
+ 41F2354622F550BF00B4FCDB /* LibWebRTCDTMFSenderBackend.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = LibWebRTCDTMFSenderBackend.h; path = libwebrtc/LibWebRTCDTMFSenderBackend.h; sourceTree = "<group>"; };
41F54F7D1C50C4F600338488 /* FetchBody.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FetchBody.cpp; sourceTree = "<group>"; };
41F54F7E1C50C4F600338488 /* FetchBody.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FetchBody.h; sourceTree = "<group>"; };
41F54F7F1C50C4F600338488 /* FetchBody.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = FetchBody.idl; sourceTree = "<group>"; };
@@ -15845,8 +15844,7 @@
07221BA217CF0AD400848E51 /* RTCDataChannelHandler.h */,
07221BA317CF0AD400848E51 /* RTCDataChannelHandlerClient.h */,
316DE7011E83AE1D0084C261 /* RTCDataChannelState.h */,
- 07221BA417CF0AD400848E51 /* RTCDTMFSenderHandler.h */,
- 07221BA517CF0AD400848E51 /* RTCDTMFSenderHandlerClient.h */,
+ 41F2354422F5503300B4FCDB /* RTCDTMFSenderBackend.h */,
07221BA617CF0AD400848E51 /* RTCIceCandidateDescriptor.cpp */,
07221BA717CF0AD400848E51 /* RTCIceCandidateDescriptor.h */,
313591001E7DDC6000F30630 /* RTCIceConnectionState.h */,
@@ -17658,6 +17656,8 @@
41D51BB21E4E2E8100131A5B /* LibWebRTCAudioFormat.h */,
415080341E3F00AA0051D75D /* LibWebRTCAudioModule.cpp */,
415080351E3F00AA0051D75D /* LibWebRTCAudioModule.h */,
+ 41F2354522F550BE00B4FCDB /* LibWebRTCDTMFSenderBackend.cpp */,
+ 41F2354622F550BF00B4FCDB /* LibWebRTCDTMFSenderBackend.h */,
415747431E38699E00E914D8 /* LibWebRTCMacros.h */,
41A1B00D1E52656E007F3769 /* LibWebRTCProvider.cpp */,
415747441E38699E00E914D8 /* LibWebRTCProvider.h */,
@@ -31325,8 +31325,6 @@
073794FA19F5864E00E5A045 /* RTCDataChannelHandlerMock.h in Headers */,
316DE7021E83AE1D0084C261 /* RTCDataChannelState.h in Headers */,
078E092017D14D1C00420AA1 /* RTCDTMFSender.h in Headers */,
- 078E093E17D16E1C00420AA1 /* RTCDTMFSenderHandler.h in Headers */,
- 078E093F17D16E1C00420AA1 /* RTCDTMFSenderHandlerClient.h in Headers */,
078E092117D14D1C00420AA1 /* RTCDTMFToneChangeEvent.h in Headers */,
078E092317D14D1C00420AA1 /* RTCIceCandidate.h in Headers */,
078E094017D16E1C00420AA1 /* RTCIceCandidateDescriptor.h in Headers */,
Modified: trunk/Source/WebCore/dom/EventNames.in (248281 => 248282)
--- trunk/Source/WebCore/dom/EventNames.in 2019-08-06 00:31:57 UTC (rev 248281)
+++ trunk/Source/WebCore/dom/EventNames.in 2019-08-06 00:34:14 UTC (rev 248282)
@@ -56,7 +56,7 @@
PaymentRequestUpdateEvent conditional=PAYMENT_REQUEST
RTCPeerConnectionIceEvent conditional=WEB_RTC
RTCDataChannelEvent conditional=WEB_RTC
-RTCDTMFToneChangeEvent conditional=WEB_RTC_DTMF
+RTCDTMFToneChangeEvent conditional=WEB_RTC
RTCPeerConnectionIceEvent conditional=WEB_RTC
RTCTrackEvent conditional=WEB_RTC
SpeechSynthesisEvent conditional=SPEECH_SYNTHESIS
Modified: trunk/Source/WebCore/dom/EventTargetFactory.in (248281 => 248282)
--- trunk/Source/WebCore/dom/EventTargetFactory.in 2019-08-06 00:31:57 UTC (rev 248281)
+++ trunk/Source/WebCore/dom/EventTargetFactory.in 2019-08-06 00:34:14 UTC (rev 248282)
@@ -33,7 +33,7 @@
PaymentResponse conditional=PAYMENT_REQUEST
Performance
RTCDataChannel conditional=WEB_RTC
-RTCDTMFSender conditional=WEB_RTC_DTMF
+RTCDTMFSender conditional=WEB_RTC
RTCPeerConnection conditional=WEB_RTC
ServiceWorker conditional=SERVICE_WORKER
ServiceWorkerContainer conditional=SERVICE_WORKER
Modified: trunk/Source/WebCore/page/RuntimeEnabledFeatures.h (248281 => 248282)
--- trunk/Source/WebCore/page/RuntimeEnabledFeatures.h 2019-08-06 00:31:57 UTC (rev 248281)
+++ trunk/Source/WebCore/page/RuntimeEnabledFeatures.h 2019-08-06 00:34:14 UTC (rev 248282)
@@ -223,6 +223,8 @@
#endif
#if ENABLE(WEB_RTC)
+ bool webRTCDTMFEnabled() const { return m_isWebRTCDTMFEnabled; }
+ void setWebRTCDTMFEnabled(bool isEnabled) { m_isWebRTCDTMFEnabled = isEnabled; }
bool webRTCVP8CodecEnabled() const { return m_isWebRTCVP8CodecEnabled; }
void setWebRTCVP8CodecEnabled(bool isEnabled) { m_isWebRTCVP8CodecEnabled = isEnabled; }
bool webRTCUnifiedPlanEnabled() const { return m_isWebRTCUnifiedPlanEnabled; }
@@ -448,6 +450,7 @@
#endif
#if ENABLE(WEB_RTC)
+ bool m_isWebRTCDTMFEnabled { true };
bool m_isWebRTCVP8CodecEnabled { true };
bool m_isWebRTCUnifiedPlanEnabled { true };
bool m_isPeerConnectionEnabled { true };
Copied: trunk/Source/WebCore/platform/mediastream/RTCDTMFSenderBackend.h (from rev 248281, trunk/Source/WebCore/Modules/mediastream/RTCRtpSenderBackend.h) (0 => 248282)
--- trunk/Source/WebCore/platform/mediastream/RTCDTMFSenderBackend.h (rev 0)
+++ trunk/Source/WebCore/platform/mediastream/RTCDTMFSenderBackend.h 2019-08-06 00:34:14 UTC (rev 248282)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2019 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 "ExceptionOr.h"
+#include <wtf/Function.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class RTCDTMFSenderBackend {
+public:
+ virtual bool canInsertDTMF() = 0;
+ virtual void playTone(const String& tone, size_t duration, size_t interToneGap) = 0;
+ virtual void onTonePlayed(Function<void(const String&)>&&) = 0;
+
+ virtual String tones() const = 0;
+ virtual size_t duration() const = 0;
+ virtual size_t interToneGap() const = 0;
+
+ virtual ~RTCDTMFSenderBackend() = default;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_RTC)
Deleted: trunk/Source/WebCore/platform/mediastream/RTCDTMFSenderHandler.h (248281 => 248282)
--- trunk/Source/WebCore/platform/mediastream/RTCDTMFSenderHandler.h 2019-08-06 00:31:57 UTC (rev 248281)
+++ trunk/Source/WebCore/platform/mediastream/RTCDTMFSenderHandler.h 2019-08-06 00:34:14 UTC (rev 248282)
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2013 Google Inc. All rights reserved.
- * 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 GOOGLE INC. ``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 GOOGLE INC. OR
- * 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_DTMF)
-
-#include <wtf/text/WTFString.h>
-
-namespace WebCore {
-
-class RTCDTMFSenderHandlerClient;
-
-class RTCDTMFSenderHandler {
-public:
- virtual ~RTCDTMFSenderHandler() = default;
-
- virtual void setClient(RTCDTMFSenderHandlerClient*) = 0;
-
- virtual String currentToneBuffer() = 0;
-
- virtual bool canInsertDTMF() = 0;
- virtual bool insertDTMF(const String& tones, long duration, long interToneGap) = 0;
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(WEB_RTC)
Deleted: trunk/Source/WebCore/platform/mediastream/RTCDTMFSenderHandlerClient.h (248281 => 248282)
--- trunk/Source/WebCore/platform/mediastream/RTCDTMFSenderHandlerClient.h 2019-08-06 00:31:57 UTC (rev 248281)
+++ trunk/Source/WebCore/platform/mediastream/RTCDTMFSenderHandlerClient.h 2019-08-06 00:34:14 UTC (rev 248282)
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2013 Google Inc. All rights reserved.
- * 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 GOOGLE INC. ``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 GOOGLE INC. OR
- * 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_DTMF)
-
-namespace WebCore {
-
-class RTCDTMFSenderHandlerClient {
-public:
- virtual ~RTCDTMFSenderHandlerClient() = default;
-
- virtual void didPlayTone(const String&) = 0;
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(WEB_RTC)
Added: trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCDTMFSenderBackend.cpp (0 => 248282)
--- trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCDTMFSenderBackend.cpp (rev 0)
+++ trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCDTMFSenderBackend.cpp 2019-08-06 00:34:14 UTC (rev 248282)
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2013 Google 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 GOOGLE INC. ``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 GOOGLE INC. OR
+ * 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 "LibWebRTCDTMFSenderBackend.h"
+
+#if ENABLE(WEB_RTC)
+
+#include <wtf/MainThread.h>
+
+namespace WebCore {
+
+static inline String toWTFString(const std::string& value)
+{
+ return String::fromUTF8(value.data(), value.length());
+}
+
+LibWebRTCDTMFSenderBackend::LibWebRTCDTMFSenderBackend(rtc::scoped_refptr<webrtc::DtmfSenderInterface>&& sender)
+ : m_sender(WTFMove(sender))
+ , m_weakThis(makeWeakPtr(this))
+{
+ m_sender->RegisterObserver(this);
+}
+
+LibWebRTCDTMFSenderBackend::~LibWebRTCDTMFSenderBackend()
+{
+ m_sender->UnregisterObserver();
+}
+
+bool LibWebRTCDTMFSenderBackend::canInsertDTMF()
+{
+ return m_sender->CanInsertDtmf();
+}
+
+void LibWebRTCDTMFSenderBackend::playTone(const String& tone, size_t duration, size_t interToneGap)
+{
+ bool ok = m_sender->InsertDtmf(tone.utf8().data(), duration, interToneGap);
+ ASSERT_UNUSED(ok, ok);
+}
+
+String LibWebRTCDTMFSenderBackend::tones() const
+{
+ return toWTFString(m_sender->tones());
+}
+
+size_t LibWebRTCDTMFSenderBackend::duration() const
+{
+ return m_sender->duration();
+}
+
+size_t LibWebRTCDTMFSenderBackend::interToneGap() const
+{
+ return m_sender->inter_tone_gap();
+}
+
+void LibWebRTCDTMFSenderBackend::OnToneChange(const std::string& tone, const std::string&)
+{
+ // We are just interested in notifying the end of the tone, which corresponds to the empty string.
+ if (!tone.empty())
+ return;
+ callOnMainThread([this, weakThis = m_weakThis, tone = toWTFString(tone)] {
+ if (!weakThis)
+ return;
+ if (m_onTonePlayed)
+ m_onTonePlayed(tone);
+ });
+}
+
+void LibWebRTCDTMFSenderBackend::onTonePlayed(Function<void(const String&)>&& onTonePlayed)
+{
+ m_onTonePlayed = WTFMove(onTonePlayed);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_RTC)
Copied: trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCDTMFSenderBackend.h (from rev 248281, trunk/Source/WebCore/Modules/mediastream/RTCRtpSenderBackend.h) (0 => 248282)
--- trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCDTMFSenderBackend.h (rev 0)
+++ trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCDTMFSenderBackend.h 2019-08-06 00:34:14 UTC (rev 248282)
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2019 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 "RTCDTMFSenderBackend.h"
+#include <wtf/WeakPtr.h>
+
+ALLOW_UNUSED_PARAMETERS_BEGIN
+
+#include <webrtc/api/dtmfsenderinterface.h>
+#include <webrtc/rtc_base/scoped_ref_ptr.h>
+
+ALLOW_UNUSED_PARAMETERS_END
+
+namespace WebCore {
+
+class LibWebRTCDTMFSenderBackend final : public RTCDTMFSenderBackend, private webrtc::DtmfSenderObserverInterface, public CanMakeWeakPtr<LibWebRTCDTMFSenderBackend> {
+public:
+ explicit LibWebRTCDTMFSenderBackend(rtc::scoped_refptr<webrtc::DtmfSenderInterface>&&);
+ ~LibWebRTCDTMFSenderBackend();
+
+private:
+ // RTCDTMFSenderBackend
+ bool canInsertDTMF() final;
+ void playTone(const String& tone, size_t duration, size_t interToneGap) final;
+ void onTonePlayed(Function<void(const String&)>&&) final;
+ String tones() const final;
+ size_t duration() const final;
+ size_t interToneGap() const final;
+
+ // DtmfSenderObserverInterface
+ void OnToneChange(const std::string& tone, const std::string&) final;
+
+ rtc::scoped_refptr<webrtc::DtmfSenderInterface> m_sender;
+ Function<void(const String&)> m_onTonePlayed;
+ WeakPtr<LibWebRTCDTMFSenderBackend> m_weakThis;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_RTC)
Modified: trunk/Source/WebKit/ChangeLog (248281 => 248282)
--- trunk/Source/WebKit/ChangeLog 2019-08-06 00:31:57 UTC (rev 248281)
+++ trunk/Source/WebKit/ChangeLog 2019-08-06 00:34:14 UTC (rev 248282)
@@ -1,3 +1,12 @@
+2019-08-05 Youenn Fablet <[email protected]>
+
+ Support RTCRtpSender.dtmf
+ https://bugs.webkit.org/show_bug.cgi?id=200431
+
+ Reviewed by Eric Carlson.
+
+ * Shared/WebPreferences.yaml:
+
2019-08-05 Simon Fraser <[email protected]>
iOS 13: Overflow:hidden on body prevents PDF scroll
Modified: trunk/Source/WebKit/Shared/WebPreferences.yaml (248281 => 248282)
--- trunk/Source/WebKit/Shared/WebPreferences.yaml 2019-08-06 00:31:57 UTC (rev 248281)
+++ trunk/Source/WebKit/Shared/WebPreferences.yaml 2019-08-06 00:34:14 UTC (rev 248282)
@@ -572,6 +572,15 @@
humanReadableDescription: "Enable WebRTC VP8 codec"
category: experimental
+WebRTCDTMFEnabled:
+ type: bool
+ defaultValue: true
+ webcoreBinding: RuntimeEnabledFeatures
+ condition: ENABLE(WEB_RTC)
+ humanReadableName: "WebRTC DTMF"
+ humanReadableDescription: "Enable WebRTC DTMF"
+ category: experimental
+
WebRTCH264SimulcastEnabled:
type: bool
defaultValue: true