Bug 1291715 - Add RTCDTMFSender and RTCDTMFToneChangeEvent to webidl; r=smaug
authorDan Minor <dminor@mozilla.com>
Wed, 14 Sep 2016 08:53:23 -0400
changeset 359611 492a39e1ca7c299ee74356c8d5937bec78f3e552
parent 359610 ed4bc0d84b0bb24f2c528b3e489ee727d763b0d2
child 359612 a55903b46ff57826cee4ab04c156d1efde99b357
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-beta@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1291715
milestone52.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1291715 - Add RTCDTMFSender and RTCDTMFToneChangeEvent to webidl; r=smaug MozReview-Commit-ID: FvAp6DQex02
dom/events/test/test_all_synthetic_events.html
dom/media/PeerConnection.js
dom/tests/mochitest/general/test_interfaces.html
dom/webidl/PeerConnectionImpl.webidl
dom/webidl/PeerConnectionObserver.webidl
dom/webidl/RTCDTMFSender.webidl
dom/webidl/RTCDTMFToneChangeEvent.webidl
dom/webidl/RTCRtpSender.webidl
dom/webidl/moz.build
media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h
--- a/dom/events/test/test_all_synthetic_events.html
+++ b/dom/events/test/test_all_synthetic_events.html
@@ -439,16 +439,20 @@ const kEventConstructors = {
   RecordErrorEvent:                          { create: function (aName, aProps) {
                                                          return new RecordErrorEvent(aName, aProps);
                                                        },
                                              },
   RTCDataChannelEvent:                       { create: function (aName, aProps) {
                                                          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);
                                                        },
                                              },
   RTCTrackEvent:                             {
                                                // Difficult to test required arguments.
                                              },
   ScrollAreaEvent:                           { create: function (aName, aProps) {
--- a/dom/media/PeerConnection.js
+++ b/dom/media/PeerConnection.js
@@ -1553,16 +1553,19 @@ PeerConnectionObserver.prototype = {
   foundIceCandidate: function(cand) {
     this.dispatchEvent(new this._dompc._win.RTCPeerConnectionIceEvent("icecandidate",
                                                                       { candidate: cand } ));
   },
 
   notifyDataChannel: function(channel) {
     this.dispatchEvent(new this._dompc._win.RTCDataChannelEvent("datachannel",
                                                                 { channel: channel }));
+  },
+
+  onDTMFToneChangeEvent: function(trackId, tone) {
   }
 };
 
 function RTCPeerConnectionStatic() {
 }
 RTCPeerConnectionStatic.prototype = {
   classDescription: "RTCPeerConnectionStatic",
   QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports,
--- a/dom/tests/mochitest/general/test_interfaces.html
+++ b/dom/tests/mochitest/general/test_interfaces.html
@@ -996,16 +996,20 @@ var interfaceNamesInGlobalScope =
     "Response",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "RGBColor",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "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!
     "RTCPeerConnection",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "RTCPeerConnectionIceEvent",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "RTCRtpReceiver",
 // IMPORTANT: Do not change this list without review from a DOM peer!
--- a/dom/webidl/PeerConnectionImpl.webidl
+++ b/dom/webidl/PeerConnectionImpl.webidl
@@ -40,16 +40,22 @@ interface PeerConnectionImpl  {
   void getStats(MediaStreamTrack? selector);
 
   /* Adds the tracks created by GetUserMedia */
   [Throws]
   void addTrack(MediaStreamTrack track, MediaStream... streams);
   [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,
                      optional RTCRtpParameters parameters);
   [Throws]
   RTCRtpParameters getParameters(MediaStreamTrack track);
   [Throws]
   void closeStreams();
--- a/dom/webidl/PeerConnectionObserver.webidl
+++ b/dom/webidl/PeerConnectionObserver.webidl
@@ -39,9 +39,12 @@ interface PeerConnectionObserver
   /* Notification of one of several types of state changed */
   void onStateChange(PCObserverStateType state);
 
   /* Changes to MediaStreamTracks */
   void onAddStream(MediaStream stream);
   void onRemoveStream(MediaStream stream);
   void onAddTrack(MediaStreamTrack track, sequence<MediaStream> streams);
   void onRemoveTrack(MediaStreamTrack track);
+
+  /* DTMF callback */
+  void onDTMFToneChange(DOMString trackId, DOMString tone);
 };
new file mode 100644
--- /dev/null
+++ b/dom/webidl/RTCDTMFSender.webidl
@@ -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;
+};
new file mode 100644
--- /dev/null
+++ b/dom/webidl/RTCDTMFToneChangeEvent.webidl
@@ -0,0 +1,8 @@
+[Constructor(DOMString type, optional RTCDTMFToneChangeEventInit eventInitDict)]
+interface RTCDTMFToneChangeEvent : Event {
+    readonly attribute DOMString tone;
+};
+
+dictionary RTCDTMFToneChangeEventInit : EventInit {
+    DOMString tone = "";
+};
--- a/dom/webidl/RTCRtpSender.webidl
+++ b/dom/webidl/RTCRtpSender.webidl
@@ -68,9 +68,10 @@ dictionary RTCRtpParameters {
 
 [Pref="media.peerconnection.enabled",
  JSImplementation="@mozilla.org/dom/rtpsender;1"]
 interface RTCRtpSender {
   readonly attribute MediaStreamTrack track;
   Promise<void> setParameters (optional RTCRtpParameters parameters);
   RTCRtpParameters getParameters();
   Promise<void> replaceTrack(MediaStreamTrack track);
+  readonly attribute RTCDTMFSender? dtmf;
 };
--- a/dom/webidl/moz.build
+++ b/dom/webidl/moz.build
@@ -644,16 +644,17 @@ if CONFIG['MOZ_WEBRTC']:
         'DataChannel.webidl',
         'MediaStreamList.webidl',
         'PeerConnectionImpl.webidl',
         'PeerConnectionImplEnums.webidl',
         'PeerConnectionObserver.webidl',
         'PeerConnectionObserverEnums.webidl',
         'RTCCertificate.webidl',
         'RTCConfiguration.webidl',
+        'RTCDTMFSender.webidl',
         'RTCIceCandidate.webidl',
         'RTCIdentityAssertion.webidl',
         'RTCIdentityProvider.webidl',
         'RTCPeerConnection.webidl',
         'RTCPeerConnectionStatic.webidl',
         'RTCRtpReceiver.webidl',
         'RTCRtpSender.webidl',
         'RTCSessionDescription.webidl',
@@ -840,16 +841,17 @@ GENERATED_EVENTS_WEBIDL_FILES = [
     'UserProximityEvent.webidl',
     'USSDReceivedEvent.webidl',
     'WebGLContextEvent.webidl',
 ]
 
 if CONFIG['MOZ_WEBRTC']:
     GENERATED_EVENTS_WEBIDL_FILES += [
         'RTCDataChannelEvent.webidl',
+        'RTCDTMFToneChangeEvent.webidl',
         'RTCPeerConnectionIceEvent.webidl',
         'RTCTrackEvent.webidl',
     ]
 
 if CONFIG['MOZ_WEBSPEECH']:
     GENERATED_EVENTS_WEBIDL_FILES += [
         'SpeechRecognitionEvent.webidl',
         'SpeechSynthesisErrorEvent.webidl',
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
@@ -2521,16 +2521,29 @@ PeerConnectionImpl::RemoveTrack(MediaStr
   aTrack.RemovePrincipalChangeObserver(this);
 
   OnNegotiationNeeded();
 
   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) {
   PC_AUTO_ENTER_API_CALL(true);
 
   RefPtr<PeerConnectionObserver> pco = do_QueryObjectReferent(mPCObserver);
   if (!pco) {
     return NS_ERROR_UNEXPECTED;
   }
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h
@@ -74,16 +74,17 @@ class DOMMediaStream;
 #endif
 
 namespace dom {
 class RTCCertificate;
 struct RTCConfiguration;
 struct RTCIceServer;
 struct RTCOfferOptions;
 struct RTCRtpParameters;
+class RTCRtpSender;
 #ifdef USE_FAKE_MEDIA_STREAMS
 typedef Fake_MediaStreamTrack MediaStreamTrack;
 #else
 class MediaStreamTrack;
 #endif
 
 #ifdef USE_FAKE_PCOBSERVER
 typedef test::AFakePCObserver PeerConnectionObserver;
@@ -431,16 +432,29 @@ public:
                                mozilla::dom::MediaStreamTrack& aTrack)
   {
     rv = RemoveTrack(aTrack);
   }
 
   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)
   {
     rv = ReplaceTrack(aThisTrack, aWithTrack);
   }
 
 #if !defined(MOZILLA_EXTERNAL_LINKAGE)