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

Fix extended sequence number calculation on RTX.

Also drop the packet if RtpStream determines so.
上级 e1e545fe
......@@ -46,8 +46,6 @@ namespace RTC
protected:
void InitSeq(uint16_t seq);
private:
bool UpdateSeq(RTC::RtpPacket* packet);
/* Pure virtual methods that must be implemented by the subclass. */
......
......@@ -93,6 +93,9 @@ namespace RTC
return false;
}
// Increase counters.
this->counter.Update(packet);
// Set the extended sequence number into the packet.
packet->SetExtendedSequenceNumber(
this->cycles + static_cast<uint32_t>(packet->GetSequenceNumber()));
......@@ -187,9 +190,6 @@ namespace RTC
// Do nothing.
}
// Increase counters.
this->counter.Update(packet);
return true;
}
......
......@@ -7,10 +7,6 @@
namespace RTC
{
/* Static. */
static constexpr uint32_t RtpSeqMod{ 1 << 16 };
/* Instance methods. */
RtpStreamRecv::RtpStreamRecv(Listener* listener, RTC::RtpStream::Params& params)
......@@ -94,29 +90,22 @@ namespace RTC
packet->GetSsrc(),
packet->GetSequenceNumber());
// Set the extended sequence number into the packet.
packet->SetExtendedSequenceNumber(
this->cycles + static_cast<uint32_t>(packet->GetSequenceNumber()));
// Set the extended sequence number into the packet.
// Ensure that the NACKed packet sequence is not higher than the one of
// the media stream.
//
// We are in the same cycle.
if (packet->GetSequenceNumber() <= this->maxSeq)
{
packet->SetExtendedSequenceNumber(
this->cycles + static_cast<uint32_t>(packet->GetSequenceNumber()));
}
// The nacket packet belongs to the previous cycle.
else
// If not a valid packet ignore it.
if (!UpdateSeq(packet))
{
MS_DEBUG_TAG(rtx, "nacked packet belongs to previous seq cycle");
MS_WARN_TAG(
rtx,
"invalid RTX packet [ssrc:%" PRIu32 ", seq:%" PRIu16 "]",
packet->GetSsrc(),
packet->GetSequenceNumber());
packet->SetExtendedSequenceNumber(
this->cycles - RtpSeqMod + static_cast<uint32_t>(packet->GetSequenceNumber()));
return false;
}
// Set the extended sequence number into the packet.
packet->SetExtendedSequenceNumber(
this->cycles + static_cast<uint32_t>(packet->GetSequenceNumber()));
// Pass the packet to the NackGenerator.
if (this->params.useNack)
this->nackGenerator->ReceivePacket(packet);
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论