Unverified 提交 c9fe16c2 authored 作者: penguinol's avatar penguinol 提交者: GitHub

SeqManager: increase performance (#398)

上级 74cad397
......@@ -77,28 +77,30 @@ namespace RTC
if (!this->dropped.empty())
{
// Delete dropped inputs older than input - MaxValue/2.
size_t droppedSize = this->dropped.size();
auto it = this->dropped.lower_bound(input - MaxValue / 2);
size_t droppedCount = this->dropped.size();
auto it = this->dropped.lower_bound(input - MaxValue / 2);
this->dropped.erase(this->dropped.begin(), it);
this->base -= (droppedSize - this->dropped.size());
base = this->base;
this->base -= (droppedCount - this->dropped.size());
// Check whether this input was dropped.
it = this->dropped.find(input);
// Count dropped entries before 'input' in order to adapt the base.
droppedCount = this->dropped.size();
it = this->dropped.lower_bound(input);
if (it != this->dropped.end())
{
MS_DEBUG_DEV("trying to send a dropped input");
// Check whether this input was dropped.
if (*it == input)
{
MS_DEBUG_DEV("trying to send a dropped input");
return false;
}
return false;
}
// Count dropped entries before 'input' in order to adapt the base.
size_t dropped =
this->dropped.size() - std::distance(this->dropped.upper_bound(input), this->dropped.end());
droppedCount -= std::distance(it, this->dropped.end());
}
base -= dropped;
base = this->base - droppedCount;
}
output = input + base;
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论