MediaStream API: Implement DTMF support in RTCPeerConnection
https://bugs.webkit.org/show_bug.cgi?id=106782

Reviewed by Adam Barth.

Source/Platform:

The WebRTC specification have added support for DTMF:
http://dev.w3.org/2011/webrtc/editor/webrtc.html#peer-to-peer-dtmf

Implementation wise this is implemented using the same pattern as RTCDataChannel;
where a RTCDTMFSenderHandler is created by the UA through a new method on
RTCPeerConnectionHandler.

* Platform.gypi:
* chromium/public/WebMediaStreamTrack.h:
(WebMediaStreamTrack):
* chromium/public/WebRTCDTMFSenderHandler.h: Copied from Source/Platform/chromium/public/WebMediaStreamTrack.h.
(WebKit):
(WebRTCDTMFSenderHandler):
(WebKit::WebRTCDTMFSenderHandler::~WebRTCDTMFSenderHandler):
* chromium/public/WebRTCDTMFSenderHandlerClient.h: Copied from Source/Platform/chromium/public/WebMediaStreamTrack.h.
(WebKit):
(WebRTCDTMFSenderHandlerClient):
(WebKit::WebRTCDTMFSenderHandlerClient::~WebRTCDTMFSenderHandlerClient):
* chromium/public/WebRTCPeerConnectionHandler.h:
(WebKit):
(WebKit::WebRTCPeerConnectionHandler::createDTMFSender):

Source/WebCore:

The WebRTC specification have added support for DTMF:
http://dev.w3.org/2011/webrtc/editor/webrtc.html#peer-to-peer-dtmf

Implementation wise this is implemented using the same pattern as RTCDataChannel;
where a RTCDTMFSenderHandler is created by the UA through a new method on
RTCPeerConnectionHandler.

Test: fast/mediastream/RTCPeerConnection-dtmf.html

