提交 780b2aaa authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

- Improve key frame request logs

- Rename Transport::timer to Transport::rtcpTimer
上级 ca67ef70
...@@ -198,7 +198,7 @@ namespace RTC ...@@ -198,7 +198,7 @@ namespace RTC
RTC::SrtpSession* srtpRecvSession{ nullptr }; RTC::SrtpSession* srtpRecvSession{ nullptr };
RTC::SrtpSession* srtpSendSession{ nullptr }; RTC::SrtpSession* srtpSendSession{ nullptr };
// Others. // Others.
Timer* timer{ nullptr }; Timer* rtcpTimer{ nullptr };
bool allocated{ false }; bool allocated{ false };
// Others (Producers and Consumers). // Others (Producers and Consumers).
std::unordered_set<RTC::Producer*> producers; std::unordered_set<RTC::Producer*> producers;
......
...@@ -385,9 +385,7 @@ namespace RTC ...@@ -385,9 +385,7 @@ namespace RTC
this->syncRequired = false; this->syncRequired = false;
MS_DEBUG_TAG( MS_DEBUG_TAG(rtp, "re-syncing Consumer stream [seqNum:%" PRIu16 "]", this->seqNum);
rtp,
"re-syncing Consumer stream [seqNum:%" PRIu16 "]", this->seqNum);
} }
else else
{ {
...@@ -397,8 +395,7 @@ namespace RTC ...@@ -397,8 +395,7 @@ namespace RTC
this->rtpTimestamp = this->rtpTimestamp =
(packet->GetTimestamp() - this->rtpTimestampBase) + this->rtpTimestampPreviousBase + 1; (packet->GetTimestamp() - this->rtpTimestampBase) + this->rtpTimestampPreviousBase + 1;
this->seqNum = this->seqNum = (packet->GetSequenceNumber() - this->seqNumBase) + this->seqNumPreviousBase + 1;
(packet->GetSequenceNumber() - this->seqNumBase) + this->seqNumPreviousBase + 1;
// Save the received SSRC. // Save the received SSRC.
this->lastReceivedSsrc = packet->GetSsrc(); this->lastReceivedSsrc = packet->GetSsrc();
......
...@@ -199,6 +199,8 @@ namespace RTC ...@@ -199,6 +199,8 @@ namespace RTC
listener->OnProducerResumed(this); listener->OnProducerResumed(this);
} }
MS_DEBUG_TAG(rtcp, "requesting full frame after resumed");
RequestKeyFrame(true); RequestKeyFrame(true);
} }
...@@ -419,7 +421,7 @@ namespace RTC ...@@ -419,7 +421,7 @@ namespace RTC
} }
else if (this->keyFrameRequestBlockTimer->IsActive()) else if (this->keyFrameRequestBlockTimer->IsActive())
{ {
MS_DEBUG_TAG(rtcp, "blocking key frame request until timer expires"); MS_DEBUG_TAG(rtcp, "blocking key frame due to flood protection");
// Set flag. // Set flag.
this->isKeyFrameRequested = true; this->isKeyFrameRequested = true;
...@@ -863,7 +865,7 @@ namespace RTC ...@@ -863,7 +865,7 @@ namespace RTC
if (!this->isKeyFrameRequested) if (!this->isKeyFrameRequested)
return; return;
MS_DEBUG_TAG(rtcp, "requesting key frame after timer expires"); MS_DEBUG_TAG(rtcp, "key frame requested during flood protection, requesting it now");
RequestKeyFrame(); RequestKeyFrame();
} }
......
...@@ -245,6 +245,8 @@ namespace RTC ...@@ -245,6 +245,8 @@ namespace RTC
{ {
MS_TRACE(); MS_TRACE();
MS_DEBUG_TAG(rtx, "requesting key frame [ssrc:%" PRIu32 "]", this->params.ssrc);
RequestKeyFrame(); RequestKeyFrame();
} }
......
...@@ -175,10 +175,10 @@ namespace RTC ...@@ -175,10 +175,10 @@ namespace RTC
this->dtlsTransport = new RTC::DtlsTransport(this); this->dtlsTransport = new RTC::DtlsTransport(this);
// Create the RTCP timer. // Create the RTCP timer.
this->timer = new Timer(this); this->rtcpTimer = new Timer(this);
// Start the RTCP timer. // Start the RTCP timer.
this->timer->Start(static_cast<uint64_t>(RTC::RTCP::MaxVideoIntervalMs / 2)); this->rtcpTimer->Start(static_cast<uint64_t>(RTC::RTCP::MaxVideoIntervalMs / 2));
// Hack to avoid that Destroy() above attempts to delete this. // Hack to avoid that Destroy() above attempts to delete this.
this->allocated = true; this->allocated = true;
...@@ -189,7 +189,7 @@ namespace RTC ...@@ -189,7 +189,7 @@ namespace RTC
MS_TRACE(); MS_TRACE();
// Destroy the RTCP timer. // Destroy the RTCP timer.
this->timer->Destroy(); this->rtcpTimer->Destroy();
} }
void Transport::Destroy() void Transport::Destroy()
...@@ -736,6 +736,14 @@ namespace RTC ...@@ -736,6 +736,14 @@ namespace RTC
break; break;
} }
MS_DEBUG_TAG(
rtcp,
"%s received, requesting key frame for Consumer "
"[sender ssrc:%" PRIu32 ", media ssrc:%" PRIu32 "]",
RTCP::FeedbackPsPacket::MessageType2String(feedback->GetMessageType()).c_str(),
feedback->GetMediaSsrc(),
feedback->GetMediaSsrc());
consumer->RequestKeyFrame(); consumer->RequestKeyFrame();
break; break;
...@@ -1559,7 +1567,7 @@ namespace RTC ...@@ -1559,7 +1567,7 @@ namespace RTC
static_cast<double>(effectiveBitrate) / static_cast<double>(this->effectiveMaxBitrate) < static_cast<double>(effectiveBitrate) / static_cast<double>(this->effectiveMaxBitrate) <
EffectiveMaxBitrateThresholdBeforeKeyFrame) EffectiveMaxBitrateThresholdBeforeKeyFrame)
{ {
MS_WARN_TAG(rbe, "uplink effective max bitrate abruptly decrease, requesting key frames"); MS_WARN_TAG(rbe, "uplink effective max bitrate abruptly decreased, requesting key frames");
// Request key frame for all the Producers. // Request key frame for all the Producers.
for (auto* producer : this->producers) for (auto* producer : this->producers)
...@@ -1636,7 +1644,9 @@ namespace RTC ...@@ -1636,7 +1644,9 @@ namespace RTC
// Do nothing. // Do nothing.
} }
void Transport::OnTimer(Timer* /*timer*/) void Transport::OnTimer(Timer* timer)
{
if (timer == this->rtcpTimer)
{ {
uint64_t interval = RTC::RTCP::MaxVideoIntervalMs; uint64_t interval = RTC::RTCP::MaxVideoIntervalMs;
uint32_t now = DepLibUV::GetTime(); uint32_t now = DepLibUV::GetTime();
...@@ -1669,6 +1679,7 @@ namespace RTC ...@@ -1669,6 +1679,7 @@ namespace RTC
* of all participants. * of all participants.
*/ */
interval *= static_cast<float>(Utils::Crypto::GetRandomUInt(5, 15)) / 10; interval *= static_cast<float>(Utils::Crypto::GetRandomUInt(5, 15)) / 10;
this->timer->Start(interval); this->rtcpTimer->Start(interval);
}
} }
} // namespace RTC } // namespace RTC
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论