Source: node_modules/kurento-client-core/lib/abstracts/BaseRtpEndpoint.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 checkType      = kurentoClient.checkType;
var ChecktypeError = checkType.ChecktypeError;


var Transaction = kurentoClient.TransactionsManager.Transaction;

var SdpEndpoint = require('./SdpEndpoint');


function noop(error, result) {
  if (error) console.trace(error);

  return result
};


/**
 * @classdesc
 *  Handles RTP communications.
 *  <p>
 *    All endpoints that rely on the RTP protocol, like the
 *    <strong>RtpEndpoint</strong> or the <strong>WebRtcEndpoint</strong>, 
 *    inherit
 *    from this class. The endpoint provides information about the connection 
 *    state
 *    and the media state, which can be consulted at any time through the
 *    {@link module:core/abstracts.BaseRtpEndpoint#mediaState} and the {@link 
 *    module:core/abstracts.BaseRtpEndpoint#connectionState} properties. It is
 *    also possible subscribe to events fired when these properties change.
 *  </p>
 *  <ul>
 *    <li>
 *      ConnectionStateChangedEvent: This event is raised when the connection
 *      between two peers changes. It can have two values:
 *      <ul>
 *        <li>CONNECTED</li>
 *        <li>DISCONNECTED</li>
 *      </ul>
 *    </li>
 *    <li>
 *      MediaStateChangedEvent: Based on RTCP packet flow, this event provides 
 *      more
 *      reliable information about the state of media flow. Since RTCP packets 
 *      are
 *      not flowing at a constant rate (minimizing a browser with an
 *      RTCPeerConnection might affect this interval, for instance), there is a
 *      guard period of about 5s. This traduces in a period where there might be
 *      media flowing, but the event hasn't been fired yet. Nevertheless, this 
 *      is
 *      the most reliable and useful way of knowing what the state of media 
 *      exchange
 *      is. Possible values are:
 *      <ul>
 *        <li>CONNECTED: There is an RTCP packet flow between peers.</li>
 *        <li>
 *          DISCONNECTED: No RTCP packets have been received, or at least 5s 
 *          have
 *          passed since the last packet arrived.
 *        </li>
 *      </ul>
 *    </li>
 *  </ul>
 *  <p>
 *    Part of the bandwidth control of the video component of the media session 
 *    is
 *    done here:
 *  </p>
 *  <ul>
 *    <li>
 *      Input bandwidth: Configuration value used to inform remote peers about 
 *      the
 *      bitrate that can be pushed into this endpoint.
 *      <ul>
 *        <li>
 *          <strong>{get,set}MinVideoRecvBandwidth</strong>: Minimum bitrate
 *          requested on the received video stream.
 *        </li>
 *        <li>
 *          <strong>{get,set}Max{Audio,Video}RecvBandwidth</strong>: Maximum 
 *          bitrate
 *          expected for the received stream.
 *        </li>
 *      </ul>
 *    </li>
 *    <li>
 *      Output bandwidth: Configuration values used to control bitrate of the 
 *      output
 *      video stream sent to remote peers. It is important to keep in mind that
 *      pushed bitrate depends on network and remote peer capabilities. Remote 
 *      peers
 *      can also announce bandwidth limitation in their SDPs (through the
 *      <code>b={modifier}:{value}</code> tag). Kurento will always enforce 
 *      bitrate
 *      limitations specified by the remote peer over internal configurations.
 *      <ul>
 *        <li>
 *          <strong>{get,set}MinVideoSendBandwidth</strong>: Minimum video 
 *          bitrate
 *          sent to remote peer.
 *        </li>
 *        <li>
 *          <strong>{get,set}MaxVideoSendBandwidth</strong>: Maximum video 
 *          bitrate
 *          sent to remote peer.
 *        </li>
 *        <li>
 *          <strong>RembParams.rembOnConnect</strong>: Initial local REMB 
 *          bandwidth
 *          estimation that gets propagated when a new endpoint is connected.
 *        </li>
 *      </ul>
 *    </li>
 *  </ul>
 *  <p>
 *    <strong>
 *      All bandwidth control parameters must be changed before the SDP 
 *      negotiation
 *      takes place, and can't be changed afterwards.
 *    </strong>
 *  </p>
 *
 * @abstract
 * @extends module:core/abstracts.SdpEndpoint
 *
 * @constructor module:core/abstracts.BaseRtpEndpoint
 *
 * @fires {@link module:core#event:ConnectionStateChanged ConnectionStateChanged}
 * @fires {@link module:core#event:MediaStateChanged MediaStateChanged}
 */
