# Dynamic Bitrate Adjustments

**URL:** <https://mediasoup.discourse.group/t/dynamic-bitrate-adjustments/6046>\
**Category:** mediasoup libraries\
**Created:** [May 14, 2024, 11:12am UTC](https://mediasoup.discourse.group/t/dynamic-bitrate-adjustments/6046 "2024-05-14T11:12:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hamedgholami771992](https://avatars.discourse-cdn.com/v4/letter/h/5daacb/32.png) [@hamedgholami771992](https://mediasoup.discourse.group/u/hamedgholami771992)\
**Post date:** [May 14, 2024, 11:12am UTC](https://mediasoup.discourse.group/t/dynamic-bitrate-adjustments/6046/1 "2024-05-14T11:12:36Z")

</div>

Hello,

I am currently working on dynamically adjusting the stream quality based on the network conditions of each client in a MediaSoup application. My goal is to optimize the client experience by altering the bitrate of the media streams in real time, using the `setMaxOutgoingBitrate(newBitrate)` method on the transport.

### Setup Details:

- **Transports** : I have set up two types of transports for each client: `sendTransport` for handling outgoing streams to the server, and `receiveTransport` for managing streams that are sent from the server to the client.
- **Bitrate Management** : I’m attempting to control the stream’s bitrate by calling `setMaxOutgoingBitrate(newBitrate)` on the `receiveTransport`, as I understand that this should limit the bitrate of the streams being sent to clients.

### Issue:

Despite implementing this, I’ve noticed that changes made via `setMaxOutgoingBitrate(newBitrate)` are not reflected in the bitrate statistics obtained from `producer.getStats()[0].bitrate`. The stats do not show any change in the bitrate after adjusting the `setMaxOutgoingBitrate`.

### Questions:

1. **Is there something I might be overlooking in how `setMaxOutgoingBitrate` should be implemented to effectively control the bitrate?**
2. **Should modifications to bitrate settings immediately reflect in `producer.getStats()` or is there an expected delay?**
3. **Are there additional settings or configurations in MediaSoup that could impact how bitrate adjustments are handled and reported?**

I am looking to understand the best practices for dynamically managing stream quality based on real-time network assessments and ensuring these changes are accurately monitored through MediaSoup’s statistics.

Thank you in advance for your insights and assistance!

---

<div class="post-metadata">

**Author:** ![BronzedBroth](https://avatars.discourse-cdn.com/v4/letter/b/ad7895/32.png) [@BronzedBroth](https://mediasoup.discourse.group/u/BronzedBroth)\
**Post date:** [May 19, 2024, 1:51pm UTC](https://mediasoup.discourse.group/t/dynamic-bitrate-adjustments/6046/2 "2024-05-19T13:51:30Z")

</div>

What about transport.setMaxIncomingBitrate(bitrate)?

---

<div class="post-metadata">

**Author:** ![hamedgholami771992](https://avatars.discourse-cdn.com/v4/letter/h/5daacb/32.png) [@hamedgholami771992](https://mediasoup.discourse.group/u/hamedgholami771992)\
**Post date:** [May 19, 2024, 2:15pm UTC](https://mediasoup.discourse.group/t/dynamic-bitrate-adjustments/6046/3 "2024-05-19T14:15:13Z")

</div>

calling “Transport.setMaxIncomingBitrate(bitrate)” does not make any difference on the value of “producer.getStats()[0].bitrate”
