提交 67698cd8 authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

RtpStreamRecv: fix NackGenerator usage regression

上级 bf650b79
...@@ -63,21 +63,27 @@ namespace RTC ...@@ -63,21 +63,27 @@ namespace RTC
return false; return false;
} }
// Calculate Jitter.
CalculateJitter(packet->GetTimestamp());
// Process the packet at codec level. // Process the packet at codec level.
if (packet->GetPayloadType() == GetPayloadType()) if (packet->GetPayloadType() == GetPayloadType())
RTC::Codecs::ProcessRtpPacket(packet, GetMimeType()); RTC::Codecs::ProcessRtpPacket(packet, GetMimeType());
// Pass the packet to the NackGenerator if there is no RTX, so if the // Pass the packet to the NackGenerator.
// NackGenerator returns true it means that it was a NACKed packet. if (this->params.useNack)
if (this->params.useNack && !HasRtx() && this->nackGenerator->ReceivePacket(packet)) {
// If there is RTX just provide the NackGenerator with the packet.
if (HasRtx())
{
this->nackGenerator->ReceivePacket(packet);
}
// If there is no RTX and NackGenerator returns true it means that it
// was a NACKed packet.
else if (this->nackGenerator->ReceivePacket(packet))
{ {
// Mark the packet as retransmitted and repaired. // Mark the packet as retransmitted and repaired.
RTC::RtpStream::PacketRetransmitted(packet); RTC::RtpStream::PacketRetransmitted(packet);
RTC::RtpStream::PacketRepaired(packet); RTC::RtpStream::PacketRepaired(packet);
} }
}
// Ensure the inactivityCheckPeriodicTimer runs (unless DTX is enabled). // Ensure the inactivityCheckPeriodicTimer runs (unless DTX is enabled).
if (!this->params.useDtx && !this->inactivityCheckPeriodicTimer->IsActive()) if (!this->params.useDtx && !this->inactivityCheckPeriodicTimer->IsActive())
...@@ -86,6 +92,9 @@ namespace RTC ...@@ -86,6 +92,9 @@ namespace RTC
this->inactivityCheckPeriodicTimer->Restart(); this->inactivityCheckPeriodicTimer->Restart();
} }
// Calculate Jitter.
CalculateJitter(packet->GetTimestamp());
// Increase transmission counter. // Increase transmission counter.
this->transmissionCounter.Update(packet); this->transmissionCounter.Update(packet);
...@@ -423,14 +432,14 @@ namespace RTC ...@@ -423,14 +432,14 @@ namespace RTC
} }
} }
MS_ERROR( // MS_ERROR(
"fixed values [expected:%" PRIu32 ",received:%" PRIu32 ", lost:%" PRIu32 ", repaired:%" PRIu32 // "fixed values [expected:%" PRIu32 ",received:%" PRIu32 ", lost:%" PRIu32 ", repaired:%" PRIu32
", retransmitted:%" PRIu32, // ", retransmitted:%" PRIu32,
expected, // expected,
received, // received,
lost, // lost,
repaired, // repaired,
retransmitted); // retransmitted);
float repairedRatio = static_cast<float>(repaired) / static_cast<float>(received); float repairedRatio = static_cast<float>(repaired) / static_cast<float>(received);
auto repairedWeight = std::pow(1 / (repairedRatio + 1), 4); auto repairedWeight = std::pow(1 / (repairedRatio + 1), 4);
...@@ -442,19 +451,19 @@ namespace RTC ...@@ -442,19 +451,19 @@ namespace RTC
lost -= repaired * repairedWeight; lost -= repaired * repairedWeight;
MS_ERROR( // MS_ERROR(
"[repairedRatio:%f, repairedWeight:%f, new lost:%" PRIu32 "]", // "[repairedRatio:%f, repairedWeight:%f, new lost:%" PRIu32 "]",
repairedRatio, // repairedRatio,
repairedWeight, // repairedWeight,
lost); // lost);
float deliveredRatio = static_cast<float>(received - lost) / static_cast<float>(received); float deliveredRatio = static_cast<float>(received - lost) / static_cast<float>(received);
auto score = std::round(std::pow(deliveredRatio, 4) * 10); auto score = std::round(std::pow(deliveredRatio, 4) * 10);
MS_ERROR("RESULT [deliveredRatio:%f, score:%f]", deliveredRatio, score); // MS_ERROR("RESULT [deliveredRatio:%f, score:%f]", deliveredRatio, score);
MS_ERROR("==========\n"); // MS_ERROR("==========\n");
#ifdef MS_LOG_DEV #ifdef MS_LOG_DEV
MS_DEBUG_TAG( MS_DEBUG_TAG(
......
...@@ -555,12 +555,12 @@ namespace RTC ...@@ -555,12 +555,12 @@ namespace RTC
} }
} }
MS_ERROR( // MS_ERROR(
"fixed values [sent:%zu, lost:%" PRIu32 ", repaired:%" PRIu32 ", retransmitted:%" PRIu32, // "fixed values [sent:%zu, lost:%" PRIu32 ", repaired:%" PRIu32 ", retransmitted:%" PRIu32,
sent, // sent,
lost, // lost,
repaired, // repaired,
retransmitted); // retransmitted);
float repairedRatio = static_cast<float>(repaired) / static_cast<float>(sent); float repairedRatio = static_cast<float>(repaired) / static_cast<float>(sent);
auto repairedWeight = std::pow(1 / (repairedRatio + 1), 4); auto repairedWeight = std::pow(1 / (repairedRatio + 1), 4);
...@@ -572,19 +572,19 @@ namespace RTC ...@@ -572,19 +572,19 @@ namespace RTC
lost -= repaired * repairedWeight; lost -= repaired * repairedWeight;
MS_ERROR( // MS_ERROR(
"[repairedRatio:%f, repairedWeight:%f, new lost:%" PRIu32 "]", // "[repairedRatio:%f, repairedWeight:%f, new lost:%" PRIu32 "]",
repairedRatio, // repairedRatio,
repairedWeight, // repairedWeight,
lost); // lost);
float deliveredRatio = static_cast<float>(sent - lost) / static_cast<float>(sent); float deliveredRatio = static_cast<float>(sent - lost) / static_cast<float>(sent);
auto score = std::round(std::pow(deliveredRatio, 4) * 10); auto score = std::round(std::pow(deliveredRatio, 4) * 10);
MS_ERROR("RESULT [deliveredRatio:%f, score:%f]", deliveredRatio, score); // MS_ERROR("RESULT [deliveredRatio:%f, score:%f]", deliveredRatio, score);
MS_ERROR("++++++++++\n"); // MS_ERROR("++++++++++\n");
#ifdef MS_LOG_DEV #ifdef MS_LOG_DEV
MS_DEBUG_TAG( MS_DEBUG_TAG(
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论