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

/* Autogenerated with Kurento Idl */

/*
 * (C) Copyright 2013-2015 Kurento (http://kurento.org/)
 *
 * 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 module:elements.RtpEndpoint RtpEndpoint}
 *
 * @classdesc
 *  Endpoint that provides bidirectional content delivery capabilities with 
 *  remote networked peers through RTP or SRTP protocol. An {@link 
 *  module:elements.RtpEndpoint RtpEndpoint} contains paired sink and source 
 *  :rom:cls:`MediaPad` for audio and video. This endpoint inherits from {@link 
 *  module:core/abstracts.BaseRtpEndpoint BaseRtpEndpoint}.
 *        </p>
 *        <p>
 *        In order to establish an RTP/SRTP communication, peers engage in an 
 *        SDP negotiation process, where one of the peers (the offerer) sends an
 *        <ul style='list-style-type:circle'>
 *          <li>
 *            As offerer: The negotiation process is initiated by the media 
 *            server
 *            <ul>
 *              <li>KMS generates the SDP offer through the generateOffer 
 *              method. This offer must then be sent to the remote peer (the 
 *              offeree) through the signaling channel, for processing.</li>
 *              <li>The remote peer process the Offer, and generates an Answer 
 *              to this offer. The Answer is sent back to the media server.</li>
 *              <li>Upon receiving the Answer, the endpoint must invoke the 
 *              processAnswer method.</li>
 *            </ul>
 *          </li>
 *          <li>
 *            As offeree: The negotiation process is initiated by the remote 
 *            peer
 *            <ul>
 *              <li>The remote peer, acting as offerer, generates an SDP offer 
 *              and sends it to the WebRTC endpoint in Kurento.</li>
 *              <li>The endpoint will process the Offer invoking the 
 *              processOffer method. The result of this method will be a string,
 *              <li>The SDP Answer must be sent back to the offerer, so it can 
 *              be processed.</li>
 *            </ul>
 *          </li>
 *        </ul>
 *        </p>
 *        <p>
 *        In case of unidirectional connections (i.e. only one peer is going to 
 *        send media), the process is more simple, as only the emitter needs to 
 *        process an SDP. 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
 *        </p>
 *        <p>
 *        The user can set some bandwidth limits that will be used during the 
 *        negotiation process.
 *        The default bandwidth range of the endpoint is 100kbps-500kbps, but it
 *        <ul style='list-style-type:circle'>
 *          <li>
 *            Input bandwidth control mechanism: Configuration interval used to 
 *            inform remote peer the range of bitrates that can be pushed into 
 *            this RtpEndpoint object. These values are announced in the SDP.
 *            <ul>
 *              <li>
 *                setMaxVideoRecvBandwidth: sets Max bitrate limits expected for
 *              </li>
 *              <li>
 *                setMaxAudioRecvBandwidth: sets Max bitrate limits expected for
 *              </li>
 *            </ul>
 *          </li>
 *          <li>
 *            Output bandwidth control mechanism: Configuration interval used to
 *            <ul>
 *              <li>
 *                setMaxVideoSendBandwidth: sets Max bitrate limits for video 
 *                sent to remote peer.
 *              </li>
 *              <li>
 *                setMinVideoSendBandwidth: sets Min bitrate limits for audio 
 *                sent to remote peer.
 *              </li>
 *            </ul>
 *          </li>
 *        </ul>
 *        All bandwidth control parameters must be changed before the SDP 
 *        negotiation takes place, and can't be modified afterwards.
 *        TODO: What happens if the b=as tag form the SDP has a lower value than
 *        </p>
 *        <p>
 *        Take into consideration that setting a too high upper limit for the 
 *        output bandwidth can be a reason for the local network connection to 
 *        be overflooded.
 *        </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 module:core.MediaPipeline 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;