“Issue” description
When setting maxBitrate via TRANSPORT_SET_MAX_OUTGOING_BITRATE the maximum outgoing bitrate is not reduced for some time. My conclusion is given the startBitrate in TransportCongestionControlClient is larger than the max bitrate at the time of setting that it takes time for the Transport CC algo to reduce this.
I added code to reduce the startBitrate in TransportCongestionControlClient
// NOTE: Setting 'startBitrate' to 'availableBitrate' has proven to generate
// more stable values.
this->bitrates.startBitrate = std::max<uint32_t>(MinBitrate, this->bitrates.availableBitrate);
// Reduce startBitrate to 90% of maxBitrate
if (this->bitrates.startBitrate > this->bitrates.maxBitrate) {
this->bitrates.startBitrate = this->bitrates.maxBitrate * 0.9;
}
By doing this the maximum outgoing bitrate is immediately reduced. In the case of VP8/VP9 the scalability layers is immediately downgraded/selected. I understand this could potentially cause video artifacts, frozen video, etc, and by not doing this the transport CC algo is allowed to slowly reduce the bitrate. I am wondering what your thoughts are on this.
Additional Info:
The issue I am seeing is the total outgoing bitrate is not being honored after setting maxBitrate. It can take some time for the reduction to happen.
RTC::Transport::HandleRequest() | !!!!!!!!! SETTING MAX OUTGOING: 750000
RTC::Transport::DistributeAvailableOutgoingBitrate() | availableBitrate [1995354]
RTC::Transport::ComputeOutgoingDesiredBitrate() | total desired bitrate: 1390304
RTC::TransportCongestionControlClient::SetDesiredBitrate() | [desiredBitrate:1390304, startBitrate:1995354, minBitrate:30000, maxBitrate:750000, maxPaddingBitrate:637500, availableBitrate:1995354]
**<SNIP>**
RTC::TransportCongestionControlClient::SetDesiredBitrate() | [desiredBitrate:1428134, startBitrate:1995354, minBitrate:30000, maxBitrate:750000, maxPaddingBitrate:637500, availableBitrate:1995354]
RTC::Transport::DistributeAvailableOutgoingBitrate() | availableBitrate [750000]
RTC::Transport::ComputeOutgoingDesiredBitrate() | total desired bitrate: 1406034
RTC::TransportCongestionControlClient::SetDesiredBitrate() | [desiredBitrate:1406034, startBitrate:750000, minBitrate:30000, maxBitrate:750000, maxPaddingBitrate:637500, availableBitrate:750000]
RTC::Transport::DistributeAvailableOutgoingBitrate() | availableBitrate [750000]
RTC::Transport::ComputeOutgoingDesiredBitrate() | total desired bitrate: 1373334
Your environment
- mediasoup version: e7d4f874275dad69cd584a1b7cdd6be4656d1791