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

Only perform RTP inactivity checks on simulcast streams (#1061)

上级 de8d8ce4
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
### NEXT ### NEXT
* `RtpStreamRecv`: Only perform RTP inactivity check on simulcast streams ([PR #1061](https://github.com/versatica/mediasoup/pull/1061)).
* `SeqManager`: Properly remove old dropped entries ([PR #1054](https://github.com/versatica/mediasoup/pull/1054)). * `SeqManager`: Properly remove old dropped entries ([PR #1054](https://github.com/versatica/mediasoup/pull/1054)).
* libwebrtc: Upgrade trendline estimator to improve low bandwidth conditions ([PR #1055](https://github.com/versatica/mediasoup/pull/1055) by @ggarber). * libwebrtc: Upgrade trendline estimator to improve low bandwidth conditions ([PR #1055](https://github.com/versatica/mediasoup/pull/1055) by @ggarber).
* libwebrtc: Fix bandwidth probation dead state ([PR #1031](https://github.com/versatica/mediasoup/pull/1031) by @vpalmisano). * libwebrtc: Fix bandwidth probation dead state ([PR #1031](https://github.com/versatica/mediasoup/pull/1031) by @vpalmisano).
......
...@@ -45,7 +45,8 @@ namespace RTC ...@@ -45,7 +45,8 @@ namespace RTC
RtpStreamRecv( RtpStreamRecv(
RTC::RtpStreamRecv::Listener* listener, RTC::RtpStreamRecv::Listener* listener,
RTC::RtpStream::Params& params, RTC::RtpStream::Params& params,
unsigned int sendNackDelayMs); unsigned int sendNackDelayMs,
bool useRtpInactivityCheck);
~RtpStreamRecv(); ~RtpStreamRecv();
void FillJsonStats(json& jsonObject) override; void FillJsonStats(json& jsonObject) override;
...@@ -96,6 +97,7 @@ namespace RTC ...@@ -96,6 +97,7 @@ namespace RTC
private: private:
// Passed by argument. // Passed by argument.
unsigned int sendNackDelayMs{ 0u }; unsigned int sendNackDelayMs{ 0u };
bool useRtpInactivityCheck{ false };
// Others. // Others.
// Packets expected at last interval. // Packets expected at last interval.
uint32_t expectedPrior{ 0u }; uint32_t expectedPrior{ 0u };
......
...@@ -1223,8 +1223,11 @@ namespace RTC ...@@ -1223,8 +1223,11 @@ namespace RTC
} }
} }
// Only perform RTP inactivity check on simulcast.
auto useRtpInactivityCheck = this->type == RtpParameters::Type::SIMULCAST;
// Create a RtpStreamRecv for receiving a media stream. // Create a RtpStreamRecv for receiving a media stream.
auto* rtpStream = new RTC::RtpStreamRecv(this, params, SendNackDelay); auto* rtpStream = new RTC::RtpStreamRecv(this, params, SendNackDelay, useRtpInactivityCheck);
// Insert into the maps. // Insert into the maps.
this->mapSsrcRtpStream[ssrc] = rtpStream; this->mapSsrcRtpStream[ssrc] = rtpStream;
......
...@@ -189,8 +189,12 @@ namespace RTC ...@@ -189,8 +189,12 @@ namespace RTC
/* Instance methods. */ /* Instance methods. */
RtpStreamRecv::RtpStreamRecv( RtpStreamRecv::RtpStreamRecv(
RTC::RtpStreamRecv::Listener* listener, RTC::RtpStream::Params& params, unsigned int sendNackDelayMs) RTC::RtpStreamRecv::Listener* listener,
RTC::RtpStream::Params& params,
unsigned int sendNackDelayMs,
bool useRtpInactivityCheck)
: RTC::RtpStream::RtpStream(listener, params, 10), sendNackDelayMs(sendNackDelayMs), : RTC::RtpStream::RtpStream(listener, params, 10), sendNackDelayMs(sendNackDelayMs),
useRtpInactivityCheck(useRtpInactivityCheck),
transmissionCounter( transmissionCounter(
params.spatialLayers, params.temporalLayers, this->params.useDtx ? 6000 : 2500) params.spatialLayers, params.temporalLayers, this->params.useDtx ? 6000 : 2500)
{ {
...@@ -201,18 +205,16 @@ namespace RTC ...@@ -201,18 +205,16 @@ namespace RTC
this->nackGenerator.reset(new RTC::NackGenerator(this, this->sendNackDelayMs)); this->nackGenerator.reset(new RTC::NackGenerator(this, this->sendNackDelayMs));
} }
// Run the RTP inactivity periodic timer (use a different timeout if DTX is this->inactive = false;
// enabled).
this->inactivityCheckPeriodicTimer = new Timer(this);
this->inactive = false;
if (!this->params.useDtx) if (this->useRtpInactivityCheck)
{ {
this->inactivityCheckPeriodicTimer->Start(InactivityCheckInterval); // Run the RTP inactivity periodic timer (use a different timeout if DTX is
} // enabled).
else this->inactivityCheckPeriodicTimer = new Timer(this);
{
this->inactivityCheckPeriodicTimer->Start(InactivityCheckIntervalWithDtx); this->inactivityCheckPeriodicTimer->Start(
this->params.useDtx ? InactivityCheckIntervalWithDtx : InactivityCheckInterval);
} }
} }
...@@ -222,6 +224,7 @@ namespace RTC ...@@ -222,6 +224,7 @@ namespace RTC
// Close the RTP inactivity check periodic timer. // Close the RTP inactivity check periodic timer.
delete this->inactivityCheckPeriodicTimer; delete this->inactivityCheckPeriodicTimer;
this->inactivityCheckPeriodicTimer = nullptr;
} }
void RtpStreamRecv::FillJsonStats(json& jsonObject) void RtpStreamRecv::FillJsonStats(json& jsonObject)
......
...@@ -11,6 +11,7 @@ using namespace RTC; ...@@ -11,6 +11,7 @@ using namespace RTC;
// 17: 16 bit mask + the initial sequence number. // 17: 16 bit mask + the initial sequence number.
static constexpr size_t MaxRequestedPackets{ 17 }; static constexpr size_t MaxRequestedPackets{ 17 };
static constexpr unsigned int SendNackDelay{ 0u }; // In ms. static constexpr unsigned int SendNackDelay{ 0u }; // In ms.
static const bool UseRtpInactivityCheck{ false };
SCENARIO("receive RTP packets and trigger NACK", "[rtp][rtpstream]") SCENARIO("receive RTP packets and trigger NACK", "[rtp][rtpstream]")
{ {
...@@ -141,7 +142,7 @@ SCENARIO("receive RTP packets and trigger NACK", "[rtp][rtpstream]") ...@@ -141,7 +142,7 @@ SCENARIO("receive RTP packets and trigger NACK", "[rtp][rtpstream]")
SECTION("NACK one packet") SECTION("NACK one packet")
{ {
RtpStreamRecvListener listener; RtpStreamRecvListener listener;
RtpStreamRecv rtpStream(&listener, params, SendNackDelay); RtpStreamRecv rtpStream(&listener, params, SendNackDelay, UseRtpInactivityCheck);
packet->SetSequenceNumber(1); packet->SetSequenceNumber(1);
rtpStream.ReceivePacket(packet); rtpStream.ReceivePacket(packet);
...@@ -170,7 +171,7 @@ SCENARIO("receive RTP packets and trigger NACK", "[rtp][rtpstream]") ...@@ -170,7 +171,7 @@ SCENARIO("receive RTP packets and trigger NACK", "[rtp][rtpstream]")
SECTION("wrapping sequence numbers") SECTION("wrapping sequence numbers")
{ {
RtpStreamRecvListener listener; RtpStreamRecvListener listener;
RtpStreamRecv rtpStream(&listener, params, SendNackDelay); RtpStreamRecv rtpStream(&listener, params, SendNackDelay, UseRtpInactivityCheck);
packet->SetSequenceNumber(0xfffe); packet->SetSequenceNumber(0xfffe);
rtpStream.ReceivePacket(packet); rtpStream.ReceivePacket(packet);
...@@ -190,7 +191,7 @@ SCENARIO("receive RTP packets and trigger NACK", "[rtp][rtpstream]") ...@@ -190,7 +191,7 @@ SCENARIO("receive RTP packets and trigger NACK", "[rtp][rtpstream]")
SECTION("require key frame") SECTION("require key frame")
{ {
RtpStreamRecvListener listener; RtpStreamRecvListener listener;
RtpStreamRecv rtpStream(&listener, params, SendNackDelay); RtpStreamRecv rtpStream(&listener, params, SendNackDelay, UseRtpInactivityCheck);
packet->SetSequenceNumber(1); packet->SetSequenceNumber(1);
rtpStream.ReceivePacket(packet); rtpStream.ReceivePacket(packet);
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论