function BaseRtpEndpoint(){
  BaseRtpEndpoint.super_.call(this);
};
inherits(BaseRtpEndpoint, SdpEndpoint);


//
// Public properties
//

/**
 * Connection state.
 * <ul>
 *   <li>CONNECTED</li>
 *   <li>DISCONNECTED</li>
 * </ul>
 *
 * @alias module:core/abstracts.BaseRtpEndpoint#getConnectionState
 *
 * @param {module:core/abstracts.BaseRtpEndpoint~getConnectionStateCallback} [callback]
 *
 * @return {external:Promise}
 */
BaseRtpEndpoint.prototype.getConnectionState = function(callback){
  var transaction = (arguments[0] instanceof Transaction)
                  ? Array.prototype.shift.apply(arguments)
                  : undefined;

  var usePromise = false;
  
  if (callback == undefined) {
    usePromise = true;
  }
  
  if(!arguments.length) callback = undefined;

  callback = (callback || noop).bind(this)

  return disguise(this._invoke(transaction, 'getConnectionState', callback), this)
};
/**
 * @callback module:core/abstracts.BaseRtpEndpoint~getConnectionStateCallback
 * @param {external:Error} error
 * @param {module:core/complexTypes.ConnectionState} result
 */

/**
 * Maximum video bitrate sent to remote peer.
 * <p>
 *   With this parameter you can control the maximum video quality that will be
 *   sent when reacting to good network conditions. Setting this parameter to a
 *   high value permits the video quality to raise when the network conditions 
 *   get
 *   better.
 * </p>
 * <p>
 *   This parameter provides a way to limit the bitrate requested by remote REMB
 *   bandwidth estimations: the bitrate sent will be always equal or less than
 *   this parameter, even if the remote peer requests higher bitrates.
 * </p>
 * <p>
 *   Note that the default value of <strong>500 kbps</strong> is a VERY
 *   conservative one, and leads to a low maximum video quality. Most 
 *   applications
 *   will probably want to increase this parameter to higher values such as 2000
 *   mbps) or even 10000 (10 mbps).
 * </p>
 * <p>
 *   The REMB congestion control algorithm works by gradually increasing the 
 *   output
 *   video bitrate, until the available bandwidth is fully used or the maximum 
 *   send
 *   bitrate has been reached. This is a slow, progressive change, which starts 
 *   at
 *   300 kbps by default. You can change the default starting point of REMB
 *   estimations, by setting <code>RembParams.rembOnConnect</code>.
 * </p>
 * <ul>
 *   <li>Unit: kbps (kilobits per second).</li>
 *   <li>Default: 500.</li>
 *   <li>
 *     0 = unconstrained: the video bitrate will grow until all the available
 *     network bandwidth is used by the stream.<br />
 *     Note that this might have a bad effect if more than one stream is running
 *     (as all of them would try to raise the video bitrate indefinitely, until 
 *     the
 *     network gets saturated).
 *   </li>
 * </ul>
 *
 * @alias module:core/abstracts.BaseRtpEndpoint#getMaxVideoSendBandwidth
 *
 * @param {module:core/abstracts.BaseRtpEndpoint~getMaxVideoSendBandwidthCallback} [callback]
 *
 * @return {external:Promise}
 */
BaseRtpEndpoint.prototype.getMaxVideoSendBandwidth = function(callback){
  var transaction = (arguments[0] instanceof Transaction)
                  ? Array.prototype.shift.apply(arguments)
                  : undefined;

  var usePromise = false;
  
  if (callback == undefined) {
    usePromise = true;
  }
  
  if(!arguments.length) callback = undefined;

  callback = (callback || noop).bind(this)

  return disguise(this._invoke(transaction, 'getMaxVideoSendBandwidth', callback), this)
};
/**
 * @callback module:core/abstracts.BaseRtpEndpoint~getMaxVideoSendBandwidthCallback
 * @param {external:Error} error
 * @param {external:Integer} result
 */

