author Sebastian Hengst <>
Wed, 05 Oct 2016 17:03:06 +0200
changeset 359463 84cb9e48869cfa8126e44df7f5053e2d81e4f796
parent 359452 903fa45a9d6c45fe0a833396d8fae019360798c6
child 359611 492a39e1ca7c299ee74356c8d5937bec78f3e552
permissions -rw-r--r--
Backed out changeset 903fa45a9d6c (bug 1291715) for build bustage. r=backout

/* -*- 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
 * PeerConnection.js' interface to the C++ PeerConnectionImpl.
 * Do not confuse with RTCPeerConnection. This interface is purely for
 * communication between the PeerConnection JS DOM binding and the C++
 * implementation in SIPCC.
 * See media/webrtc/signaling/include/PeerConnectionImpl.h

interface nsISupports;

/* Must be created first. Observer events will be dispatched on the thread provided */
[ChromeOnly, Constructor]
interface PeerConnectionImpl  {
  /* Must be called first. Observer events dispatched on the thread provided */
  void initialize(PeerConnectionObserver observer, Window window,
                  RTCConfiguration iceServers,
                  nsISupports thread);

  /* JSEP calls */
  void createOffer(optional RTCOfferOptions options);
  void createAnswer();
  void setLocalDescription(long action, DOMString sdp);
  void setRemoteDescription(long action, DOMString sdp);

  /* Stats call, calls either |onGetStatsSuccess| or |onGetStatsError| on our
     observer. (see the |PeerConnectionObserver| interface) */
  void getStats(MediaStreamTrack? selector);

  /* Adds the tracks created by GetUserMedia */
  void addTrack(MediaStreamTrack track, MediaStream... streams);
  void removeTrack(MediaStreamTrack track);
  void replaceTrack(MediaStreamTrack thisTrack, MediaStreamTrack withTrack);
  void setParameters(MediaStreamTrack track,
                     optional RTCRtpParameters parameters);
  RTCRtpParameters getParameters(MediaStreamTrack track);
  void closeStreams();

  sequence<MediaStream> getLocalStreams();
  sequence<MediaStream> getRemoteStreams();

  void selectSsrc(MediaStreamTrack recvTrack, unsigned short ssrcIndex);

  /* As the ICE candidates roll in this one should be called each time
   * in order to keep the candidate list up-to-date for the next SDP-related
   * call PeerConnectionImpl does not parse ICE candidates, just sticks them
   * into the SDP.
  void addIceCandidate(DOMString candidate, DOMString mid, unsigned short level);

  /* Puts the SIPCC engine back to 'kIdle', shuts down threads, deletes state */
  void close();

  /* Notify DOM window if this plugin crash is ours. */
  boolean pluginCrash(unsigned long long pluginId, DOMString name);

  /* Attributes */
  /* This provides the implementation with the certificate it uses to
   * authenticate itself.  The JS side must set this before calling
   * createOffer/createAnswer or retrieving the value of fingerprint.  This has
   * to be delayed because generating the certificate takes some time. */
  attribute RTCCertificate certificate;
  readonly attribute DOMString fingerprint;
  readonly attribute DOMString localDescription;
  readonly attribute DOMString remoteDescription;

  readonly attribute PCImplIceConnectionState iceConnectionState;
  readonly attribute PCImplIceGatheringState iceGatheringState;
  readonly attribute PCImplSignalingState signalingState;
  attribute DOMString id;

  attribute DOMString peerIdentity;
  readonly attribute boolean privacyRequested;

  /* Data channels */
  DataChannel createDataChannel(DOMString label, DOMString protocol,
    unsigned short type, boolean outOfOrderAllowed,
    unsigned short maxTime, unsigned short maxNum,
    boolean externalNegotiated, unsigned short stream);