提交 e4a78bd2 authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

Fix RtpStreamRecv::TransmissionCounter::GetBitrate()

上级 2ec8a1e0
...@@ -68,21 +68,33 @@ namespace RTC ...@@ -68,21 +68,33 @@ namespace RTC
temporalLayer < this->spatialLayerCounters.at(spatialLayer).size(), "temporalLayer too high"); temporalLayer < this->spatialLayerCounters.at(spatialLayer).size(), "temporalLayer too high");
uint32_t rate{ 0u }; uint32_t rate{ 0u };
uint8_t spatialLayerIdx{ 0u };
uint8_t temporalLayerIdx{ 0u };
for (auto& spatialLayerCounter : this->spatialLayerCounters) // clang-format off
for (
uint8_t spatialLayerIdx{ 0u };
(
spatialLayerIdx < this->spatialLayerCounters.size() &&
spatialLayerIdx <= spatialLayer
);
++spatialLayerIdx
)
// clang-format on
{ {
for (auto& temporalLayerCounter : spatialLayerCounter) // clang-format off
for (
uint8_t temporalLayerIdx{ 0u };
(
temporalLayerIdx < this->spatialLayerCounters[spatialLayerIdx].size() &&
(spatialLayerIdx < spatialLayer || temporalLayerIdx <= temporalLayer)
);
++temporalLayerIdx
)
// clang-format on
{ {
rate += temporalLayerCounter.GetBitrate(now); auto& temporalLayerCounter = this->spatialLayerCounters[spatialLayerIdx][temporalLayerIdx];
if (++temporalLayerIdx > temporalLayer) rate += temporalLayerCounter.GetBitrate(now);
break;
} }
if (++spatialLayerIdx > spatialLayer)
break;
} }
return rate; return rate;
...@@ -95,7 +107,7 @@ namespace RTC ...@@ -95,7 +107,7 @@ namespace RTC
MS_ASSERT( MS_ASSERT(
temporalLayer < this->spatialLayerCounters.at(spatialLayer).size(), "temporalLayer too high"); temporalLayer < this->spatialLayerCounters.at(spatialLayer).size(), "temporalLayer too high");
auto& counter = this->spatialLayerCounters.at(spatialLayer).at(temporalLayer); auto& counter = this->spatialLayerCounters[spatialLayer][temporalLayer];
return counter.GetBitrate(now); return counter.GetBitrate(now);
} }
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论