/**
 * Maximum video bitrate sent to remote peer.
 * <p>
 *   With this parameter you can control the maximum video quality that will be
 *   sent when reacting to good network conditions. Setting this parameter to a
 *   high value permits the video quality to raise when the network conditions 
 *   get
 *   better.
 * </p>
 * <p>
 *   This parameter provides a way to limit the bitrate requested by remote REMB
 *   bandwidth estimations: the bitrate sent will be always equal or less than
 *   this parameter, even if the remote peer requests higher bitrates.
 * </p>
 * <p>
 *   Note that the default value of <strong>500 kbps</strong> is a VERY
 *   conservative one, and leads to a low maximum video quality. Most 
 *   applications
 *   will probably want to increase this parameter to higher values such as 2000
 *   mbps) or even 10000 (10 mbps).
 * </p>
 * <p>
 *   The REMB congestion control algorithm works by gradually increasing the 
 *   output
 *   video bitrate, until the available bandwidth is fully used or the maximum 
 *   send
 *   bitrate has been reached. This is a slow, progressive change, which starts 
 *   at
 *   300 kbps by default. You can change the default starting point of REMB
 *   estimations, by setting <code>RembParams.rembOnConnect</code>.
 * </p>
 * <ul>
 *   <li>Unit: kbps (kilobits per second).</li>
 *   <li>Default: 500.</li>
 *   <li>
 *     0 = unconstrained: the video bitrate will grow until all the available
 *     network bandwidth is used by the stream.<br />
 *     Note that this might have a bad effect if more than one stream is running
 *     (as all of them would try to raise the video bitrate indefinitely, until 
 *     the
 *     network gets saturated).
 *   </li>
 * </ul>
 *
 * @alias module:core/abstracts.BaseRtpEndpoint#setMaxVideoSendBandwidth
 *
 * @param {external:Integer} maxVideoSendBandwidth
 * @param {module:core/abstracts.BaseRtpEndpoint~setMaxVideoSendBandwidthCallback} [callback]
 *
 * @return {external:Promise}
 */
BaseRtpEndpoint.prototype.setMaxVideoSendBandwidth = function(maxVideoSendBandwidth, callback){
  var transaction = (arguments[0] instanceof Transaction)
                  ? Array.prototype.shift.apply(arguments)
                  : undefined;

  //  
  // checkType('int', 'maxVideoSendBandwidth', maxVideoSendBandwidth, {required: true});
  //  

  var params = {
    maxVideoSendBandwidth: maxVideoSendBandwidth
  };

  callback = (callback || noop).bind(this)

  return disguise(this._invoke(transaction, 'setMaxVideoSendBandwidth', params, callback), this)
};
/**
 * @callback module:core/abstracts.BaseRtpEndpoint~setMaxVideoSendBandwidthCallback
 * @param {external:Error} error
 */

/**
 * Media flow state.
 * <ul>
 *   <li>CONNECTED: There is an RTCP flow.</li>
 *   <li>DISCONNECTED: No RTCP packets have been received for at least 5 
 *   sec.</li>
 * </ul>
 *
 * @alias module:core/abstracts.BaseRtpEndpoint#getMediaState
 *
 * @param {module:core/abstracts.BaseRtpEndpoint~getMediaStateCallback} [callback]
 *
 * @return {external:Promise}
 */
BaseRtpEndpoint.prototype.getMediaState = function(callback){
  var transaction = (arguments[0] instanceof Transaction)
                  ? Array.prototype.shift.apply(arguments)
                  : undefined;

  var usePromise = false;
  
  if (callback == undefined) {
    usePromise = true;
  }
  
  if(!arguments.length) callback = undefined;

  callback = (callback || noop).bind(this)

  return disguise(this._invoke(transaction, 'getMediaState', callback), this)
};
/**
 * @callback module:core/abstracts.BaseRtpEndpoint~getMediaStateCallback
 * @param {external:Error} error
 * @param {module:core/complexTypes.MediaState} result
 */

