Unverified 提交 138c8257 authored 作者: SteveMcFarlin's avatar SteveMcFarlin 提交者: GitHub

(worker): Modification of Consumer bitrate allocation algorithm (#708)

上级 4b3dd530
...@@ -2362,6 +2362,7 @@ namespace RTC ...@@ -2362,6 +2362,7 @@ namespace RTC
if (multimapPriorityConsumer.empty()) if (multimapPriorityConsumer.empty())
return; return;
bool baseAllocation = true;
uint32_t availableBitrate = this->tccClient->GetAvailableBitrate(); uint32_t availableBitrate = this->tccClient->GetAvailableBitrate();
this->tccClient->RescheduleNextAvailableBitrateEvent(); this->tccClient->RescheduleNextAvailableBitrateEvent();
...@@ -2369,8 +2370,9 @@ namespace RTC ...@@ -2369,8 +2370,9 @@ namespace RTC
MS_DEBUG_DEV("before layer-by-layer iterations [availableBitrate:%" PRIu32 "]", availableBitrate); MS_DEBUG_DEV("before layer-by-layer iterations [availableBitrate:%" PRIu32 "]", availableBitrate);
// Redistribute the available bitrate by allowing Consumers to increase // Redistribute the available bitrate by allowing Consumers to increase
// layer by layer. Take into account the priority of each Consumer to // layer by layer. Initially try to spread the bitrate across all
// provide it with more bitrate. // consumers. Then allocate the excess bitrate to Consumers starting
// with the highest priorty.
while (availableBitrate > 0u) while (availableBitrate > 0u)
{ {
auto previousAvailableBitrate = availableBitrate; auto previousAvailableBitrate = availableBitrate;
...@@ -2381,9 +2383,7 @@ namespace RTC ...@@ -2381,9 +2383,7 @@ namespace RTC
auto* consumer = it->second; auto* consumer = it->second;
auto bweType = this->tccClient->GetBweType(); auto bweType = this->tccClient->GetBweType();
// If a Consumer has priority > 1, call IncreaseLayer() more times to for (uint8_t i{ 1u }; i <= (baseAllocation ? 1u : priority); ++i)
// provide it with more available bitrate to choose its preferred layers.
for (uint8_t i{ 1u }; i <= priority; ++i)
{ {
uint32_t usedBitrate{ 0u }; uint32_t usedBitrate{ 0u };
...@@ -2410,6 +2410,8 @@ namespace RTC ...@@ -2410,6 +2410,8 @@ namespace RTC
// If no Consumer used bitrate, exit the loop. // If no Consumer used bitrate, exit the loop.
if (availableBitrate == previousAvailableBitrate) if (availableBitrate == previousAvailableBitrate)
break; break;
baseAllocation = false;
} }
MS_DEBUG_DEV("after layer-by-layer iterations [availableBitrate:%" PRIu32 "]", availableBitrate); MS_DEBUG_DEV("after layer-by-layer iterations [availableBitrate:%" PRIu32 "]", availableBitrate);
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论