提交 4c380e1a authored 作者: José Luis Millán's avatar José Luis Millán

Score: store necessary information for next score update

上级 5afbbd54
......@@ -59,6 +59,7 @@ namespace RTC
uint32_t jitter{ 0 };
uint8_t firSeqNumber{ 0 };
uint32_t reportedPacketLost{ 0 };
bool inactive{ false }; // Stream is inactive.
std::unique_ptr<RTC::NackGenerator> nackGenerator;
Timer* inactivityCheckPeriodicTimer{ nullptr };
};
......
......@@ -71,7 +71,10 @@ namespace RTC
// Ensure the inactivityCheckPeriodicTimer runs.
if (!this->inactivityCheckPeriodicTimer->IsActive())
{
this->inactive = false;
this->inactivityCheckPeriodicTimer->Restart();
}
return true;
}
......@@ -304,6 +307,7 @@ namespace RTC
{
MS_TRACE();
this->inactive = true;
this->inactivityCheckPeriodicTimer->Stop();
}
......@@ -311,6 +315,7 @@ namespace RTC
{
MS_TRACE();
this->inactive = false;
this->inactivityCheckPeriodicTimer->Restart();
}
......@@ -341,14 +346,6 @@ namespace RTC
auto totalExpected = GetExpectedPackets();
uint32_t expected = totalExpected - this->expectedPrior;
// We didn't expect more packets to come.
if (expected == 0)
{
ResetScore();
return;
}
this->expectedPrior = totalExpected;
// Calculate number of packets received in this interval.
......@@ -371,6 +368,17 @@ namespace RTC
this->repairedPrior = totalRepaired;
if (this->inactive)
return;
// We didn't expect more packets to come.
if (expected == 0)
{
RtpStream::UpdateScore(10);
return;
}
if (repaired >= lost)
lost = 0;
else
......@@ -420,6 +428,7 @@ namespace RTC
// If no RTP is being received reset the score.
if (this->transmissionCounter.GetRate(now) == 0)
{
this->inactive = true;
this->inactivityCheckPeriodicTimer->Stop();
if (GetScore() != 0)
......
......@@ -533,14 +533,6 @@ namespace RTC
auto totalSent = this->transmissionCounter.GetPacketCount();
auto sent = totalSent - this->sentPrior;
// We didn't send any packet.
if (sent == 0)
{
ResetScore();
return;
}
this->sentPrior = totalSent;
// Calculate number of packets lost in this interval.
......@@ -560,6 +552,14 @@ namespace RTC
this->repairedPrior = totalRepaired;
// We didn't send any packet.
if (sent == 0)
{
RtpStream::UpdateScore(10);
return;
}
if (repaired >= lost)
lost = 0;
else
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论