/**
 * Minimum bitrate requested on the received video stream.
 * <p>
 *   This is used to set a minimum value of local REMB during bandwidth 
 *   estimation,
 *   if supported by the implementing class. The REMB estimation will then be 
 *   sent
 *   to remote peers, requesting them to send at least the indicated video 
 *   bitrate.
 *   It follows that min values will only have effect in remote peers that 
 *   support
 *   this congestion control mechanism, such as Chrome.
 * </p>
 * <ul>
 *   <li>Unit: kbps (kilobits per second).</li>
 *   <li>Default: 0.</li>
 *   <li>
 *     Note: The absolute minimum REMB value is 30 kbps, even if a lower value 
 *     is
 *     set here.
 *   </li>
 * </ul>
 *
 * @alias module:core/abstracts.BaseRtpEndpoint#getMinVideoRecvBandwidth
 *
 * @param {module:core/abstracts.BaseRtpEndpoint~getMinVideoRecvBandwidthCallback} [callback]
 *
 * @return {external:Promise}
 */
BaseRtpEndpoint.prototype.getMinVideoRecvBandwidth = function(callback){
  var transaction = (arguments[0] instanceof Transaction)
                  ? Array.prototype.shift.apply(arguments)
                  : undefined;

  var usePromise = false;
  
  if (callback == undefined) {
    usePromise = true;
  }
  
  if(!arguments.length) callback = undefined;

  callback = (callback || noop).bind(this)

  return disguise(this._invoke(transaction, 'getMinVideoRecvBandwidth', callback), this)
};
/**
 * @callback module:core/abstracts.BaseRtpEndpoint~getMinVideoRecvBandwidthCallback
 * @param {external:Error} error
 * @param {external:Integer} result
 */

/**
 * Minimum bitrate requested on the received video stream.
 * <p>
 *   This is used to set a minimum value of local REMB during bandwidth 
 *   estimation,
 *   if supported by the implementing class. The REMB estimation will then be 
 *   sent
 *   to remote peers, requesting them to send at least the indicated video 
 *   bitrate.
 *   It follows that min values will only have effect in remote peers that 
 *   support
 *   this congestion control mechanism, such as Chrome.
 * </p>
 * <ul>
 *   <li>Unit: kbps (kilobits per second).</li>
 *   <li>Default: 0.</li>
 *   <li>
 *     Note: The absolute minimum REMB value is 30 kbps, even if a lower value 
 *     is
 *     set here.
 *   </li>
 * </ul>
 *
 * @alias module:core/abstracts.BaseRtpEndpoint#setMinVideoRecvBandwidth
 *
 * @param {external:Integer} minVideoRecvBandwidth
 * @param {module:core/abstracts.BaseRtpEndpoint~setMinVideoRecvBandwidthCallback} [callback]
 *
 * @return {external:Promise}
 */
BaseRtpEndpoint.prototype.setMinVideoRecvBandwidth = function(minVideoRecvBandwidth, callback){
  var transaction = (arguments[0] instanceof Transaction)
                  ? Array.prototype.shift.apply(arguments)
                  : undefined;

  //  
  // checkType('int', 'minVideoRecvBandwidth', minVideoRecvBandwidth, {required: true});
  //  

  var params = {
    minVideoRecvBandwidth: minVideoRecvBandwidth
  };

  callback = (callback || noop).bind(this)

  return disguise(this._invoke(transaction, 'setMinVideoRecvBandwidth', params, callback), this)
};
/**
 * @callback module:core/abstracts.BaseRtpEndpoint~setMinVideoRecvBandwidthCallback
 * @param {external:Error} error
 */

