Unverified 提交 47147afe authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo 提交者: GitHub

TransportCongestionControlClient: make usage of TrendCalculator for desired bitrate optional (#956)

上级 237fd62f
#define MS_CLASS "RTC::TransportCongestionControlClient"
// #define MS_LOG_DEV_LEVEL 3
#define USE_TREND_CALCULATOR
#include "RTC/TransportCongestionControlClient.hpp"
#include "DepLibUV.hpp"
......@@ -111,12 +112,17 @@ namespace RTC
{
MS_TRACE();
#ifdef USE_TREND_CALCULATOR
auto nowMs = DepLibUV::GetTimeMsInt64();
#endif
this->bitrates.desiredBitrate = 0u;
this->bitrates.effectiveDesiredBitrate = 0u;
#ifdef USE_TREND_CALCULATOR
this->desiredBitrateTrend.ForceUpdate(0u, nowMs);
#endif
this->rtpTransportControllerSend->OnNetworkAvailability(false);
}
......@@ -279,17 +285,27 @@ namespace RTC
{
MS_TRACE();
#ifdef USE_TREND_CALCULATOR
auto nowMs = DepLibUV::GetTimeMsInt64();
#endif
// Manage it via trending and increase it a bit to avoid immediate oscillations.
#ifdef USE_TREND_CALCULATOR
if (!force)
this->desiredBitrateTrend.Update(desiredBitrate, nowMs);
else
this->desiredBitrateTrend.ForceUpdate(desiredBitrate, nowMs);
#endif
this->bitrates.desiredBitrate = desiredBitrate;
this->bitrates.desiredBitrate = desiredBitrate;
#ifdef USE_TREND_CALCULATOR
this->bitrates.effectiveDesiredBitrate = this->desiredBitrateTrend.GetValue();
this->bitrates.minBitrate = RTC::TransportCongestionControlMinOutgoingBitrate;
#else
this->bitrates.effectiveDesiredBitrate = desiredBitrate;
#endif
this->bitrates.minBitrate = RTC::TransportCongestionControlMinOutgoingBitrate;
// NOTE: Setting 'startBitrate' to 'availableBitrate' has proven to generate
// more stable values.
this->bitrates.startBitrate = std::max<uint32_t>(
......@@ -303,11 +319,19 @@ namespace RTC
auto currentMaxBitrate = this->bitrates.maxBitrate;
uint32_t newMaxBitrate = 0;
#ifdef USE_TREND_CALCULATOR
if (this->desiredBitrateTrend.GetValue() > 0u)
#else
if (this->bitrates.desiredBitrate > 0u)
#endif
{
newMaxBitrate = std::max<uint32_t>(
this->initialAvailableBitrate,
#ifdef USE_TREND_CALCULATOR
this->desiredBitrateTrend.GetValue() * MaxBitrateIncrementFactor);
#else
this->bitrates.desiredBitrate * MaxBitrateIncrementFactor);
#endif
// If max bitrate requested didn't change by more than a small % keep the previous settings
// to avoid constant small fluctuations requiring extra probing and making the estimation
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论