Support RTCRtpSender.dtmf
authoryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Aug 2019 00:34:14 +0000 (00:34 +0000)
committeryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Aug 2019 00:34:14 +0000 (00:34 +0000)
commitc584d4dfe9194334c3854e071b3afd9334833fef
tree9743b904c7f0a953568d38b1ef07c065c1558d0e
parent7c6760c99a35940340925cf5c202c05bea4c286d
Support RTCRtpSender.dtmf
https://bugs.webkit.org/show_bug.cgi?id=200431

Reviewed by Eric Carlson.

LayoutTests/imported/w3c:

* 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:

Source/WebCore:

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.

Source/WebKit:

* Shared/WebPreferences.yaml:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248282 268f45cc-cd09-0410-ab3c-d52691b4dbfc
31 files changed:
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCDTMFSender-insertDTMF.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCDTMFSender-ontonechange-long.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCDTMFSender-ontonechange.https-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediastream/PeerConnectionBackend.cpp
Source/WebCore/Modules/mediastream/PeerConnectionBackend.h
Source/WebCore/Modules/mediastream/RTCDTMFSender.cpp
Source/WebCore/Modules/mediastream/RTCDTMFSender.h
Source/WebCore/Modules/mediastream/RTCDTMFSender.idl
Source/WebCore/Modules/mediastream/RTCDTMFToneChangeEvent.cpp
Source/WebCore/Modules/mediastream/RTCDTMFToneChangeEvent.h
Source/WebCore/Modules/mediastream/RTCDTMFToneChangeEvent.idl
Source/WebCore/Modules/mediastream/RTCRtpSender.cpp
Source/WebCore/Modules/mediastream/RTCRtpSender.h
Source/WebCore/Modules/mediastream/RTCRtpSender.idl
Source/WebCore/Modules/mediastream/RTCRtpSenderBackend.h
Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp
Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h
Source/WebCore/Sources.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/dom/EventNames.in
Source/WebCore/dom/EventTargetFactory.in
Source/WebCore/page/RuntimeEnabledFeatures.h
Source/WebCore/platform/mediastream/RTCDTMFSenderBackend.h [new file with mode: 0644]
Source/WebCore/platform/mediastream/RTCDTMFSenderHandler.h [deleted file]
Source/WebCore/platform/mediastream/RTCDTMFSenderHandlerClient.h [deleted file]
Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCDTMFSenderBackend.cpp [new file with mode: 0644]
Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCDTMFSenderBackend.h [new file with mode: 0644]
Source/WebKit/ChangeLog
Source/WebKit/Shared/WebPreferences.yaml