/**
 * Minimum video bitrate sent to remote peer.
 * <p>
 *   With this parameter you can control the minimum video quality that will be
 *   sent when reacting to bad network conditions. Setting this parameter to a 
 *   low
 *   value permits the video quality to drop when the network conditions get 
 *   worse.
 * </p>
 * <p>
 *   This parameter provides a way to override the bitrate requested by remote 
 *   REMB
 *   bandwidth estimations: the bitrate sent will be always equal or greater 
 *   than
 *   this parameter, even if the remote peer requests even lower bitrates.
 * </p>
 * <p>
 *   Note that if you set this parameter too high (trying to avoid bad video
 *   quality altogether), you would be limiting the adaptation ability of the
 *   congestion control algorithm, and your stream might be unable to ever 
 *   recover
 *   from adverse network conditions.
 * </p>
 * <ul>
 *   <li>Unit: kbps (kilobits per second).</li>
 *   <li>Default: 100.</li>
 *   <li>
 *     0 = unconstrained: the video bitrate will drop as needed, even to the
 *     lowest possible quality, which might make the video completely blurry and
 *     pixelated.
 *   </li>
 * </ul>
 *
 * @alias module:core/abstracts.BaseRtpEndpoint#getMinVideoSendBandwidth
 *
 * @param {module:core/abstracts.BaseRtpEndpoint~getMinVideoSendBandwidthCallback} [callback]
 *
 * @return {external:Promise}
 */
BaseRtpEndpoint.prototype.getMinVideoSendBandwidth = function(callback){
  var transaction = (arguments[0] instanceof Transaction)
                  ? Array.prototype.shift.apply(arguments)
                  : undefined;

  var usePromise = false;
  
  if (callback == undefined) {
    usePromise = true;
  }
  
  if(!arguments.length) callback = undefined;

  callback = (callback || noop).bind(this)

  return disguise(this._invoke(transaction, 'getMinVideoSendBandwidth', callback), this)
};
/**
 * @callback module:core/abstracts.BaseRtpEndpoint~getMinVideoSendBandwidthCallback
 * @param {external:Error} error
 * @param {external:Integer} result
 */

/**
 * Minimum video bitrate sent to remote peer.
 * <p>
 *   With this parameter you can control the minimum video quality that will be
 *   sent when reacting to bad network conditions. Setting this parameter to a 
 *   low
 *   value permits the video quality to drop when the network conditions get 
 *   worse.
 * </p>
 * <p>
 *   This parameter provides a way to override the bitrate requested by remote 
 *   REMB
 *   bandwidth estimations: the bitrate sent will be always equal or greater 
 *   than
 *   this parameter, even if the remote peer requests even lower bitrates.
 * </p>
 * <p>
 *   Note that if you set this parameter too high (trying to avoid bad video
 *   quality altogether), you would be limiting the adaptation ability of the
 *   congestion control algorithm, and your stream might be unable to ever 
 *   recover
 *   from adverse network conditions.
 * </p>
 * <ul>
 *   <li>Unit: kbps (kilobits per second).</li>
 *   <li>Default: 100.</li>
 *   <li>
 *     0 = unconstrained: the video bitrate will drop as needed, even to the
 *     lowest possible quality, which might make the video completely blurry and
 *     pixelated.
 *   </li>
 * </ul>
 *
 * @alias module:core/abstracts.BaseRtpEndpoint#setMinVideoSendBandwidth
 *
 * @param {external:Integer} minVideoSendBandwidth
 * @param {module:core/abstracts.BaseRtpEndpoint~setMinVideoSendBandwidthCallback} [callback]
 *
 * @return {external:Promise}
 */
BaseRtpEndpoint.prototype.setMinVideoSendBandwidth = function(minVideoSendBandwidth, callback){
  var transaction = (arguments[0] instanceof Transaction)
                  ? Array.prototype.shift.apply(arguments)
                  : undefined;

  //  
  // checkType('int', 'minVideoSendBandwidth', minVideoSendBandwidth, {required: true});
  //  

  var params = {
    minVideoSendBandwidth: minVideoSendBandwidth
  };

  callback = (callback || noop).bind(this)

  return disguise(this._invoke(transaction, 'setMinVideoSendBandwidth', params, callback), this)
};
/**
 * @callback module:core/abstracts.BaseRtpEndpoint~setMinVideoSendBandwidthCallback
 * @param {external:Error} error
 */

