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 @@
### 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)).
* 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).
......
......@@ -45,7 +45,8 @@ namespace RTC
RtpStreamRecv(
RTC::RtpStreamRecv::Listener* listener,
RTC::RtpStream::Params& params,
unsigned int sendNackDelayMs);
unsigned int sendNackDelayMs,
bool useRtpInactivityCheck);
~RtpStreamRecv();
void FillJsonStats(json& jsonObject) override;
......@@ -96,6 +97,7 @@ namespace RTC
private:
// Passed by argument.
unsigned int sendNackDelayMs{ 0u };
bool useRtpInactivityCheck{ false };
// Others.
// Packets expected at last interval.
uint32_t expectedPrior{ 0u };
......
......@@ -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.
auto* rtpStream = new RTC::RtpStreamRecv(this, params, SendNackDelay);
auto* rtpStream = new RTC::RtpStreamRecv(this, params, SendNackDelay, useRtpInactivityCheck);
// Insert into the maps.
this->mapSsrcRtpStream[ssrc] = rtpStream;
......
......@@ -189,8 +189,12 @@ namespace RTC
/* Instance methods. */
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),
useRtpInactivityCheck(useRtpInactivityCheck),
transmissionCounter(
params.spatialLayers, params.temporalLayers, this->params.useDtx ? 6000 : 2500)
{
......@@ -201,18 +205,16 @@ namespace RTC
this->nackGenerator.reset(new RTC::NackGenerator(this, this->sendNackDelayMs));
}
// Run the RTP inactivity periodic timer (use a different timeout if DTX is
// enabled).
this->inactivityCheckPeriodicTimer = new Timer(this);
this->inactive = false;
this->inactive = false;
if (!this->params.useDtx)
if (this->useRtpInactivityCheck)
{
this->inactivityCheckPeriodicTimer->Start(InactivityCheckInterval);
}
else
{
this->inactivityCheckPeriodicTimer->Start(InactivityCheckIntervalWithDtx);
// Run the RTP inactivity periodic timer (use a different timeout if DTX is
// enabled).
this->inactivityCheckPeriodicTimer = new Timer(this);
this->inactivityCheckPeriodicTimer->Start(
this->params.useDtx ? InactivityCheckIntervalWithDtx : InactivityCheckInterval);
}
}
......@@ -222,6 +224,7 @@ namespace RTC
// Close the RTP inactivity check periodic timer.
delete this->inactivityCheckPeriodicTimer;
this->inactivityCheckPeriodicTimer = nullptr;
}
void RtpStreamRecv::FillJsonStats(json& jsonObject)
......
......@@ -11,6 +11,7 @@ using namespace RTC;
// 17: 16 bit mask + the initial sequence number.
static constexpr size_t MaxRequestedPackets{ 17 };
static constexpr unsigned int SendNackDelay{ 0u }; // In ms.
static const bool UseRtpInactivityCheck{ false };
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")
{
RtpStreamRecvListener listener;
RtpStreamRecv rtpStream(&listener, params, SendNackDelay);
RtpStreamRecv rtpStream(&listener, params, SendNackDelay, UseRtpInactivityCheck);
packet->SetSequenceNumber(1);
rtpStream.ReceivePacket(packet);
......@@ -170,7 +171,7 @@ SCENARIO("receive RTP packets and trigger NACK", "[rtp][rtpstream]")
SECTION("wrapping sequence numbers")
{
RtpStreamRecvListener listener;
RtpStreamRecv rtpStream(&listener, params, SendNackDelay);
RtpStreamRecv rtpStream(&listener, params, SendNackDelay, UseRtpInactivityCheck);
packet->SetSequenceNumber(0xfffe);
rtpStream.ReceivePacket(packet);
......@@ -190,7 +191,7 @@ SCENARIO("receive RTP packets and trigger NACK", "[rtp][rtpstream]")
SECTION("require key frame")
{
RtpStreamRecvListener listener;
RtpStreamRecv rtpStream(&listener, params, SendNackDelay);
RtpStreamRecv rtpStream(&listener, params, SendNackDelay, UseRtpInactivityCheck);
packet->SetSequenceNumber(1);
rtpStream.ReceivePacket(packet);
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论