提交 af04dc66 authored 作者: José Luis Millán's avatar José Luis Millán

C++ cleanup: cppcheck

上级 db8b6df8
...@@ -88,7 +88,7 @@ namespace RTC ...@@ -88,7 +88,7 @@ namespace RTC
class PayloadDescriptorHandler : public RTC::Codecs::PayloadDescriptorHandler class PayloadDescriptorHandler : public RTC::Codecs::PayloadDescriptorHandler
{ {
public: public:
PayloadDescriptorHandler(PayloadDescriptor* payloadDescriptor); explicit PayloadDescriptorHandler(PayloadDescriptor* payloadDescriptor);
~PayloadDescriptorHandler() = default; ~PayloadDescriptorHandler() = default;
public: public:
......
...@@ -40,7 +40,7 @@ namespace RTC ...@@ -40,7 +40,7 @@ namespace RTC
}; };
public: public:
IceServer(Listener* listener, std::string usernameFragment, std::string password); IceServer(Listener* listener, const std::string& usernameFragment, const std::string& password);
void Destroy(); void Destroy();
void ProcessStunMessage(RTC::StunMessage* msg, RTC::TransportTuple* tuple); void ProcessStunMessage(RTC::StunMessage* msg, RTC::TransportTuple* tuple);
......
...@@ -13,6 +13,9 @@ namespace RTC ...@@ -13,6 +13,9 @@ namespace RTC
{ {
class CompoundPacket class CompoundPacket
{ {
public:
CompoundPacket() = default;
public: public:
const uint8_t* GetData() const; const uint8_t* GetData() const;
size_t GetSize() const; size_t GetSize() const;
......
...@@ -46,7 +46,6 @@ namespace RTC ...@@ -46,7 +46,6 @@ namespace RTC
}; };
protected: protected:
static const int64_t processIntervalMs{ 500 };
static const int64_t streamTimeOutMs{ 2000 }; static const int64_t streamTimeOutMs{ 2000 };
public: public:
...@@ -67,18 +66,6 @@ namespace RTC ...@@ -67,18 +66,6 @@ namespace RTC
// currently being received and of which the bitrate estimate is based upon. // currently being received and of which the bitrate estimate is based upon.
virtual bool LatestEstimate(std::vector<uint32_t>* ssrcs, uint32_t* bitrateBps) const = 0; virtual bool LatestEstimate(std::vector<uint32_t>* ssrcs, uint32_t* bitrateBps) const = 0;
virtual void SetMinBitrate(int minBitrateBps) = 0; virtual void SetMinBitrate(int minBitrateBps) = 0;
// (jmillan) borrowed from webrtc/modules/include/module.h.
//
// Returns the number of milliseconds until the module wants a worker
// thread to call Process.
// This method is called on the same worker thread as Process will
// be called on.
// TODO(tommi): Almost all implementations of this function, need to know
// the current tick count. Consider passing it as an argument. It could
// also improve the accuracy of when the next callback occurs since the
// thread that calls Process() will also have it's tick count reference
// which might not match with what the implementations use.
virtual int64_t TimeUntilNextProcess() = 0;
// Process any pending tasks such as timeouts. // Process any pending tasks such as timeouts.
// Called on a worker thread. // Called on a worker thread.
virtual void Process() = 0; virtual void Process() = 0;
......
...@@ -63,7 +63,6 @@ namespace RTC ...@@ -63,7 +63,6 @@ namespace RTC
// This class relies on Process() being called periodically (at least once // This class relies on Process() being called periodically (at least once
// every other second) for streams to be timed out properly. // every other second) for streams to be timed out properly.
void Process() override; void Process() override;
int64_t TimeUntilNextProcess() override;
void OnRttUpdate(int64_t avgRttMs, int64_t maxRttMs) override; void OnRttUpdate(int64_t avgRttMs, int64_t maxRttMs) override;
void RemoveStream(uint32_t ssrc) override; void RemoveStream(uint32_t ssrc) override;
bool LatestEstimate(std::vector<uint32_t>* ssrcs, uint32_t* bitrateBps) const override; bool LatestEstimate(std::vector<uint32_t>* ssrcs, uint32_t* bitrateBps) const override;
...@@ -137,13 +136,6 @@ namespace RTC ...@@ -137,13 +136,6 @@ namespace RTC
{ {
} }
inline int64_t RemoteBitrateEstimatorAbsSendTime::TimeUntilNextProcess()
{
static const int64_t DisabledModuleTime{ 1000 };
return DisabledModuleTime;
}
inline void RemoteBitrateEstimatorAbsSendTime::OnRttUpdate(int64_t avgRttMs, int64_t /*maxRttMs*/) inline void RemoteBitrateEstimatorAbsSendTime::OnRttUpdate(int64_t avgRttMs, int64_t /*maxRttMs*/)
{ {
this->remoteRate.SetRtt(avgRttMs); this->remoteRate.SetRtt(avgRttMs);
......
...@@ -39,7 +39,6 @@ namespace RTC ...@@ -39,7 +39,6 @@ namespace RTC
const RtpPacket& packet, const RtpPacket& packet,
uint32_t transmissionTimeOffset) override; uint32_t transmissionTimeOffset) override;
void Process() override; void Process() override;
int64_t TimeUntilNextProcess() override;
void OnRttUpdate(int64_t avgRttMs, int64_t maxRttMs) override; void OnRttUpdate(int64_t avgRttMs, int64_t maxRttMs) override;
void RemoveStream(uint32_t ssrc) override; void RemoveStream(uint32_t ssrc) override;
bool LatestEstimate(std::vector<uint32_t>* ssrcs, uint32_t* bitrateBps) const override; bool LatestEstimate(std::vector<uint32_t>* ssrcs, uint32_t* bitrateBps) const override;
...@@ -80,7 +79,7 @@ namespace RTC ...@@ -80,7 +79,7 @@ namespace RTC
std::unique_ptr<AimdRateControl> remoteRate; std::unique_ptr<AimdRateControl> remoteRate;
Listener* observer{ nullptr }; Listener* observer{ nullptr };
int64_t lastProcessTime{ -1 }; int64_t lastProcessTime{ -1 };
int64_t processIntervalMs{ 0 }; int64_t processIntervalMs{ 500 };
bool umaRecorded{ false }; bool umaRecorded{ false };
}; };
...@@ -95,8 +94,7 @@ namespace RTC ...@@ -95,8 +94,7 @@ namespace RTC
} }
inline RemoteBitrateEstimatorSingleStream::RemoteBitrateEstimatorSingleStream(Listener* observer) inline RemoteBitrateEstimatorSingleStream::RemoteBitrateEstimatorSingleStream(Listener* observer)
: incomingBitrate(), remoteRate(new AimdRateControl()), observer(observer), : incomingBitrate(), remoteRate(new AimdRateControl()), observer(observer)
processIntervalMs(RemoteBitrateEstimator::processIntervalMs)
{ {
// assert(this->observer); // assert(this->observer);
} }
......
...@@ -49,6 +49,9 @@ namespace RTC ...@@ -49,6 +49,9 @@ namespace RTC
class RtpDataCounter class RtpDataCounter
{ {
public:
RtpDataCounter() = default;
public: public:
void Update(RTC::RtpPacket* packet); void Update(RTC::RtpPacket* packet);
uint32_t GetRate(uint64_t now); uint32_t GetRate(uint64_t now);
......
...@@ -160,7 +160,7 @@ namespace RTC ...@@ -160,7 +160,7 @@ namespace RTC
{ {
public: public:
RtpCodecParameters(){}; RtpCodecParameters(){};
RtpCodecParameters(Json::Value& data); explicit RtpCodecParameters(Json::Value& data);
Json::Value ToJson() const; Json::Value ToJson() const;
......
...@@ -134,7 +134,7 @@ namespace RTC ...@@ -134,7 +134,7 @@ namespace RTC
RtpListener rtpListener; RtpListener rtpListener;
struct HeaderExtensionIds headerExtensionIds; struct HeaderExtensionIds headerExtensionIds;
// Others (Mirroring). // Others (Mirroring).
MirroringOptions mirroringOptions; MirroringOptions mirroringOptions{};
struct sockaddr_storage mirrorAddrStorage struct sockaddr_storage mirrorAddrStorage
{ {
}; };
......
...@@ -15,7 +15,7 @@ namespace RTC ...@@ -15,7 +15,7 @@ namespace RTC
/* Instance methods. */ /* Instance methods. */
IceServer::IceServer(Listener* listener, std::string usernameFragment, std::string password) IceServer::IceServer(Listener* listener, const std::string& usernameFragment, const std::string& password)
: listener(listener), usernameFragment(std::move(usernameFragment)), : listener(listener), usernameFragment(std::move(usernameFragment)),
password(std::move(password)) password(std::move(password))
{ {
......
...@@ -27,12 +27,11 @@ namespace RTC ...@@ -27,12 +27,11 @@ namespace RTC
struct RtpMapping& rtpMapping, struct RtpMapping& rtpMapping,
bool paused) bool paused)
: producerId(producerId), kind(kind), notifier(notifier), transport(transport), : producerId(producerId), kind(kind), notifier(notifier), transport(transport),
rtpParameters(rtpParameters), paused(paused) rtpParameters(rtpParameters), rtpMapping(rtpMapping), paused(paused)
{ {
MS_TRACE(); MS_TRACE();
this->outputEncodings = this->rtpParameters.encodings; this->outputEncodings = this->rtpParameters.encodings;
this->rtpMapping = rtpMapping;
// Fill ids of well known RTP header extensions with the mapped ids (if any). // Fill ids of well known RTP header extensions with the mapped ids (if any).
FillHeaderExtensionIds(); FillHeaderExtensionIds();
......
...@@ -48,15 +48,6 @@ namespace RTC ...@@ -48,15 +48,6 @@ namespace RTC
return keys; return keys;
} }
uint32_t convertMsTo24Bits(int64_t timeMs)
{
uint32_t time24Bits =
static_cast<uint32_t>(((static_cast<uint64_t>(timeMs) << AbsSendTimeFraction) + 500) / 1000) &
0x00FFFFFF;
return time24Bits;
}
bool RemoteBitrateEstimatorAbsSendTime::IsWithinClusterBounds( bool RemoteBitrateEstimatorAbsSendTime::IsWithinClusterBounds(
int sendDeltaMs, const Cluster& clusterAggregate) int sendDeltaMs, const Cluster& clusterAggregate)
{ {
......
...@@ -109,17 +109,6 @@ namespace RTC ...@@ -109,17 +109,6 @@ namespace RTC
} }
} }
int64_t RemoteBitrateEstimatorSingleStream::TimeUntilNextProcess()
{
MS_TRACE();
if (this->lastProcessTime < 0)
return 0;
// MS_ASSERT(this->processIntervalMs > 0);
return this->lastProcessTime + this->processIntervalMs - DepLibUV::GetTime();
}
void RemoteBitrateEstimatorSingleStream::UpdateEstimate(int64_t nowMs) void RemoteBitrateEstimatorSingleStream::UpdateEstimate(int64_t nowMs)
{ {
MS_TRACE(); MS_TRACE();
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论