/**
 * Maximum Transmission Unit (MTU) used for RTP.
 * <p>
 *   This setting affects the maximum size that will be used by RTP payloads. 
 *   You
 *   can change it from the default, if you think that a different value would 
 *   be
 *   beneficial for the typical network settings of your application.
 * </p>
 * <p>
 *   The default value is 1200 Bytes. This is the same as in <b>libwebrtc</b> 
 *   (from
 *   webrtc.org), as used by
 *   <a
 *     href='https://dxr.mozilla.org/mozilla-central/rev/b5c5ba07d3dbd0d07b66fa42a103f4df2c27d3a2/media/webrtc/trunk/webrtc/media/engine/constants.cc#16'
 *     >Firefox</a
 *   >
 *   or
 *   <a
 *     href='https://codesearch.chromium.org/chromium/src/third_party/webrtc/media/engine/constants.cc?l=15&rcl=6dd488b2e55125644263e4837f1abd950d5e410d'
 *     >Chrome</a
 *   >
 *   . You can read more about this value in
 *   <a
 *     href='https://groups.google.com/d/topic/discuss-webrtc/gH5ysR3SoZI/discussion'
 *     >Why RTP max packet size is 1200 in WebRTC?</a
 *   >
 *   .
 * </p>
 * <p>
 *   <b>WARNING</b>: Change this value ONLY if you really know what you are 
 *   doing
 *   and you have strong reasons to do so. Do NOT change this parameter just
 *   because it <i>seems</i> to work better for some reduced scope tests. The
 *   default value is a consensus chosen by people who have deep knowledge about
 *   network optimization.
 * </p>
 * <ul>
 *   <li>Unit: Bytes.</li>
 *   <li>Default: 1200.</li>
 * </ul>
 *
 * @alias module:core/abstracts.BaseRtpEndpoint#getMtu
 *
 * @param {module:core/abstracts.BaseRtpEndpoint~getMtuCallback} [callback]
 *
 * @return {external:Promise}
 */
BaseRtpEndpoint.prototype.getMtu = function(callback){
  var transaction = (arguments[0] instanceof Transaction)
                  ? Array.prototype.shift.apply(arguments)
                  : undefined;

  var usePromise = false;
  
  if (callback == undefined) {
    usePromise = true;
  }
  
  if(!arguments.length) callback = undefined;

  callback = (callback || noop).bind(this)

  return disguise(this._invoke(transaction, 'getMtu', callback), this)
};
/**
 * @callback module:core/abstracts.BaseRtpEndpoint~getMtuCallback
 * @param {external:Error} error
 * @param {external:Integer} result
 */

/**
 * Maximum Transmission Unit (MTU) used for RTP.
 * <p>
 *   This setting affects the maximum size that will be used by RTP payloads. 
 *   You
 *   can change it from the default, if you think that a different value would 
 *   be
 *   beneficial for the typical network settings of your application.
 * </p>
 * <p>
 *   The default value is 1200 Bytes. This is the same as in <b>libwebrtc</b> 
 *   (from
 *   webrtc.org), as used by
 *   <a
 *     href='https://dxr.mozilla.org/mozilla-central/rev/b5c5ba07d3dbd0d07b66fa42a103f4df2c27d3a2/media/webrtc/trunk/webrtc/media/engine/constants.cc#16'
 *     >Firefox</a
 *   >
 *   or
 *   <a
 *     href='https://codesearch.chromium.org/chromium/src/third_party/webrtc/media/engine/constants.cc?l=15&rcl=6dd488b2e55125644263e4837f1abd950d5e410d'
 *     >Chrome</a
 *   >
 *   . You can read more about this value in
 *   <a
 *     href='https://groups.google.com/d/topic/discuss-webrtc/gH5ysR3SoZI/discussion'
 *     >Why RTP max packet size is 1200 in WebRTC?</a
 *   >
 *   .
 * </p>
 * <p>
 *   <b>WARNING</b>: Change this value ONLY if you really know what you are 
 *   doing
 *   and you have strong reasons to do so. Do NOT change this parameter just
 *   because it <i>seems</i> to work better for some reduced scope tests. The
 *   default value is a consensus chosen by people who have deep knowledge about
 *   network optimization.
 * </p>
 * <ul>
 *   <li>Unit: Bytes.</li>
 *   <li>Default: 1200.</li>
 * </ul>
 *
 * @alias module:core/abstracts.BaseRtpEndpoint#setMtu
 *
 * @param {external:Integer} mtu
 * @param {module:core/abstracts.BaseRtpEndpoint~setMtuCallback} [callback]
 *
 * @return {external:Promise}
 */
