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

Consumer: consider extended sequence numbers when synchronizing a stream

上级 68a4c9f7
......@@ -97,6 +97,8 @@ namespace RTC
uint32_t rtpTimestamp{ 0 };
uint16_t lastRecvSeqNum{ 0 };
uint32_t lastRecvRtpTimestamp{ 0 };
uint32_t maxRecvExtendedSeqNum{ 0 };
uint16_t maxRecvSeqNum{ 0 };
bool syncRequired{ true };
// RTP profiles.
std::set<RTC::RtpEncodingParameters::Profile> profiles;
......
......@@ -331,7 +331,7 @@ namespace RTC
// Check whether sequence number and timestamp sync is required.
if (this->syncRequired)
{
this->seqNum += 1;
this->seqNum = this->maxRecvSeqNum + 1;
auto now = static_cast<uint32_t>(DepLibUV::GetTime());
......@@ -355,6 +355,13 @@ namespace RTC
// Save real SSRC.
auto ssrc = packet->GetSsrc();
// Update the max received sequence number if required.
if (packet->GetExtendedSequenceNumber() > this->maxRecvExtendedSeqNum)
{
this->maxRecvExtendedSeqNum = packet->GetExtendedSequenceNumber();
this->maxRecvSeqNum = this->lastRecvSeqNum;
}
// Rewrite packet SSRC.
packet->SetSsrc(this->rtpParameters.encodings[0].ssrc);
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论