提交 6ceef2c1 authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

Make cppcheck and flint++happy:

- Use nullptr instead of NULL
- Set explicit constructor in single argument constructors or constructor with default arguments
上级 600b59a3
...@@ -17,7 +17,7 @@ namespace RTC ...@@ -17,7 +17,7 @@ namespace RTC
static constexpr size_t defaultWindowSize = 1000; static constexpr size_t defaultWindowSize = 1000;
public: public:
RateCalculator(size_t windowSize = defaultWindowSize, float scale = kBpsScale); explicit RateCalculator(size_t windowSize = defaultWindowSize, float scale = kBpsScale);
void Update(size_t count, uint64_t now); void Update(size_t count, uint64_t now);
uint32_t GetRate(uint64_t now); uint32_t GetRate(uint64_t now);
......
...@@ -292,7 +292,7 @@ namespace Utils ...@@ -292,7 +292,7 @@ namespace Utils
void Time::CurrentTimeNtp(Ntp& ntp) void Time::CurrentTimeNtp(Ntp& ntp)
{ {
struct timeval tv; struct timeval tv;
gettimeofday(&tv, NULL); gettimeofday(&tv, nullptr);
ntp.seconds = tv.tv_sec + UnixNtpOffset; ntp.seconds = tv.tv_sec + UnixNtpOffset;
ntp.fractions = (uint32_t)((double)(tv.tv_usec) * NtpFractionalUnit * 1.0e-6); ntp.fractions = (uint32_t)((double)(tv.tv_usec) * NtpFractionalUnit * 1.0e-6);
......
...@@ -953,17 +953,19 @@ namespace RTC ...@@ -953,17 +953,19 @@ namespace RTC
uint64_t interval = RTC::RTCP::MAX_VIDEO_INTERVAL_MS; uint64_t interval = RTC::RTCP::MAX_VIDEO_INTERVAL_MS;
uint32_t now = DepLibUV::GetTime(); uint32_t now = DepLibUV::GetTime();
// Transmission rate in kbps.
uint32_t rate = 0;
this->SendRtcp(now); this->SendRtcp(now);
// Recalculate next RTCP interval. // Recalculate next RTCP interval.
if (this->rtpSenders.size()) { if (this->rtpSenders.size())
{
// Transmission rate in kbps.
uint32_t rate = 0;
// Get the RTP sending rate. // Get the RTP sending rate.
for (auto& kv : this->rtpSenders) for (auto& kv : this->rtpSenders)
{ {
RTC::RtpSender* rtpSender = kv.second; RTC::RtpSender* rtpSender = kv.second;
rate += rtpSender->GetTransmissionRate(now) / 1000; rate += rtpSender->GetTransmissionRate(now) / 1000;
} }
...@@ -975,8 +977,8 @@ namespace RTC ...@@ -975,8 +977,8 @@ namespace RTC
interval = RTC::RTCP::MAX_VIDEO_INTERVAL_MS; interval = RTC::RTCP::MAX_VIDEO_INTERVAL_MS;
} }
/*
/* The interval between RTCP packets is varied randomly over the range * The interval between RTCP packets is varied randomly over the range
* [0.5,1.5] times the calculated interval to avoid unintended synchronization * [0.5,1.5] times the calculated interval to avoid unintended synchronization
* of all participants. * of all participants.
*/ */
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论