maxIncomingBitrate in WebRtcTransportOptions

Looking to documentation of WebRtcTransportOptions I can see that maxIncomingBitrate is not a defined property.

But there is a method setMaxIncomingBitrate in WebRtcTransport to configure that value after creation.

Looking to the example https://github.com/mkhahani/mediasoup-sample-app (featured in the mediasoup web page), I can see how ‘maxIncomingBitrate’ is set in the object that will be used later on to configure a new WebRtcTransport. That is, this property is set in a WebRtcTransportOptions object.

The question is: The example has a bug and maxIncomingBitrate is being ignored or documentation is incomplete and maxIncomingBitrate can be set in WebRtcTransportOptions?

Thanks in advance!

PD: I’ve just caught this inconsistency thanks to TypeScript :wink:

There is no maxIncomingBitrate, it’s set dynamically via setMaxIncomingBitrate(). May be the example you mean is indeed wrong. If you take a look to the mediasoup-demo, the maxIncomingBitrate in config.js is used later with setMaxIncomingBitrate().

Looking deeper in the example, I see that the value of ‘maxInconmingBitrate’ is being configured using the setMaxIncomingBitrate method:

if (maxIncomingBitrate) {
    try {
      await transport.setMaxIncomingBitrate(maxIncomingBitrate);
    } catch (error) {
    }
  }

Is there any reason to avoid configuring maxIncomingBitrate in the WebRtcTransportOptions?

To make it dynamic so the app can change it at any time :slight_smile:

Yep, but IMHO it will be better to have both options. Allow to configure it when transport is created and also, allow dynamic change with setMaxIncomingBitrate.

Just my opinion, I’m a newby in mediasoup :wink:

I prefer to just provide a single way of doing things. Other options are not dynamic so they make sense in the transport creation.

I understand, thank you the fast response.

1 Like