Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
michael@0 | 4 | * You can obtain one at http://mozilla.org/MPL/2.0/. |
michael@0 | 5 | * |
michael@0 | 6 | * PeerConnection.js' interface to the C++ PeerConnectionImpl. |
michael@0 | 7 | * |
michael@0 | 8 | * Do not confuse with mozRTCPeerConnection. This interface is purely for |
michael@0 | 9 | * communication between the PeerConnection JS DOM binding and the C++ |
michael@0 | 10 | * implementation in SIPCC. |
michael@0 | 11 | * |
michael@0 | 12 | * See media/webrtc/signaling/include/PeerConnectionImpl.h |
michael@0 | 13 | * |
michael@0 | 14 | */ |
michael@0 | 15 | |
michael@0 | 16 | interface nsISupports; |
michael@0 | 17 | |
michael@0 | 18 | /* Must be created first. Observer events will be dispatched on the thread provided */ |
michael@0 | 19 | [ChromeOnly, Constructor] |
michael@0 | 20 | interface PeerConnectionImpl { |
michael@0 | 21 | /* Must be called first. Observer events dispatched on the thread provided */ |
michael@0 | 22 | [Throws] |
michael@0 | 23 | void initialize(PeerConnectionObserver observer, Window window, |
michael@0 | 24 | RTCConfiguration iceServers, |
michael@0 | 25 | nsISupports thread); |
michael@0 | 26 | /* JSEP calls */ |
michael@0 | 27 | [Throws] |
michael@0 | 28 | void createOffer(optional MediaConstraintsInternal constraints); |
michael@0 | 29 | [Throws] |
michael@0 | 30 | void createAnswer(optional MediaConstraintsInternal constraints); |
michael@0 | 31 | [Throws] |
michael@0 | 32 | void setLocalDescription(long action, DOMString sdp); |
michael@0 | 33 | [Throws] |
michael@0 | 34 | void setRemoteDescription(long action, DOMString sdp); |
michael@0 | 35 | |
michael@0 | 36 | /* Stats call, calls either |onGetStatsSuccess| or |onGetStatsError| on our |
michael@0 | 37 | observer. (see the |PeerConnectionObserver| interface) */ |
michael@0 | 38 | [Throws] |
michael@0 | 39 | void getStats(MediaStreamTrack? selector); |
michael@0 | 40 | |
michael@0 | 41 | /* Adds the stream created by GetUserMedia */ |
michael@0 | 42 | [Throws] |
michael@0 | 43 | void addStream(MediaStream stream, |
michael@0 | 44 | optional MediaConstraintsInternal constraints); |
michael@0 | 45 | [Throws] |
michael@0 | 46 | void removeStream(MediaStream stream); |
michael@0 | 47 | [Throws] |
michael@0 | 48 | void closeStreams(); |
michael@0 | 49 | |
michael@0 | 50 | sequence<MediaStream> getLocalStreams(); |
michael@0 | 51 | sequence<MediaStream> getRemoteStreams(); |
michael@0 | 52 | |
michael@0 | 53 | /* As the ICE candidates roll in this one should be called each time |
michael@0 | 54 | * in order to keep the candidate list up-to-date for the next SDP-related |
michael@0 | 55 | * call PeerConnectionImpl does not parse ICE candidates, just sticks them |
michael@0 | 56 | * into the SDP. |
michael@0 | 57 | */ |
michael@0 | 58 | [Throws] |
michael@0 | 59 | void addIceCandidate(DOMString candidate, DOMString mid, unsigned short level); |
michael@0 | 60 | |
michael@0 | 61 | /* Puts the SIPCC engine back to 'kIdle', shuts down threads, deletes state */ |
michael@0 | 62 | void close(); |
michael@0 | 63 | |
michael@0 | 64 | /* Attributes */ |
michael@0 | 65 | readonly attribute DOMString fingerprint; |
michael@0 | 66 | readonly attribute DOMString localDescription; |
michael@0 | 67 | readonly attribute DOMString remoteDescription; |
michael@0 | 68 | |
michael@0 | 69 | readonly attribute PCImplIceConnectionState iceConnectionState; |
michael@0 | 70 | readonly attribute PCImplIceGatheringState iceGatheringState; |
michael@0 | 71 | readonly attribute PCImplReadyState readyState; |
michael@0 | 72 | readonly attribute PCImplSignalingState signalingState; |
michael@0 | 73 | readonly attribute PCImplSipccState sipccState; |
michael@0 | 74 | |
michael@0 | 75 | /* Data channels */ |
michael@0 | 76 | [Throws] |
michael@0 | 77 | DataChannel createDataChannel(DOMString label, DOMString protocol, |
michael@0 | 78 | unsigned short type, boolean outOfOrderAllowed, |
michael@0 | 79 | unsigned short maxTime, unsigned short maxNum, |
michael@0 | 80 | boolean externalNegotiated, unsigned short stream); |
michael@0 | 81 | [Throws] |
michael@0 | 82 | void connectDataConnection(unsigned short localport, |
michael@0 | 83 | unsigned short remoteport, unsigned short numstreams); |
michael@0 | 84 | }; |