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 (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

Hi @micaelgallego
I just saw your comment and got curious to know what is wrong with the approach? The maxIncomingBitrate is part of the configuration object that is not being passed directly to the transport but is used as an argument for setMaxIncomingBitrate().

If you use TypeScript, then the configuration object can not be with the type WebRtcTransportOptions because it will have additional properties.

Also, conceptually, maxIncomingBitrate is a configuration property like others in WebRtcTransportOptions. Then, IMHO, it could be included on it. But @ibc thinks that having a set method for it is the best way to communicate that it can be changed at any time. And it is perfect for me :wink:

1 Like

Makes sense. :ok_hand:
Thank you.