* CMakeLists.txt:
* GNUmakefile.list.am:
* Modules/mediastream/RTCDTMFSender.cpp: Added.
(WebCore):
(WebCore::RTCDTMFSender::create):
(WebCore::RTCDTMFSender::RTCDTMFSender):
(WebCore::RTCDTMFSender::~RTCDTMFSender):
(WebCore::RTCDTMFSender::canInsertDTMF):
(WebCore::RTCDTMFSender::track):
(WebCore::RTCDTMFSender::toneBuffer):
(WebCore::RTCDTMFSender::insertDTMF):
(WebCore::RTCDTMFSender::didPlayTone):
(WebCore::RTCDTMFSender::interfaceName):
(WebCore::RTCDTMFSender::scriptExecutionContext):
(WebCore::RTCDTMFSender::stop):
(WebCore::RTCDTMFSender::eventTargetData):
(WebCore::RTCDTMFSender::ensureEventTargetData):
(WebCore::RTCDTMFSender::scheduleDispatchEvent):
(WebCore::RTCDTMFSender::scheduledEventTimerFired):
* Modules/mediastream/RTCDTMFSender.h: Added.
(WebCore):
(RTCDTMFSender):
(WebCore::RTCDTMFSender::duration):
(WebCore::RTCDTMFSender::interToneGap):
* Modules/mediastream/RTCDTMFSender.idl: Added.
* Modules/mediastream/RTCDTMFToneChangeEvent.cpp: Copied from Source/Platform/chromium/public/WebMediaStreamTrack.h.
(WebCore):
(WebCore::RTCDTMFToneChangeEvent::create):
(WebCore::RTCDTMFToneChangeEvent::RTCDTMFToneChangeEvent):
(WebCore::RTCDTMFToneChangeEvent::~RTCDTMFToneChangeEvent):
(WebCore::RTCDTMFToneChangeEvent::tone):
(WebCore::RTCDTMFToneChangeEvent::interfaceName):
* Modules/mediastream/RTCDTMFToneChangeEvent.h: Copied from Source/Platform/chromium/public/WebMediaStreamTrack.h.
(WebCore):
(RTCDTMFToneChangeEventInit):
(RTCDTMFToneChangeEvent):
* Modules/mediastream/RTCDTMFToneChangeEvent.idl: Added.
* Modules/mediastream/RTCPeerConnection.cpp:
(WebCore::RTCPeerConnection::createDataChannel):
(WebCore):
(WebCore::RTCPeerConnection::getStreamByTrackId):
(WebCore::RTCPeerConnection::createDTMFSender):
* Modules/mediastream/RTCPeerConnection.h:
(WebCore):
(RTCPeerConnection):
* Modules/mediastream/RTCPeerConnection.idl:
* WebCore.gypi:
* dom/EventNames.h:
(WebCore):
* dom/EventNames.in:
* dom/EventTargetFactory.in:
* platform/chromium/support/WebMediaStreamTrack.cpp:
(WebKit::WebMediaStreamTrack::WebMediaStreamTrack):
(WebKit):
* platform/mediastream/RTCDTMFSenderHandler.h: Copied from Source/Platform/chromium/public/WebMediaStreamTrack.h.
(WebCore):
(RTCDTMFSenderHandler):
(WebCore::RTCDTMFSenderHandler::~RTCDTMFSenderHandler):
* platform/mediastream/RTCDTMFSenderHandlerClient.h: Copied from Source/Platform/chromium/public/WebMediaStreamTrack.h.
(WebCore):
(RTCDTMFSenderHandlerClient):
(WebCore::RTCDTMFSenderHandlerClient::~RTCDTMFSenderHandlerClient):
* platform/mediastream/RTCPeerConnectionHandler.h:
(WebCore):
(RTCPeerConnectionHandler):
* platform/mediastream/chromium/RTCDTMFSenderHandlerChromium.cpp: Copied from Source/Platform/chromium/public/WebMediaStreamTrack.h.
(WebCore):
(WebCore::RTCDTMFSenderHandlerChromium::create):
(WebCore::RTCDTMFSenderHandlerChromium::RTCDTMFSenderHandlerChromium):
(WebCore::RTCDTMFSenderHandlerChromium::~RTCDTMFSenderHandlerChromium):
(WebCore::RTCDTMFSenderHandlerChromium::setClient):
(WebCore::RTCDTMFSenderHandlerChromium::currentToneBuffer):
(WebCore::RTCDTMFSenderHandlerChromium::canInsertDTMF):
(WebCore::RTCDTMFSenderHandlerChromium::insertDTMF):
(WebCore::RTCDTMFSenderHandlerChromium::didPlayTone):
* platform/mediastream/chromium/RTCDTMFSenderHandlerChromium.h: Copied from Source/Platform/chromium/public/WebMediaStreamTrack.h.
(WebCore):
(RTCDTMFSenderHandlerChromium):
* platform/mediastream/chromium/RTCPeerConnectionHandlerChromium.cpp:
(WebCore::RTCPeerConnectionHandlerChromium::createDTMFSender):
(WebCore):
* platform/mediastream/chromium/RTCPeerConnectionHandlerChromium.h:
(RTCPeerConnectionHandlerChromium):

Tools:

Adding Mock functionality for the DTMFSender.

* DumpRenderTree/DumpRenderTree.gypi:
* DumpRenderTree/chromium/MockWebRTCDTMFSenderHandler.cpp: Added.
(DTMFSenderToneTask):
(DTMFSenderToneTask::DTMFSenderToneTask):
(MockWebRTCDTMFSenderHandler::MockWebRTCDTMFSenderHandler):
(MockWebRTCDTMFSenderHandler::setClient):
(MockWebRTCDTMFSenderHandler::currentToneBuffer):
(MockWebRTCDTMFSenderHandler::canInsertDTMF):
(MockWebRTCDTMFSenderHandler::insertDTMF):
* DumpRenderTree/chromium/MockWebRTCDTMFSenderHandler.h: Copied from Source/Platform/chromium/public/WebMediaStreamTrack.h.
(MockWebRTCDTMFSenderHandler):
(MockWebRTCDTMFSenderHandler::taskList):
(MockWebRTCDTMFSenderHandler::clearToneBuffer):
* DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp:
(MockWebRTCPeerConnectionHandler::createDTMFSender):
* DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.h:
(MockWebRTCPeerConnectionHandler):

LayoutTests:

* fast/mediastream/RTCPeerConnection-dtmf-expected.txt: Added.
* fast/mediastream/RTCPeerConnection-dtmf.html: Added.


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