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