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