Bug 1032835 - RTCRtpSender webidl. r=smaug

This commit is contained in:
Jan-Ivar Bruaroey 2014-08-13 21:40:41 -04:00
parent 6d8641b53d
commit 39849d0595
7 changed files with 107 additions and 0 deletions

View File

@ -22,6 +22,8 @@ const PC_MANAGER_CONTRACT = "@mozilla.org/dom/peerconnectionmanager;1";
const PC_STATS_CONTRACT = "@mozilla.org/dom/rtcstatsreport;1";
const PC_IDENTITY_CONTRACT = "@mozilla.org/dom/rtcidentityassertion;1";
const PC_STATIC_CONTRACT = "@mozilla.org/dom/peerconnectionstatic;1";
const PC_SENDER_CONTRACT = "@mozilla.org/dom/rtpsender;1";
const PC_RECEIVER_CONTRACT = "@mozilla.org/dom/rtpreceiver;1";
const PC_CID = Components.ID("{00e0e20d-1494-4776-8e0e-0f0acbea3c79}");
const PC_OBS_CID = Components.ID("{d1748d4c-7f6a-4dc5-add6-d55b7678537e}");
@ -31,6 +33,8 @@ const PC_MANAGER_CID = Components.ID("{7293e901-2be3-4c02-b4bd-cbef6fc24f78}");
const PC_STATS_CID = Components.ID("{7fe6e18b-0da3-4056-bf3b-440ef3809e06}");
const PC_IDENTITY_CID = Components.ID("{1abc7499-3c54-43e0-bd60-686e2703f072}");
const PC_STATIC_CID = Components.ID("{0fb47c47-a205-4583-a9fc-cbadf8c95880}");
const PC_SENDER_CID = Components.ID("{4fff5d46-d827-4cd4-a970-8fd53977440e}");
const PC_RECEIVER_CID = Components.ID("{d974b814-8fde-411c-8c45-b86791b81030}");
// Global list of PeerConnection objects, so they can be cleaned up when
// a page is torn down. (Maps inner window ID to an array of PC objects).
@ -1275,12 +1279,44 @@ RTCPeerConnectionStatic.prototype = {
},
};
function RTCRtpSender() {}
RTCRtpSender.prototype = {
classDescription: "RTCRtpSender",
classID: PC_SENDER_CID,
contractID: PC_SENDER_CONTRACT,
QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports,
Ci.nsIDOMGlobalPropertyInitializer]),
init: function(win) { this._win = win; },
__init: function(track) {
this.track = track;
}
};
function RTCRtpReceiver() {}
RTCRtpReceiver.prototype = {
classDescription: "RTCRtpReceiver",
classID: PC_RECEIVER_CID,
contractID: PC_RECEIVER_CONTRACT,
QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports,
Ci.nsIDOMGlobalPropertyInitializer]),
init: function(win) { this._win = win; },
__init: function(track) {
this.track = track;
}
};
this.NSGetFactory = XPCOMUtils.generateNSGetFactory(
[GlobalPCList,
RTCIceCandidate,
RTCSessionDescription,
RTCPeerConnection,
RTCPeerConnectionStatic,
RTCRtpReceiver,
RTCRtpSender,
RTCStatsReport,
RTCIdentityAssertion,
PeerConnectionObserver]

View File

@ -6,6 +6,8 @@ component {7293e901-2be3-4c02-b4bd-cbef6fc24f78} PeerConnection.js
component {7fe6e18b-0da3-4056-bf3b-440ef3809e06} PeerConnection.js
component {1abc7499-3c54-43e0-bd60-686e2703f072} PeerConnection.js
component {0fb47c47-a205-4583-a9fc-cbadf8c95880} PeerConnection.js
component {4fff5d46-d827-4cd4-a970-8fd53977440e} PeerConnection.js
component {d974b814-8fde-411c-8c45-b86791b81030} PeerConnection.js
contract @mozilla.org/dom/peerconnection;1 {00e0e20d-1494-4776-8e0e-0f0acbea3c79}
contract @mozilla.org/dom/peerconnectionobserver;1 {d1748d4c-7f6a-4dc5-add6-d55b7678537e}
@ -15,3 +17,5 @@ contract @mozilla.org/dom/peerconnectionmanager;1 {7293e901-2be3-4c02-b4bd-cbef6
contract @mozilla.org/dom/rtcstatsreport;1 {7fe6e18b-0da3-4056-bf3b-440ef3809e06}
contract @mozilla.org/dom/rtcidentityassertion;1 {1abc7499-3c54-43e0-bd60-686e2703f072}
contract @mozilla.org/dom/peerconnectionstatic;1 {0fb47c47-a205-4583-a9fc-cbadf8c95880}
contract @mozilla.org/dom/rtpsender;1 {4fff5d46-d827-4cd4-a970-8fd53977440e}
contract @mozilla.org/dom/rtpreceiver;1 {d974b814-8fde-411c-8c45-b86791b81030}

View File

@ -0,0 +1,22 @@
/* -*- 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
* http://dev.w3.org/2011/webrtc/editor/webrtc.html#mediastreamevent
*/
dictionary MediaStreamTrackEventInit : EventInit {
MediaStreamTrack? track = null;
RTCRtpReceiver? receiver = null;
MediaStream? stream = null;
};
[Pref="media.peerconnection.enabled",
Constructor(DOMString type, optional MediaStreamTrackEventInit eventInitDict)]
interface MediaStreamTrackEvent : Event {
readonly attribute RTCRtpReceiver? receiver;
readonly attribute MediaStreamTrack? track;
readonly attribute MediaStream? stream;
};

View File

@ -105,11 +105,23 @@ interface mozRTCPeerConnection : EventTarget {
MediaStream? getStreamById (DOMString streamId);
void addStream (MediaStream stream);
void removeStream (MediaStream stream);
// replaces addStream; fails if already added
// because a track can be part of multiple streams, the id parameter
// indicates which particular stream should be referenced in signaling
RTCRtpSender addTrack(MediaStreamTrack track, DOMString streamId);
void removeTrack(RTCRtpSender sender);
sequence<RTCRtpSender> getSenders();
sequence<RTCRtpReceiver> getReceivers();
void close ();
attribute EventHandler onnegotiationneeded;
attribute EventHandler onicecandidate;
attribute EventHandler onsignalingstatechange;
attribute EventHandler onaddstream;
attribute EventHandler onaddtrack; // replaces onaddstream; see AddTrackEvent
attribute EventHandler onremovestream;
attribute EventHandler oniceconnectionstatechange;

View File

@ -0,0 +1,15 @@
/* -*- 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
* http://lists.w3.org/Archives/Public/public-webrtc/2014May/0067.html
*/
[Pref="media.peerconnection.enabled",
JSImplementation="@mozilla.org/dom/rtpreceiver;1",
Constructor (MediaStreamTrack track)]
interface RTCRtpReceiver {
readonly attribute MediaStreamTrack track;
};

View File

@ -0,0 +1,15 @@
/* -*- 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
* http://lists.w3.org/Archives/Public/public-webrtc/2014May/0067.html
*/
[Pref="media.peerconnection.enabled",
JSImplementation="@mozilla.org/dom/rtpsender;1",
Constructor (MediaStreamTrack track)]
interface RTCRtpSender {
readonly attribute MediaStreamTrack track;
};

View File

@ -314,6 +314,8 @@ WEBIDL_FILES = [
'RTCIdentityAssertion.webidl',
'RTCPeerConnection.webidl',
'RTCPeerConnectionStatic.webidl',
'RTCRtpReceiver.webidl',
'RTCRtpSender.webidl',
'RTCSessionDescription.webidl',
'RTCStatsReport.webidl',
'Screen.webidl',
@ -645,6 +647,7 @@ GENERATED_EVENTS_WEBIDL_FILES = [
'HashChangeEvent.webidl',
'IccChangeEvent.webidl',
'MediaStreamEvent.webidl',
'MediaStreamTrackEvent.webidl',
'MozApplicationEvent.webidl',
'MozClirModeEvent.webidl',
'MozContactChangeEvent.webidl',