Bug 1291715 - Add RTCDTMFSender and RTCDTMFToneChangeEvent to webidl; r=smaug

MozReview-Commit-ID: FvAp6DQex02

--HG--
extra : rebase_source : 1b8102930efba0fb0da855b02effd106370a1b8b
This commit is contained in:
Dan Minor 2016-09-14 08:53:23 -04:00
parent 1b1a0c7bad
commit 621afd7f92
11 changed files with 77 additions and 0 deletions

View File

@ -444,6 +444,10 @@ const kEventConstructors = {
return new RTCDataChannelEvent(aName, aProps);
},
},
RTCDTMFToneChangeEvent: { create: function (aName, aProps) {
return new RTCDTMFToneChangeEvent(aName, aProps);
},
},
RTCPeerConnectionIceEvent: { create: function (aName, aProps) {
return new RTCPeerConnectionIceEvent(aName, aProps);
},

View File

@ -1558,6 +1558,9 @@ PeerConnectionObserver.prototype = {
notifyDataChannel: function(channel) {
this.dispatchEvent(new this._dompc._win.RTCDataChannelEvent("datachannel",
{ channel: channel }));
},
onDTMFToneChangeEvent: function(trackId, tone) {
}
};

View File

@ -1000,6 +1000,10 @@ var interfaceNamesInGlobalScope =
"RTCCertificate",
// IMPORTANT: Do not change this list without review from a DOM peer!
"RTCDataChannelEvent",
// IMPORTANT: Do not change this list without review from a DOM peer!
"RTCDTMFSender",
// IMPORTANT: Do not change this list without review from a DOM peer!
"RTCDTMFToneChangeEvent",
// IMPORTANT: Do not change this list without review from a DOM peer!
"RTCIceCandidate",
// IMPORTANT: Do not change this list without review from a DOM peer!

View File

@ -45,6 +45,12 @@ interface PeerConnectionImpl {
[Throws]
void removeTrack(MediaStreamTrack track);
[Throws]
void insertDTMF(RTCRtpSender sender, DOMString tones,
optional unsigned long duration = 100,
optional unsigned long interToneGap = 70);
[Throws]
DOMString getDTMFToneBuffer(RTCRtpSender sender);
[Throws]
void replaceTrack(MediaStreamTrack thisTrack, MediaStreamTrack withTrack);
[Throws]
void setParameters(MediaStreamTrack track,

View File

@ -44,4 +44,7 @@ interface PeerConnectionObserver
void onRemoveStream(MediaStream stream);
void onAddTrack(MediaStreamTrack track, sequence<MediaStream> streams);
void onRemoveTrack(MediaStreamTrack track);
/* DTMF callback */
void onDTMFToneChange(DOMString trackId, DOMString tone);
};

View File

@ -0,0 +1,19 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* https://www.w3.org/TR/webrtc/#rtcdtmfsender
*/
[JSImplementation="@mozilla.org/dom/rtcdtmfsender;1"]
interface RTCDTMFSender : EventTarget {
void insertDTMF(DOMString tones,
optional unsigned long duration = 100,
optional unsigned long interToneGap = 70);
attribute EventHandler ontonechange;
readonly attribute DOMString toneBuffer;
readonly attribute unsigned long duration;
readonly attribute unsigned long interToneGap;
};

View File

@ -0,0 +1,8 @@
[Constructor(DOMString type, optional RTCDTMFToneChangeEventInit eventInitDict)]
interface RTCDTMFToneChangeEvent : Event {
readonly attribute DOMString tone;
};
dictionary RTCDTMFToneChangeEventInit : EventInit {
DOMString tone = "";
};

View File

@ -73,4 +73,5 @@ interface RTCRtpSender {
Promise<void> setParameters (optional RTCRtpParameters parameters);
RTCRtpParameters getParameters();
Promise<void> replaceTrack(MediaStreamTrack track);
readonly attribute RTCDTMFSender? dtmf;
};

View File

@ -649,6 +649,7 @@ if CONFIG['MOZ_WEBRTC']:
'PeerConnectionObserverEnums.webidl',
'RTCCertificate.webidl',
'RTCConfiguration.webidl',
'RTCDTMFSender.webidl',
'RTCIceCandidate.webidl',
'RTCIdentityAssertion.webidl',
'RTCIdentityProvider.webidl',
@ -845,6 +846,7 @@ GENERATED_EVENTS_WEBIDL_FILES = [
if CONFIG['MOZ_WEBRTC']:
GENERATED_EVENTS_WEBIDL_FILES += [
'RTCDataChannelEvent.webidl',
'RTCDTMFToneChangeEvent.webidl',
'RTCPeerConnectionIceEvent.webidl',
'RTCTrackEvent.webidl',
]

View File

@ -2525,6 +2525,19 @@ PeerConnectionImpl::RemoveTrack(MediaStreamTrack& aTrack) {
return NS_OK;
}
NS_IMETHODIMP
PeerConnectionImpl::InsertDTMF(mozilla::dom::RTCRtpSender& sender,
const nsAString& tones, uint32_t duration,
uint32_t interToneGap) {
return NS_OK;
}
NS_IMETHODIMP
PeerConnectionImpl::GetDTMFToneBuffer(mozilla::dom::RTCRtpSender& sender,
nsAString& outTones) {
return NS_OK;
}
NS_IMETHODIMP
PeerConnectionImpl::ReplaceTrack(MediaStreamTrack& aThisTrack,
MediaStreamTrack& aWithTrack) {

View File

@ -79,6 +79,7 @@ struct RTCConfiguration;
struct RTCIceServer;
struct RTCOfferOptions;
struct RTCRtpParameters;
class RTCRtpSender;
#ifdef USE_FAKE_MEDIA_STREAMS
typedef Fake_MediaStreamTrack MediaStreamTrack;
#else
@ -436,6 +437,19 @@ public:
nsresult
AddTrack(mozilla::dom::MediaStreamTrack& aTrack, DOMMediaStream& aStream);
NS_IMETHODIMP_TO_ERRORRESULT(InsertDTMF, ErrorResult &rv,
mozilla::dom::RTCRtpSender& sender,
const nsAString& tones, uint32_t duration,
uint32_t interToneGap) {
rv = InsertDTMF(sender, tones, duration, interToneGap);
}
NS_IMETHODIMP_TO_ERRORRESULT(GetDTMFToneBuffer, ErrorResult &rv,
mozilla::dom::RTCRtpSender& sender,
nsAString& outToneBuffer) {
rv = GetDTMFToneBuffer(sender, outToneBuffer);
}
NS_IMETHODIMP_TO_ERRORRESULT(ReplaceTrack, ErrorResult &rv,
mozilla::dom::MediaStreamTrack& aThisTrack,
mozilla::dom::MediaStreamTrack& aWithTrack)