Source: node_modules/kurento-client-elements/lib/RtpEndpoint.js

/* Autogenerated with Kurento Idl */

/*
 * (C) Copyright 2013-2015 Kurento (https://kurento.openvidu.io/)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

var inherits = require('inherits');

var kurentoClient = require('kurento-client');

var disguise = kurentoClient.disguise;

var ChecktypeError = kurentoClient.checkType.ChecktypeError;

var BaseRtpEndpoint = require('kurento-client-core').abstracts.BaseRtpEndpoint;


/**
 * Builder for the {@link RtpEndpoint}
 *
 * @classdesc
 *  Endpoint that provides bidirectional content delivery capabilities through 
 *  the
 *  RTP or SRTP protocols.
 *  <p>
 *    An {@link RtpEndpoint} contains paired sink and source :rom:cls:`MediaPad`
 *    for audio and video. This endpoint inherits from {@link BaseRtpEndpoint}.
 *  </p>
 *  <p>
 *    In order to establish RTP/SRTP communications, peers first engage in an 
 *    SDP
 *    Offer/Answer negotiation process, where one of the peers (the offerer) 
 *    sends
 *    an SDP Offer, while the other peer (the answerer) responds with an SDP 
 *    Answer.
 *    This endpoint can work in both roles.
 *  </p>
 *  <ul>
 *    <li>
 *      <b>As offerer</b>: The negotiation process is initiated by the media 
 *      server.
 *      <ul>
 *        <li>
 *          Kurento generates the SDP Offer through the
 *          <code>generateOffer()</code> method. This offer must then be sent to
 *          remote peer (the answerer) through the signaling channel.
 *        </li>
 *        <li>
 *          The remote peer process the SDP Offer, and generates an SDP Answer. 
 *          This
 *          answer is then sent back to the media server.
 *        </li>
 *        <li>
 *          Upon receiving the SDP Answer, this endpoint must process it with 
 *          the
 *          <code>processAnswer()</code> method.
 *        </li>
 *      </ul>
 *    </li>
 *    <li>
 *      <b>As answerer</b>: The negotiation process is initiated by the remote 
 *      peer.
 *      <ul>
 *        <li>
 *          The remote peer, acting as offerer, generates an SDP Offer and sends
 *          to this endpoint.
 *        </li>
 *        <li>
 *          This endpoint processes the SDP Offer with the
 *          <code>processOffer()</code> method. The result of this method will 
 *          be a
 *          string, containing an SDP Answer.
 *        </li>
 *        <li>
 *          The SDP Answer must then be sent back to the offerer, so it can be
 *          processed by it.
 *        </li>
 *      </ul>
 *    </li>
 *  </ul>
 *  <p>
 *    In case of unidirectional connections (i.e. only one peer is going to send
 *    media), the process is simpler, as only the sender needs to process an SDP
 *    Offer. On top of the information about media codecs and types, the SDP 
 *    must
 *    contain the IP of the remote peer, and the port where it will be 
 *    listening.
 *    This way, the SDP can be mangled without needing to go through the 
 *    exchange
 *    process, as the receiving peer does not need to process any answer.
 *  </p>
 *  <h2>Bitrate management</h2>
 *  <p>
 *    Check the documentation of {@link BaseRtpEndpoint} for detailed 
 *    information
 *    about bitrate management.
 *  </p>
 *
 * @extends module:core/abstracts.BaseRtpEndpoint
 *
 * @constructor module:elements.RtpEndpoint
 *
 * @fires {@link module:elements#event:OnKeySoftLimit OnKeySoftLimit}
 */
function RtpEndpoint(){
  RtpEndpoint.super_.call(this);
};
inherits(RtpEndpoint, BaseRtpEndpoint);


/**
 * @alias module:elements.RtpEndpoint.constructorParams
 *
 * @property {module:elements/complexTypes.SDES} [crypto]
 *  SDES-type param. If present, this parameter indicates that the communication
 *
 * @property {module:core.MediaPipeline} mediaPipeline
 *  the {@link MediaPipeline} to which the endpoint belongs
 *
 * @property {external:Boolean} [useIpv6]
 *  This configures the endpoint to use IPv6 instead of IPv4.
 */
RtpEndpoint.constructorParams = {
  crypto: {
    type: 'kurento.SDES'  },
  mediaPipeline: {
    type: 'kurento.MediaPipeline',
    required: true
  },
  useIpv6: {
    type: 'boolean'  }
};

/**
 * @alias module:elements.RtpEndpoint.events
 *
 * @extends module:core/abstracts.BaseRtpEndpoint.events
 */
RtpEndpoint.events = BaseRtpEndpoint.events.concat(['OnKeySoftLimit']);


/**
 * Checker for {@link module:elements.RtpEndpoint}
 *
 * @memberof module:elements
 *
 * @param {external:String} key
 * @param {module:elements.RtpEndpoint} value
 */
function checkRtpEndpoint(key, value)
{
  if(!(value instanceof RtpEndpoint))
    throw ChecktypeError(key, RtpEndpoint, value);
};


module.exports = RtpEndpoint;

RtpEndpoint.check = checkRtpEndpoint;