Unverified 提交 a792a13f authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo 提交者: GitHub

Ignore RTP packets with empty payload (#1403)

上级 536ac74b
......@@ -3,6 +3,7 @@
### NEXT
- `SimulcastConsumer`: Fix increase layer when current layer has not receive SR ([PR #1098](https://github.com/versatica/mediasoup/pull/1098) by @penguinol).
- Ignore RTP packets with empty payload ([PR #1403](https://github.com/versatica/mediasoup/pull/1403), credits to @ggarber).
### 3.14.6
......
......@@ -21,6 +21,7 @@ namespace RTC
INVALID_TARGET_LAYER,
UNSUPPORTED_PAYLOAD_TYPE,
NOT_A_KEYFRAME,
EMPTY_PAYLOAD,
SPATIAL_LAYER_MISMATCH,
TOO_HIGH_TIMESTAMP_EXTRA_NEEDED,
PACKET_PREVIOUS_TO_SPATIAL_LAYER_SWITCH,
......
......@@ -250,6 +250,18 @@ namespace RTC
auto& syncRequired = this->mapRtpStreamSyncRequired.at(rtpStream);
auto& rtpSeqManager = this->mapRtpStreamRtpSeqManager.at(rtpStream);
// Packets with only padding are not forwarded.
if (packet->GetPayloadLength() == 0)
{
rtpSeqManager.Drop(packet->GetSequenceNumber());
#ifdef MS_RTC_LOGGER_RTP
packet->logger.Dropped(RtcLogger::RtpPacket::DropReason::EMPTY_PAYLOAD);
#endif
return;
}
// If we need to sync, support key frames and this is not a key frame, ignore
// the packet.
if (syncRequired && this->keyFrameSupported && !packet->IsKeyFrame())
......
......@@ -18,6 +18,7 @@ namespace RTC
{ RtpPacket::DropReason::INVALID_TARGET_LAYER, "InvalidTargetLayer" },
{ RtpPacket::DropReason::UNSUPPORTED_PAYLOAD_TYPE, "UnsupportedPayloadType" },
{ RtpPacket::DropReason::NOT_A_KEYFRAME, "NotAKeyframe" },
{ RtpPacket::DropReason::EMPTY_PAYLOAD, "EmptyPayload" },
{ RtpPacket::DropReason::SPATIAL_LAYER_MISMATCH, "SpatialLayerMismatch" },
{ RtpPacket::DropReason::TOO_HIGH_TIMESTAMP_EXTRA_NEEDED, "TooHighTimestampExtraNeeded" },
{ RtpPacket::DropReason::PACKET_PREVIOUS_TO_SPATIAL_LAYER_SWITCH, "PacketPreviousToSpatialLayerSwitch" },
......
......@@ -303,6 +303,13 @@ namespace RTC
// Calculate Jitter.
CalculateJitter(packet->GetTimestamp());
// Padding only packet, do not consider it for counter increase nor
// stream activation.
if (packet->GetPayloadLength() == 0)
{
return true;
}
// Increase transmission counter.
this->transmissionCounter.Update(packet);
......@@ -413,6 +420,13 @@ namespace RTC
// NACKed packet.
if (this->nackGenerator->ReceivePacket(packet, /*isRecovered*/ true))
{
// Padding only packet, do not consider it for counter increase nor
// stream activation.
if (packet->GetPayloadLength() == 0)
{
return true;
}
// Mark the packet as repaired.
RTC::RtpStream::PacketRepaired(packet);
......
......@@ -314,6 +314,18 @@ namespace RTC
return;
}
// Packets with only padding are not forwarded.
if (packet->GetPayloadLength() == 0)
{
this->rtpSeqManager.Drop(packet->GetSequenceNumber());
#ifdef MS_RTC_LOGGER_RTP
packet->logger.Dropped(RtcLogger::RtpPacket::DropReason::EMPTY_PAYLOAD);
#endif
return;
}
auto payloadType = packet->GetPayloadType();
// NOTE: This may happen if this Consumer supports just some codecs of those
......
......@@ -724,6 +724,18 @@ namespace RTC
return;
}
// Packets with only padding are not forwarded.
if (packet->GetPayloadLength() == 0)
{
this->rtpSeqManager.Drop(packet->GetSequenceNumber());
#ifdef MS_RTC_LOGGER_RTP
packet->logger.Dropped(RtcLogger::RtpPacket::DropReason::EMPTY_PAYLOAD);
#endif
return;
}
if (this->targetTemporalLayer == -1)
{
#ifdef MS_RTC_LOGGER_RTP
......
......@@ -639,6 +639,18 @@ namespace RTC
return;
}
// Packets with only padding are not forwarded.
if (packet->GetPayloadLength() == 0)
{
this->rtpSeqManager.Drop(packet->GetSequenceNumber());
#ifdef MS_RTC_LOGGER_RTP
packet->logger.Dropped(RtcLogger::RtpPacket::DropReason::EMPTY_PAYLOAD);
#endif
return;
}
// clang-format off
if (
this->encodingContext->GetTargetSpatialLayer() == -1 ||
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论