提交 2584ae44 authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

Update NPM devs and add brackets in C++

上级 6c984ae6
差异被折叠。
...@@ -95,15 +95,15 @@ ...@@ -95,15 +95,15 @@
"@types/jest": "^29.5.0", "@types/jest": "^29.5.0",
"@types/node": "^18.15.11", "@types/node": "^18.15.11",
"@types/uuid": "^9.0.1", "@types/uuid": "^9.0.1",
"@typescript-eslint/eslint-plugin": "^5.57.0", "@typescript-eslint/eslint-plugin": "^5.57.1",
"@typescript-eslint/parser": "^5.57.0", "@typescript-eslint/parser": "^5.57.1",
"eslint": "^8.37.0", "eslint": "^8.37.0",
"eslint-plugin-jest": "^27.2.1", "eslint-plugin-jest": "^27.2.1",
"jest": "^29.5.0", "jest": "^29.5.0",
"open-cli": "^7.2.0", "open-cli": "^7.2.0",
"pick-port": "^1.0.1", "pick-port": "^1.0.1",
"sctp": "^1.0.0", "sctp": "^1.0.0",
"ts-jest": "^29.0.5", "ts-jest": "^29.1.0",
"tsc-watch": "^6.0.0", "tsc-watch": "^6.0.0",
"typescript": "^5.0.3" "typescript": "^5.0.3"
} }
......
...@@ -215,17 +215,20 @@ namespace RTC ...@@ -215,17 +215,20 @@ namespace RTC
MS_TRACE(); MS_TRACE();
// Update packet loss history. // Update packet loss history.
const size_t expected_packets = feedback->GetPacketStatusCount(); const size_t expectedPackets = feedback->GetPacketStatusCount();
size_t lost_packets = 0; size_t lostPackets = 0;
for (const auto& result : feedback->GetPacketResults()) for (const auto& result : feedback->GetPacketResults())
{ {
if (!result.received) if (!result.received)
lost_packets += 1; {
lostPackets += 1;
}
} }
if (expected_packets > 0) if (expectedPackets > 0)
{ {
this->UpdatePacketLoss(static_cast<double>(lost_packets) / expected_packets); this->UpdatePacketLoss(static_cast<double>(lostPackets) / expectedPackets);
} }
if (this->rtpTransportControllerSend == nullptr) if (this->rtpTransportControllerSend == nullptr)
...@@ -240,7 +243,9 @@ namespace RTC ...@@ -240,7 +243,9 @@ namespace RTC
{ {
// Add the score into the histogram. // Add the score into the histogram.
if (this->packetLossHistory.size() == PacketLossHistogramLength) if (this->packetLossHistory.size() == PacketLossHistogramLength)
{
this->packetLossHistory.pop_front(); this->packetLossHistory.pop_front();
}
this->packetLossHistory.push_back(packetLoss); this->packetLossHistory.push_back(packetLoss);
...@@ -307,9 +312,13 @@ namespace RTC ...@@ -307,9 +312,13 @@ namespace RTC
// Manage it via trending and increase it a bit to avoid immediate oscillations. // Manage it via trending and increase it a bit to avoid immediate oscillations.
#ifdef USE_TREND_CALCULATOR #ifdef USE_TREND_CALCULATOR
if (!force) if (!force)
{
this->desiredBitrateTrend.Update(desiredBitrate, nowMs); this->desiredBitrateTrend.Update(desiredBitrate, nowMs);
}
else else
{
this->desiredBitrateTrend.ForceUpdate(desiredBitrate, nowMs); this->desiredBitrateTrend.ForceUpdate(desiredBitrate, nowMs);
}
#endif #endif
this->bitrates.desiredBitrate = desiredBitrate; this->bitrates.desiredBitrate = desiredBitrate;
...@@ -516,9 +525,13 @@ namespace RTC ...@@ -516,9 +525,13 @@ namespace RTC
// Update availableBitrate. // Update availableBitrate.
// NOTE: Just in case. // NOTE: Just in case.
if (targetTransferRate.target_rate.bps() > std::numeric_limits<uint32_t>::max()) if (targetTransferRate.target_rate.bps() > std::numeric_limits<uint32_t>::max())
{
this->bitrates.availableBitrate = std::numeric_limits<uint32_t>::max(); this->bitrates.availableBitrate = std::numeric_limits<uint32_t>::max();
}
else else
{
this->bitrates.availableBitrate = static_cast<uint32_t>(targetTransferRate.target_rate.bps()); this->bitrates.availableBitrate = static_cast<uint32_t>(targetTransferRate.target_rate.bps());
}
MS_DEBUG_DEV("new available bitrate:%" PRIu32, this->bitrates.availableBitrate); MS_DEBUG_DEV("new available bitrate:%" PRIu32, this->bitrates.availableBitrate);
......
...@@ -120,7 +120,9 @@ namespace RTC ...@@ -120,7 +120,9 @@ namespace RTC
uint16_t wideSeqNumber; uint16_t wideSeqNumber;
if (!packet->ReadTransportWideCc01(wideSeqNumber)) if (!packet->ReadTransportWideCc01(wideSeqNumber))
{
break; break;
}
// Update the RTCP media SSRC of the ongoing Transport-CC Feedback packet. // Update the RTCP media SSRC of the ongoing Transport-CC Feedback packet.
this->transportCcFeedbackSenderSsrc = 0u; this->transportCcFeedbackSenderSsrc = 0u;
...@@ -186,7 +188,9 @@ namespace RTC ...@@ -186,7 +188,9 @@ namespace RTC
uint32_t absSendTime; uint32_t absSendTime;
if (!packet->ReadAbsSendTime(absSendTime)) if (!packet->ReadAbsSendTime(absSendTime))
{
break; break;
}
// NOTE: nowMs is uint64_t but we need to "convert" it to int64_t before // NOTE: nowMs is uint64_t but we need to "convert" it to int64_t before
// we give it to libwebrtc lib (althought this is implicit in the // we give it to libwebrtc lib (althought this is implicit in the
...@@ -222,7 +226,9 @@ namespace RTC ...@@ -222,7 +226,9 @@ namespace RTC
MS_TRACE(); MS_TRACE();
if (!this->transportCcFeedbackPacket->IsSerializable()) if (!this->transportCcFeedbackPacket->IsSerializable())
{
return; return;
}
auto latestWideSeqNumber = this->transportCcFeedbackPacket->GetLatestSequenceNumber(); auto latestWideSeqNumber = this->transportCcFeedbackPacket->GetLatestSequenceNumber();
auto latestTimestamp = this->transportCcFeedbackPacket->GetLatestTimestamp(); auto latestTimestamp = this->transportCcFeedbackPacket->GetLatestTimestamp();
...@@ -232,17 +238,20 @@ namespace RTC ...@@ -232,17 +238,20 @@ namespace RTC
this, this->transportCcFeedbackPacket.get()); this, this->transportCcFeedbackPacket.get());
// Update packet loss history. // Update packet loss history.
const size_t expected_packets = this->transportCcFeedbackPacket->GetPacketStatusCount(); const size_t expectedPackets = this->transportCcFeedbackPacket->GetPacketStatusCount();
size_t lost_packets = 0; size_t lostPackets = 0;
for (const auto& result : this->transportCcFeedbackPacket->GetPacketResults()) for (const auto& result : this->transportCcFeedbackPacket->GetPacketResults())
{ {
if (!result.received) if (!result.received)
lost_packets += 1; {
lostPackets += 1;
}
} }
if (expected_packets > 0) if (expectedPackets > 0)
{ {
this->UpdatePacketLoss(static_cast<double>(lost_packets) / expected_packets); this->UpdatePacketLoss(static_cast<double>(lostPackets) / expectedPackets);
} }
// Create a new feedback packet. // Create a new feedback packet.
...@@ -268,7 +277,9 @@ namespace RTC ...@@ -268,7 +277,9 @@ namespace RTC
// May fix unlimitedRembCounter. // May fix unlimitedRembCounter.
if (this->unlimitedRembCounter > 0u && this->maxIncomingBitrate != 0u) if (this->unlimitedRembCounter > 0u && this->maxIncomingBitrate != 0u)
{
this->unlimitedRembCounter = 0u; this->unlimitedRembCounter = 0u;
}
// In case this is the first unlimited REMB packet, send it fast. // In case this is the first unlimited REMB packet, send it fast.
// clang-format off // clang-format off
...@@ -298,15 +309,19 @@ namespace RTC ...@@ -298,15 +309,19 @@ namespace RTC
this->limitationRembSentAtMs = nowMs; this->limitationRembSentAtMs = nowMs;
if (this->unlimitedRembCounter > 0u) if (this->unlimitedRembCounter > 0u)
{
this->unlimitedRembCounter--; this->unlimitedRembCounter--;
} }
} }
}
void TransportCongestionControlServer::UpdatePacketLoss(double packetLoss) void TransportCongestionControlServer::UpdatePacketLoss(double packetLoss)
{ {
// Add the score into the histogram. // Add the score into the histogram.
if (this->packetLossHistory.size() == PacketLossHistogramLength) if (this->packetLossHistory.size() == PacketLossHistogramLength)
{
this->packetLossHistory.pop_front(); this->packetLossHistory.pop_front();
}
this->packetLossHistory.push_back(packetLoss); this->packetLossHistory.push_back(packetLoss);
...@@ -337,7 +352,9 @@ namespace RTC ...@@ -337,7 +352,9 @@ namespace RTC
// Limit announced bitrate if requested via API. // Limit announced bitrate if requested via API.
if (this->maxIncomingBitrate != 0u) if (this->maxIncomingBitrate != 0u)
{
availableBitrate = std::min(availableBitrate, this->maxIncomingBitrate); availableBitrate = std::min(availableBitrate, this->maxIncomingBitrate);
}
#if MS_LOG_DEV_LEVEL == 3 #if MS_LOG_DEV_LEVEL == 3
std::ostringstream ssrcsStream; std::ostringstream ssrcsStream;
...@@ -369,6 +386,8 @@ namespace RTC ...@@ -369,6 +386,8 @@ namespace RTC
MS_TRACE(); MS_TRACE();
if (timer == this->transportCcFeedbackSendPeriodicTimer) if (timer == this->transportCcFeedbackSendPeriodicTimer)
{
SendTransportCcFeedback(); SendTransportCcFeedback();
} }
}
} // namespace RTC } // namespace RTC
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论