提交 3f917d4e authored 作者: José Luis Millán's avatar José Luis Millán

RtpStream: update maxPacketMs with current timestamp

上级 5b6bc992
......@@ -130,12 +130,8 @@ namespace RTC
// Update highest seen RTP timestamp.
if (SeqManager<uint32_t>::IsSeqHigherThan(packet->GetTimestamp(), this->maxPacketTs))
{
// Calculate time diff between this and previous highest RTP timestamp.
uint32_t diffTs = packet->GetTimestamp() - this->maxPacketTs;
uint32_t diffMs = diffTs * 1000 / this->params.clockRate;
this->maxPacketTs = packet->GetTimestamp();
this->maxPacketMs += diffMs;
this->maxPacketMs = DepLibUV::GetTime();
}
return true;
......
......@@ -286,17 +286,12 @@ namespace RTC
if (this->transmissionCounter.GetPacketCount() == 0u)
return nullptr;
auto ntp = Utils::Time::TimeMs2Ntp(now);
auto report = new RTC::RTCP::SenderReport();
report->SetPacketCount(this->transmissionCounter.GetPacketCount());
report->SetOctetCount(this->transmissionCounter.GetBytes());
// Calculate RTP timestamp diff between now and last received RTP packet.
auto diffMs = static_cast<int64_t>(now - this->maxPacketMs);
int64_t diffTs = diffMs * this->params.clockRate / 1000;
// Get the NTP representation of the current timestamp.
auto ntp = Utils::Time::TimeMs2Ntp(now);
report->SetRtpTs(this->maxPacketTs + diffTs);
report->SetRtpTs(this->maxPacketTs);
report->SetNtpSec(ntp.seconds);
report->SetNtpFrac(ntp.fractions);
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论