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

Fix frozen video in simulcast due to wrong dropping of padding only packets (#1431)

Fixes #1429

### Details

- In `SimulcastConsumer` we must drop padding only packets ONLY if the packet belong to the current simulcast stream being sent to the consuming endpoint.
- Changes in other `XxxxConsumer` classes are just cosmetic for consistency.
上级 8e769dbc
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
- Worker: Test, fix buffer overflow ([PR #1419](https://github.com/versatica/mediasoup/pull/1419)). - Worker: Test, fix buffer overflow ([PR #1419](https://github.com/versatica/mediasoup/pull/1419)).
- Bump up Meson from 1.3.0 to 1.5.0 ([PR #1424](https://github.com/versatica/mediasoup/pull/1424)). - Bump up Meson from 1.3.0 to 1.5.0 ([PR #1424](https://github.com/versatica/mediasoup/pull/1424)).
- Node: Export new `WorkerObserver`, `ProducerObserver`, etc. TypeScript types ([PR #1430](https://github.com/versatica/mediasoup/pull/1430)). - Node: Export new `WorkerObserver`, `ProducerObserver`, etc. TypeScript types ([PR #1430](https://github.com/versatica/mediasoup/pull/1430)).
- Fix frozen video in simulcast due to wrong dropping of padding only packets ([PR #1431](https://github.com/versatica/mediasoup/pull/1431), thanks to @quanli168).
### 3.14.8 ### 3.14.8
......
...@@ -250,24 +250,24 @@ namespace RTC ...@@ -250,24 +250,24 @@ namespace RTC
auto& syncRequired = this->mapRtpStreamSyncRequired.at(rtpStream); auto& syncRequired = this->mapRtpStreamSyncRequired.at(rtpStream);
auto& rtpSeqManager = this->mapRtpStreamRtpSeqManager.at(rtpStream); auto& rtpSeqManager = this->mapRtpStreamRtpSeqManager.at(rtpStream);
// Packets with only padding are not forwarded. // If we need to sync, support key frames and this is not a key frame, ignore
if (packet->GetPayloadLength() == 0) // the packet.
if (syncRequired && this->keyFrameSupported && !packet->IsKeyFrame())
{ {
rtpSeqManager.Drop(packet->GetSequenceNumber());
#ifdef MS_RTC_LOGGER_RTP #ifdef MS_RTC_LOGGER_RTP
packet->logger.Dropped(RtcLogger::RtpPacket::DropReason::EMPTY_PAYLOAD); packet->logger.Dropped(RtcLogger::RtpPacket::DropReason::NOT_A_KEYFRAME);
#endif #endif
return; return;
} }
// If we need to sync, support key frames and this is not a key frame, ignore // Packets with only padding are not forwarded.
// the packet. if (packet->GetPayloadLength() == 0)
if (syncRequired && this->keyFrameSupported && !packet->IsKeyFrame())
{ {
rtpSeqManager.Drop(packet->GetSequenceNumber());
#ifdef MS_RTC_LOGGER_RTP #ifdef MS_RTC_LOGGER_RTP
packet->logger.Dropped(RtcLogger::RtpPacket::DropReason::NOT_A_KEYFRAME); packet->logger.Dropped(RtcLogger::RtpPacket::DropReason::EMPTY_PAYLOAD);
#endif #endif
return; return;
......
...@@ -314,18 +314,6 @@ namespace RTC ...@@ -314,18 +314,6 @@ namespace RTC
return; 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(); auto payloadType = packet->GetPayloadType();
// NOTE: This may happen if this Consumer supports just some codecs of those // NOTE: This may happen if this Consumer supports just some codecs of those
...@@ -372,6 +360,18 @@ namespace RTC ...@@ -372,6 +360,18 @@ namespace RTC
return; 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;
}
// Whether this is the first packet after re-sync. // Whether this is the first packet after re-sync.
const bool isSyncPacket = this->syncRequired; const bool isSyncPacket = this->syncRequired;
......
...@@ -730,18 +730,6 @@ namespace RTC ...@@ -730,18 +730,6 @@ namespace RTC
return; 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) if (this->targetTemporalLayer == -1)
{ {
#ifdef MS_RTC_LOGGER_RTP #ifdef MS_RTC_LOGGER_RTP
...@@ -810,6 +798,19 @@ namespace RTC ...@@ -810,6 +798,19 @@ namespace RTC
return; return;
} }
// If the packet belongs to current spatial layer being sent and packet does
// not have payload other than padding, then drop it.
if (spatialLayer == this->currentSpatialLayer && packet->GetPayloadLength() == 0)
{
this->rtpSeqManager.Drop(packet->GetSequenceNumber());
#ifdef MS_RTC_LOGGER_RTP
packet->logger.Dropped(RtcLogger::RtpPacket::DropReason::EMPTY_PAYLOAD);
#endif
return;
}
// Whether this is the first packet after re-sync. // Whether this is the first packet after re-sync.
const bool isSyncPacket = this->syncRequired; const bool isSyncPacket = this->syncRequired;
......
...@@ -639,18 +639,6 @@ namespace RTC ...@@ -639,18 +639,6 @@ namespace RTC
return; 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 // clang-format off
if ( if (
this->encodingContext->GetTargetSpatialLayer() == -1 || this->encodingContext->GetTargetSpatialLayer() == -1 ||
...@@ -690,6 +678,18 @@ namespace RTC ...@@ -690,6 +678,18 @@ namespace RTC
return; 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;
}
// Whether this is the first packet after re-sync. // Whether this is the first packet after re-sync.
const bool isSyncPacket = this->syncRequired; const bool isSyncPacket = this->syncRequired;
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论