BaseRtpEndpoint.prototype.setMtu = function(mtu, callback){
  var transaction = (arguments[0] instanceof Transaction)
                  ? Array.prototype.shift.apply(arguments)
                  : undefined;

  //  
  // checkType('int', 'mtu', mtu, {required: true});
  //  

  var params = {
    mtu: mtu
  };

  callback = (callback || noop).bind(this)

  return disguise(this._invoke(transaction, 'setMtu', params, callback), this)
};
/**
 * @callback module:core/abstracts.BaseRtpEndpoint~setMtuCallback
 * @param {external:Error} error
 */

/**
 * Advanced parameters to configure the congestion control algorithm.
 *
 * @alias module:core/abstracts.BaseRtpEndpoint#getRembParams
 *
 * @param {module:core/abstracts.BaseRtpEndpoint~getRembParamsCallback} [callback]
 *
 * @return {external:Promise}
 */
BaseRtpEndpoint.prototype.getRembParams = function(callback){
  var transaction = (arguments[0] instanceof Transaction)
                  ? Array.prototype.shift.apply(arguments)
                  : undefined;

  var usePromise = false;
  
  if (callback == undefined) {
    usePromise = true;
  }
  
  if(!arguments.length) callback = undefined;

  callback = (callback || noop).bind(this)

  return disguise(this._invoke(transaction, 'getRembParams', callback), this)
};
/**
 * @callback module:core/abstracts.BaseRtpEndpoint~getRembParamsCallback
 * @param {external:Error} error
 * @param {module:core/complexTypes.RembParams} result
 */

/**
 * Advanced parameters to configure the congestion control algorithm.
 *
 * @alias module:core/abstracts.BaseRtpEndpoint#setRembParams
 *
 * @param {module:core/complexTypes.RembParams} rembParams
 * @param {module:core/abstracts.BaseRtpEndpoint~setRembParamsCallback} [callback]
 *
 * @return {external:Promise}
 */
BaseRtpEndpoint.prototype.setRembParams = function(rembParams, callback){
  var transaction = (arguments[0] instanceof Transaction)
                  ? Array.prototype.shift.apply(arguments)
                  : undefined;

  //  
  // checkType('RembParams', 'rembParams', rembParams, {required: true});
  //  

  var params = {
    rembParams: rembParams
  };

  callback = (callback || noop).bind(this)

  return disguise(this._invoke(transaction, 'setRembParams', params, callback), this)
};
/**
 * @callback module:core/abstracts.BaseRtpEndpoint~setRembParamsCallback
 * @param {external:Error} error
 */


/**
 * @alias module:core/abstracts.BaseRtpEndpoint.constructorParams
 */
BaseRtpEndpoint.constructorParams = {
};

/**
 * @alias module:core/abstracts.BaseRtpEndpoint.events
 *
 * @extends module:core/abstracts.SdpEndpoint.events
 */
BaseRtpEndpoint.events = SdpEndpoint.events.concat(['ConnectionStateChanged', 'MediaStateChanged']);


/**
 * Checker for {@link module:core/abstracts.BaseRtpEndpoint}
 *
 * @memberof module:core/abstracts
 *
 * @param {external:String} key
 * @param {module:core/abstracts.BaseRtpEndpoint} value
 */
function checkBaseRtpEndpoint(key, value)
{
  if(!(value instanceof BaseRtpEndpoint))
    throw ChecktypeError(key, BaseRtpEndpoint, value);
};


module.exports = BaseRtpEndpoint;

BaseRtpEndpoint.check = checkBaseRtpEndpoint;