Skip to content

Commit

Permalink
Fix update bandwidth estimation configuration and available bitrate w…
Browse files Browse the repository at this point in the history
…hen updating max outgoing bitrate (#779)
  • Loading branch information
ggarber authored Mar 1, 2022
1 parent 9a19b3f commit 7417beb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions worker/include/RTC/TransportCongestionControlClient.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ namespace RTC
private:
void MayEmitAvailableBitrateEvent(uint32_t previousAvailableBitrate);
void UpdatePacketLoss(double packetLoss);
void ApplyBitrateUpdates();

void InitializeController();
void DestroyController();
Expand Down
13 changes: 13 additions & 0 deletions worker/src/RTC/TransportCongestionControlClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,14 @@ namespace RTC
MS_THROW_ERROR("maxOutgoingBitrate must be >= 30000bps");

this->maxOutgoingBitrate = maxBitrate;

ApplyBitrateUpdates();

if (this->maxOutgoingBitrate > 0u)
{
this->bitrates.availableBitrate =
std::min<uint32_t>(this->maxOutgoingBitrate, this->bitrates.availableBitrate);
}
}

void TransportCongestionControlClient::SetDesiredBitrate(uint32_t desiredBitrate, bool force)
Expand All @@ -290,6 +298,11 @@ namespace RTC
// more stable values.
this->bitrates.startBitrate = std::max<uint32_t>(MinBitrate, this->bitrates.availableBitrate);

ApplyBitrateUpdates();
}

void TransportCongestionControlClient::ApplyBitrateUpdates()
{
auto currentMaxBitrate = this->bitrates.maxBitrate;
uint32_t newMaxBitrate = 0;

Expand Down

0 comments on commit 7417beb

Please sign in to comment.