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

C++: const all the things! (fixes #69 and majes @jmillan happy)

上级 44bbc6d1
...@@ -118,16 +118,16 @@ namespace RTC ...@@ -118,16 +118,16 @@ namespace RTC
virtual ~DtlsTransport(); virtual ~DtlsTransport();
void Close(); void Close();
void Dump(); void Dump() const;
void Run(Role localRole); void Run(Role localRole);
void SetRemoteFingerprint(Fingerprint fingerprint); void SetRemoteFingerprint(Fingerprint fingerprint);
void ProcessDtlsData(const uint8_t* data, size_t len); void ProcessDtlsData(const uint8_t* data, size_t len);
DtlsState GetState(); DtlsState GetState() const;
Role GetLocalRole(); Role GetLocalRole() const;
void SendApplicationData(const uint8_t* data, size_t len); void SendApplicationData(const uint8_t* data, size_t len);
private: private:
bool IsRunning(); bool IsRunning() const;
void Reset(); void Reset();
bool CheckStatus(int return_code); bool CheckStatus(int return_code);
void SendPendingOutgoingDtlsData(); void SendPendingOutgoingDtlsData();
...@@ -206,7 +206,19 @@ namespace RTC ...@@ -206,7 +206,19 @@ namespace RTC
/* Inline instance methods. */ /* Inline instance methods. */
inline inline
bool DtlsTransport::IsRunning() DtlsTransport::DtlsState DtlsTransport::GetState() const
{
return this->state;
}
inline
DtlsTransport::Role DtlsTransport::GetLocalRole() const
{
return this->localRole;
}
inline
bool DtlsTransport::IsRunning() const
{ {
switch (this->state) switch (this->state)
{ {
...@@ -223,18 +235,6 @@ namespace RTC ...@@ -223,18 +235,6 @@ namespace RTC
// Make GCC 4.9 happy. // Make GCC 4.9 happy.
return false; return false;
} }
inline
DtlsTransport::DtlsState DtlsTransport::GetState()
{
return this->state;
}
inline
DtlsTransport::Role DtlsTransport::GetLocalRole()
{
return this->localRole;
}
} }
#endif #endif
...@@ -46,10 +46,10 @@ namespace RTC ...@@ -46,10 +46,10 @@ namespace RTC
void Close(); void Close();
void ProcessStunMessage(RTC::StunMessage* msg, RTC::TransportTuple* tuple); void ProcessStunMessage(RTC::StunMessage* msg, RTC::TransportTuple* tuple);
std::string& GetUsernameFragment(); const std::string& GetUsernameFragment() const;
std::string& GetPassword(); const std::string& GetPassword() const;
IceState GetState(); IceState GetState() const;
bool IsValidTuple(RTC::TransportTuple* tuple); bool IsValidTuple(RTC::TransportTuple* tuple) const;
void RemoveTuple(RTC::TransportTuple* tuple); void RemoveTuple(RTC::TransportTuple* tuple);
// This should be just called in 'connected' or completed' state // This should be just called in 'connected' or completed' state
// and the given tuple must be an already valid tuple. // and the given tuple must be an already valid tuple.
...@@ -64,7 +64,7 @@ namespace RTC ...@@ -64,7 +64,7 @@ namespace RTC
/** /**
* If the given tuple exists return its stored address, nullptr otherwise. * If the given tuple exists return its stored address, nullptr otherwise.
*/ */
RTC::TransportTuple* HasTuple(RTC::TransportTuple* tuple); RTC::TransportTuple* HasTuple(RTC::TransportTuple* tuple) const;
/** /**
* Set the given tuple as the selected tuple. * Set the given tuple as the selected tuple.
* NOTE: The given tuple MUST be already stored within the list. * NOTE: The given tuple MUST be already stored within the list.
...@@ -82,22 +82,22 @@ namespace RTC ...@@ -82,22 +82,22 @@ namespace RTC
RTC::TransportTuple* selectedTuple = nullptr; RTC::TransportTuple* selectedTuple = nullptr;
}; };
/* Inline methods. */ /* Inline instance methods. */
inline inline
std::string& IceServer::GetUsernameFragment() const std::string& IceServer::GetUsernameFragment() const
{ {
return this->usernameFragment; return this->usernameFragment;
} }
inline inline
std::string& IceServer::GetPassword() const std::string& IceServer::GetPassword() const
{ {
return this->password; return this->password;
} }
inline inline
IceServer::IceState IceServer::GetState() IceServer::IceState IceServer::GetState() const
{ {
return this->state; return this->state;
} }
......
...@@ -64,7 +64,7 @@ namespace RTC ...@@ -64,7 +64,7 @@ namespace RTC
public: public:
Parameters() {}; Parameters() {};
Json::Value toJson(); Json::Value toJson() const;
void Set(Json::Value& data); void Set(Json::Value& data);
bool HasBoolean(std::string& key); bool HasBoolean(std::string& key);
......
...@@ -50,25 +50,25 @@ namespace RTC ...@@ -50,25 +50,25 @@ namespace RTC
virtual ~Peer(); virtual ~Peer();
void Close(); void Close();
Json::Value toJson(); Json::Value toJson() const;
void HandleRequest(Channel::Request* request); void HandleRequest(Channel::Request* request);
bool HasCapabilities(); bool HasCapabilities() const;
std::vector<RTC::RtpReceiver*> GetRtpReceivers(); std::vector<RTC::RtpReceiver*> GetRtpReceivers() const;
std::vector<RTC::RtpSender*> GetRtpSenders(); std::vector<RTC::RtpSender*> GetRtpSenders() const;
std::unordered_map<uint32_t, RTC::Transport*>& GetTransports(); const std::unordered_map<uint32_t, RTC::Transport*>& GetTransports() const;
/** /**
* Add a new RtpSender to the Peer. * Add a new RtpSender to the Peer.
* @param rtpSender Instance of RtpSender. * @param rtpSender Instance of RtpSender.
* @param peerName Name of the receiver Peer. * @param peerName Name of the receiver Peer.
*/ */
void AddRtpSender(RTC::RtpSender* rtpSender, std::string& peerName, RTC::RtpParameters* rtpParameters); void AddRtpSender(RTC::RtpSender* rtpSender, std::string& peerName, RTC::RtpParameters* rtpParameters);
RTC::RtpSender* GetRtpSender(uint32_t ssrc); RTC::RtpSender* GetRtpSender(uint32_t ssrc) const;
void SendRtcp(uint64_t now); void SendRtcp(uint64_t now);
private: private:
RTC::Transport* GetTransportFromRequest(Channel::Request* request, uint32_t* transportId = nullptr); RTC::Transport* GetTransportFromRequest(Channel::Request* request, uint32_t* transportId = nullptr) const;
RTC::RtpReceiver* GetRtpReceiverFromRequest(Channel::Request* request, uint32_t* rtpReceiverId = nullptr); RTC::RtpReceiver* GetRtpReceiverFromRequest(Channel::Request* request, uint32_t* rtpReceiverId = nullptr) const;
RTC::RtpSender* GetRtpSenderFromRequest(Channel::Request* request, uint32_t* rtpSenderId = nullptr); RTC::RtpSender* GetRtpSenderFromRequest(Channel::Request* request, uint32_t* rtpSenderId = nullptr) const;
/* Pure virtual methods inherited from RTC::Transport::Listener. */ /* Pure virtual methods inherited from RTC::Transport::Listener. */
public: public:
...@@ -111,13 +111,13 @@ namespace RTC ...@@ -111,13 +111,13 @@ namespace RTC
/* Inline methods. */ /* Inline methods. */
inline inline
bool Peer::HasCapabilities() bool Peer::HasCapabilities() const
{ {
return this->hasCapabilities; return this->hasCapabilities;
} }
inline inline
std::vector<RTC::RtpReceiver*> Peer::GetRtpReceivers() std::vector<RTC::RtpReceiver*> Peer::GetRtpReceivers() const
{ {
std::vector<RTC::RtpReceiver*> rtpReceivers; std::vector<RTC::RtpReceiver*> rtpReceivers;
...@@ -130,7 +130,7 @@ namespace RTC ...@@ -130,7 +130,7 @@ namespace RTC
} }
inline inline
std::vector<RTC::RtpSender*> Peer::GetRtpSenders() std::vector<RTC::RtpSender*> Peer::GetRtpSenders() const
{ {
std::vector<RTC::RtpSender*> rtpSenders; std::vector<RTC::RtpSender*> rtpSenders;
...@@ -143,7 +143,7 @@ namespace RTC ...@@ -143,7 +143,7 @@ namespace RTC
} }
inline inline
std::unordered_map<uint32_t, RTC::Transport*>& Peer::GetTransports() const std::unordered_map<uint32_t, RTC::Transport*>& Peer::GetTransports() const
{ {
return this->transports; return this->transports;
} }
......
...@@ -23,7 +23,7 @@ namespace RTC { namespace RTCP ...@@ -23,7 +23,7 @@ namespace RTC { namespace RTCP
void AddSsrc(uint32_t ssrc); void AddSsrc(uint32_t ssrc);
void SetReason(const std::string& reason); void SetReason(const std::string& reason);
const std::string& GetReason(); const std::string& GetReason() const;
Iterator Begin(); Iterator Begin();
Iterator End(); Iterator End();
...@@ -31,8 +31,8 @@ namespace RTC { namespace RTCP ...@@ -31,8 +31,8 @@ namespace RTC { namespace RTCP
public: public:
virtual void Dump() override; virtual void Dump() override;
virtual size_t Serialize(uint8_t* buffer) override; virtual size_t Serialize(uint8_t* buffer) override;
virtual size_t GetCount() override; virtual size_t GetCount() const override;
virtual size_t GetSize() override; virtual size_t GetSize() const override;
private: private:
std::vector<uint32_t> ssrcs; std::vector<uint32_t> ssrcs;
...@@ -47,15 +47,16 @@ namespace RTC { namespace RTCP ...@@ -47,15 +47,16 @@ namespace RTC { namespace RTCP
{} {}
inline inline
size_t ByePacket::GetCount() size_t ByePacket::GetCount() const
{ {
return this->ssrcs.size(); return this->ssrcs.size();
} }
inline inline
size_t ByePacket::GetSize() size_t ByePacket::GetSize() const
{ {
size_t size = sizeof(Packet::CommonHeader); size_t size = sizeof(Packet::CommonHeader);
size += ssrcs.size() * sizeof(uint32_t); size += ssrcs.size() * sizeof(uint32_t);
if (!this->reason.empty()) if (!this->reason.empty())
...@@ -82,7 +83,7 @@ namespace RTC { namespace RTCP ...@@ -82,7 +83,7 @@ namespace RTC { namespace RTCP
} }
inline inline
const std::string& ByePacket::GetReason() const std::string& ByePacket::GetReason() const
{ {
return this->reason; return this->reason;
} }
......
...@@ -12,10 +12,10 @@ namespace RTC { namespace RTCP ...@@ -12,10 +12,10 @@ namespace RTC { namespace RTCP
class CompoundPacket class CompoundPacket
{ {
public: public:
const uint8_t* GetData(); const uint8_t* GetData() const;
size_t GetSize(); size_t GetSize() const;
size_t GetSenderReportCount(); size_t GetSenderReportCount() const;
size_t GetReceiverReportCount(); size_t GetReceiverReportCount() const;
void Dump(); void Dump();
void AddSenderReport(SenderReport* report); void AddSenderReport(SenderReport* report);
void AddReceiverReport(ReceiverReport* report); void AddReceiverReport(ReceiverReport* report);
...@@ -33,25 +33,25 @@ namespace RTC { namespace RTCP ...@@ -33,25 +33,25 @@ namespace RTC { namespace RTCP
/* Inline methods. */ /* Inline methods. */
inline inline
const uint8_t* CompoundPacket::GetData() const uint8_t* CompoundPacket::GetData() const
{ {
return this->header; return this->header;
} }
inline inline
size_t CompoundPacket::GetSize() size_t CompoundPacket::GetSize() const
{ {
return this->size; return this->size;
} }
inline inline
size_t CompoundPacket::GetSenderReportCount() size_t CompoundPacket::GetSenderReportCount() const
{ {
return this->senderReportPacket.GetCount(); return this->senderReportPacket.GetCount();
} }
inline inline
size_t CompoundPacket::GetReceiverReportCount() size_t CompoundPacket::GetReceiverReportCount() const
{ {
return this->receiverReportPacket.GetCount(); return this->receiverReportPacket.GetCount();
} }
......
...@@ -27,18 +27,18 @@ namespace RTC { namespace RTCP ...@@ -27,18 +27,18 @@ namespace RTC { namespace RTCP
static std::map<typename T::MessageType, std::string> type2String; static std::map<typename T::MessageType, std::string> type2String;
public: public:
typename T::MessageType GetMessageType(); typename T::MessageType GetMessageType() const;
uint32_t GetSenderSsrc(); uint32_t GetSenderSsrc() const;
void SetSenderSsrc(uint32_t ssrc); void SetSenderSsrc(uint32_t ssrc);
uint32_t GetMediaSsrc(); uint32_t GetMediaSsrc() const;
void SetMediaSsrc(uint32_t ssrc); void SetMediaSsrc(uint32_t ssrc);
/* Pure virtual methods inherited from Packet. */ /* Pure virtual methods inherited from Packet. */
public: public:
virtual void Dump() override; virtual void Dump() override;
virtual size_t Serialize(uint8_t* buffer) override; virtual size_t Serialize(uint8_t* buffer) override;
virtual size_t GetCount() override; virtual size_t GetCount() const override;
virtual size_t GetSize() override; virtual size_t GetSize() const override;
protected: protected:
explicit FeedbackPacket(CommonHeader* commonHeader); explicit FeedbackPacket(CommonHeader* commonHeader);
...@@ -93,25 +93,25 @@ namespace RTC { namespace RTCP ...@@ -93,25 +93,25 @@ namespace RTC { namespace RTCP
/* Inline instance methods. */ /* Inline instance methods. */
template <typename T> template <typename T>
typename T::MessageType FeedbackPacket<T>::GetMessageType() typename T::MessageType FeedbackPacket<T>::GetMessageType() const
{ {
return this->messageType; return this->messageType;
} }
template <typename T> template <typename T>
size_t FeedbackPacket<T>::GetCount() size_t FeedbackPacket<T>::GetCount() const
{ {
return (size_t)this->GetMessageType(); return (size_t)this->GetMessageType();
} }
template <typename T> template <typename T>
size_t FeedbackPacket<T>::GetSize() size_t FeedbackPacket<T>::GetSize() const
{ {
return sizeof(CommonHeader) + sizeof(Header); return sizeof(CommonHeader) + sizeof(Header);
} }
template <typename T> template <typename T>
uint32_t FeedbackPacket<T>::GetSenderSsrc() uint32_t FeedbackPacket<T>::GetSenderSsrc() const
{ {
return (uint32_t)ntohl(this->header->s_ssrc); return (uint32_t)ntohl(this->header->s_ssrc);
} }
...@@ -123,7 +123,7 @@ namespace RTC { namespace RTCP ...@@ -123,7 +123,7 @@ namespace RTC { namespace RTCP
} }
template <typename T> template <typename T>
uint32_t FeedbackPacket<T>::GetMediaSsrc() uint32_t FeedbackPacket<T>::GetMediaSsrc() const
{ {
return (uint32_t)ntohl(this->header->m_ssrc); return (uint32_t)ntohl(this->header->m_ssrc);
} }
......
...@@ -8,7 +8,7 @@ namespace RTC { namespace RTCP ...@@ -8,7 +8,7 @@ namespace RTC { namespace RTCP
class FeedbackItem class FeedbackItem
{ {
public: public:
bool IsCorrect(); bool IsCorrect() const;
protected: protected:
virtual ~FeedbackItem(); virtual ~FeedbackItem();
...@@ -17,7 +17,7 @@ namespace RTC { namespace RTCP ...@@ -17,7 +17,7 @@ namespace RTC { namespace RTCP
virtual void Dump() = 0; virtual void Dump() = 0;
virtual void Serialize(); virtual void Serialize();
virtual size_t Serialize(uint8_t* buffer) = 0; virtual size_t Serialize(uint8_t* buffer) = 0;
virtual size_t GetSize() = 0; virtual size_t GetSize() const = 0;
protected: protected:
uint8_t* raw = nullptr; uint8_t* raw = nullptr;
...@@ -44,7 +44,7 @@ namespace RTC { namespace RTCP ...@@ -44,7 +44,7 @@ namespace RTC { namespace RTCP
} }
inline inline
bool FeedbackItem::IsCorrect() bool FeedbackItem::IsCorrect() const
{ {
return this->isCorrect; return this->isCorrect;
} }
......
...@@ -30,7 +30,7 @@ namespace RTC { namespace RTCP ...@@ -30,7 +30,7 @@ namespace RTC { namespace RTCP
public: public:
virtual void Dump() override; virtual void Dump() override;
virtual size_t Serialize(uint8_t* buffer) override; virtual size_t Serialize(uint8_t* buffer) override;
virtual size_t GetSize() override; virtual size_t GetSize() const override;
private: private:
std::vector<Item*> items; std::vector<Item*> items;
...@@ -49,7 +49,7 @@ namespace RTC { namespace RTCP ...@@ -49,7 +49,7 @@ namespace RTC { namespace RTCP
{} {}
template<typename Item> template<typename Item>
size_t FeedbackPsItemPacket<Item>::GetSize() size_t FeedbackPsItemPacket<Item>::GetSize() const
{ {
size_t size = FeedbackPsPacket::GetSize(); size_t size = FeedbackPsPacket::GetSize();
......
...@@ -18,13 +18,13 @@ namespace RTC { namespace RTCP ...@@ -18,13 +18,13 @@ namespace RTC { namespace RTCP
FeedbackPsAfbPacket(uint32_t sender_ssrc, uint32_t media_ssrc); FeedbackPsAfbPacket(uint32_t sender_ssrc, uint32_t media_ssrc);
virtual ~FeedbackPsAfbPacket() {}; virtual ~FeedbackPsAfbPacket() {};
uint8_t* GetData(); uint8_t* GetData() const;
/* Pure virtual methods inherited from Packet. */ /* Pure virtual methods inherited from Packet. */
public: public:
virtual void Dump() override; virtual void Dump() override;
virtual size_t Serialize(uint8_t* buffer) override; virtual size_t Serialize(uint8_t* buffer) override;
virtual size_t GetSize() override; virtual size_t GetSize() const override;
private: private:
uint8_t* data = nullptr; uint8_t* data = nullptr;
...@@ -47,13 +47,13 @@ namespace RTC { namespace RTCP ...@@ -47,13 +47,13 @@ namespace RTC { namespace RTCP
{} {}
inline inline
uint8_t* FeedbackPsAfbPacket::GetData() uint8_t* FeedbackPsAfbPacket::GetData() const
{ {
return this->data; return this->data;
} }
inline inline
size_t FeedbackPsAfbPacket::GetSize() size_t FeedbackPsAfbPacket::GetSize() const
{ {
return FeedbackPsPacket::GetSize() + this->size; return FeedbackPsPacket::GetSize() + this->size;
} }
......
...@@ -41,14 +41,14 @@ namespace RTC { namespace RTCP ...@@ -41,14 +41,14 @@ namespace RTC { namespace RTCP
FirItem(uint32_t ssrc, uint8_t sequence_number); FirItem(uint32_t ssrc, uint8_t sequence_number);
virtual ~FirItem() {}; virtual ~FirItem() {};
uint32_t GetSsrc(); uint32_t GetSsrc() const;
uint8_t GetSequenceNumber(); uint8_t GetSequenceNumber() const;
/* Virtual methods inherited from FeedbackItem. */ /* Virtual methods inherited from FeedbackItem. */
public: public:
virtual void Dump() override; virtual void Dump() override;
virtual size_t Serialize(uint8_t* buffer) override; virtual size_t Serialize(uint8_t* buffer) override;
virtual size_t GetSize() override; virtual size_t GetSize() const override;
private: private:
Header* header = nullptr; Header* header = nullptr;
...@@ -70,19 +70,19 @@ namespace RTC { namespace RTCP ...@@ -70,19 +70,19 @@ namespace RTC { namespace RTCP
{} {}
inline inline
size_t FirItem::GetSize() size_t FirItem::GetSize() const
{ {
return sizeof(Header); return sizeof(Header);
} }
inline inline
uint32_t FirItem::GetSsrc() uint32_t FirItem::GetSsrc() const
{ {
return (uint32_t)ntohl(this->header->ssrc); return (uint32_t)ntohl(this->header->ssrc);
} }
inline inline
uint8_t FirItem::GetSequenceNumber() uint8_t FirItem::GetSequenceNumber() const
{ {
return (uint8_t)this->header->sequence_number; return (uint8_t)this->header->sequence_number;
} }
......
...@@ -36,13 +36,13 @@ namespace RTC { namespace RTCP ...@@ -36,13 +36,13 @@ namespace RTC { namespace RTCP
explicit PsLeiItem(uint32_t ssrc); explicit PsLeiItem(uint32_t ssrc);
virtual ~PsLeiItem() {}; virtual ~PsLeiItem() {};
uint32_t GetSsrc(); uint32_t GetSsrc() const;
/* Virtual methods inherited from FeedbackItem. */ /* Virtual methods inherited from FeedbackItem. */
public: public:
virtual void Dump() override; virtual void Dump() override;
virtual size_t Serialize(uint8_t* buffer) override; virtual size_t Serialize(uint8_t* buffer) override;
virtual size_t GetSize() override; virtual size_t GetSize() const override;
private: private:
Header* header = nullptr; Header* header = nullptr;
...@@ -64,13 +64,13 @@ namespace RTC { namespace RTCP ...@@ -64,13 +64,13 @@ namespace RTC { namespace RTCP
{} {}
inline inline
size_t PsLeiItem::GetSize() size_t PsLeiItem::GetSize() const
{ {
return sizeof(Header); return sizeof(Header);
} }
inline inline
uint32_t PsLeiItem::GetSsrc() uint32_t PsLeiItem::GetSsrc() const
{ {
return (uint32_t)ntohl(this->header->ssrc); return (uint32_t)ntohl(this->header->ssrc);
} }
......
...@@ -46,16 +46,16 @@ namespace RTC { namespace RTCP ...@@ -46,16 +46,16 @@ namespace RTC { namespace RTCP
RpsiItem(uint8_t payload_type, uint8_t* bit_string, size_t length); RpsiItem(uint8_t payload_type, uint8_t* bit_string, size_t length);
virtual ~RpsiItem() {}; virtual ~RpsiItem() {};
bool IsCorrect(); bool IsCorrect() const;
uint8_t GetPayloadType(); uint8_t GetPayloadType() const;
uint8_t* GetBitString(); uint8_t* GetBitString() const;
size_t GetLength(); size_t GetLength() const;
/* Virtual methods inherited from FeedbackItem. */ /* Virtual methods inherited from FeedbackItem. */
public: public:
virtual void Dump() override; virtual void Dump() override;
virtual size_t Serialize(uint8_t* buffer) override; virtual size_t Serialize(uint8_t* buffer) override;
virtual size_t GetSize() override; virtual size_t GetSize() const override;
private: private:
Header* header = nullptr; Header* header = nullptr;
...@@ -73,31 +73,31 @@ namespace RTC { namespace RTCP ...@@ -73,31 +73,31 @@ namespace RTC { namespace RTCP
{} {}
inline inline
size_t RpsiItem::GetSize() size_t RpsiItem::GetSize() const
{ {
return sizeof(Header); return sizeof(Header);
} }
inline inline
uint8_t RpsiItem::GetPayloadType() uint8_t RpsiItem::GetPayloadType() const
{ {
return this->header->payload_type; return this->header->payload_type;
} }
inline inline
uint8_t* RpsiItem::GetBitString() uint8_t* RpsiItem::GetBitString() const
{ {
return this->header->bit_string; return this->header->bit_string;
} }
inline inline
size_t RpsiItem::GetLength() size_t RpsiItem::GetLength() const
{ {
return this->length; return this->length;
} }
inline inline
bool RpsiItem::IsCorrect() bool RpsiItem::IsCorrect() const
{ {
return this->isCorrect; return this->isCorrect;
} }
......
...@@ -36,18 +36,18 @@ namespace RTC { namespace RTCP ...@@ -36,18 +36,18 @@ namespace RTC { namespace RTCP
SliItem(uint16_t first, uint16_t number, uint8_t pictureId); SliItem(uint16_t first, uint16_t number, uint8_t pictureId);
virtual ~SliItem() {}; virtual ~SliItem() {};
uint16_t GetFirst(); uint16_t GetFirst() const;
void SetFirst(uint16_t first); void SetFirst(uint16_t first);
uint16_t GetNumber(); uint16_t GetNumber() const;
void SetNumber(uint16_t number); void SetNumber(uint16_t number);
uint8_t GetPictureId(); uint8_t GetPictureId() const;
void SetPictureId(uint8_t pictureId); void SetPictureId(uint8_t pictureId);
/* Virtual methods inherited from FeedbackItem. */ /* Virtual methods inherited from FeedbackItem. */
public: public:
virtual void Dump() override; virtual void Dump() override;
virtual size_t Serialize(uint8_t* buffer) override; virtual size_t Serialize(uint8_t* buffer) override;
virtual size_t GetSize() override; virtual size_t GetSize() const override;
private: private:
Header* header = nullptr; Header* header = nullptr;
...@@ -62,13 +62,13 @@ namespace RTC { namespace RTCP ...@@ -62,13 +62,13 @@ namespace RTC { namespace RTCP
/* Inline instance methods. */ /* Inline instance methods. */
inline inline
size_t SliItem::GetSize() size_t SliItem::GetSize() const
{ {
return sizeof(Header); return sizeof(Header);
} }
inline inline
uint16_t SliItem::GetFirst() uint16_t SliItem::GetFirst() const
{ {
return this->first; return this->first;
} }
...@@ -80,7 +80,7 @@ namespace RTC { namespace RTCP ...@@ -80,7 +80,7 @@ namespace RTC { namespace RTCP
} }
inline inline
uint16_t SliItem::GetNumber() uint16_t SliItem::GetNumber() const
{ {
return this->number; return this->number;
} }
...@@ -92,7 +92,7 @@ namespace RTC { namespace RTCP ...@@ -92,7 +92,7 @@ namespace RTC { namespace RTCP
} }
inline inline
uint8_t SliItem::GetPictureId() uint8_t SliItem::GetPictureId() const
{ {
return this->pictureId; return this->pictureId;
} }
......
...@@ -43,15 +43,15 @@ namespace RTC { namespace RTCP ...@@ -43,15 +43,15 @@ namespace RTC { namespace RTCP
TstItem(uint32_t ssrc, uint8_t sequenceNumber, uint8_t index); TstItem(uint32_t ssrc, uint8_t sequenceNumber, uint8_t index);
virtual ~TstItem() {}; virtual ~TstItem() {};
uint32_t GetSsrc(); uint32_t GetSsrc() const;
uint8_t GetSequenceNumber(); uint8_t GetSequenceNumber() const;
uint8_t GetIndex(); uint8_t GetIndex() const;
/* Virtual methods inherited from FeedbackItem. */ /* Virtual methods inherited from FeedbackItem. */
public: public:
virtual void Dump() override; virtual void Dump() override;
virtual size_t Serialize(uint8_t* buffer) override; virtual size_t Serialize(uint8_t* buffer) override;
virtual size_t GetSize() override; virtual size_t GetSize() const override;
private: private:
Header* header = nullptr; Header* header = nullptr;
...@@ -81,25 +81,25 @@ namespace RTC { namespace RTCP ...@@ -81,25 +81,25 @@ namespace RTC { namespace RTCP
{} {}
template <typename T> template <typename T>
size_t TstItem<T>::GetSize() size_t TstItem<T>::GetSize() const
{ {
return sizeof(Header); return sizeof(Header);
} }
template <typename T> template <typename T>
uint32_t TstItem<T>::GetSsrc() uint32_t TstItem<T>::GetSsrc() const
{ {
return (uint32_t)ntohl(this->header->ssrc); return (uint32_t)ntohl(this->header->ssrc);
} }
template <typename T> template <typename T>
uint8_t TstItem<T>::GetSequenceNumber() uint8_t TstItem<T>::GetSequenceNumber() const
{ {
return (uint8_t)this->header->sequence_number; return (uint8_t)this->header->sequence_number;
} }
template <typename T> template <typename T>
uint8_t TstItem<T>::GetIndex() uint8_t TstItem<T>::GetIndex() const
{ {
return (uint8_t)this->header->index; return (uint8_t)this->header->index;
} }
......
...@@ -47,17 +47,17 @@ namespace RTC { namespace RTCP ...@@ -47,17 +47,17 @@ namespace RTC { namespace RTCP
VbcmItem(uint32_t ssrc, uint8_t sequence_number, uint8_t payload_type, uint16_t length, uint8_t* value); VbcmItem(uint32_t ssrc, uint8_t sequence_number, uint8_t payload_type, uint16_t length, uint8_t* value);
virtual ~VbcmItem() {}; virtual ~VbcmItem() {};
uint32_t GetSsrc(); uint32_t GetSsrc() const;
uint8_t GetSequenceNumber(); uint8_t GetSequenceNumber() const;
uint8_t GetPayloadType(); uint8_t GetPayloadType() const;
uint16_t GetLength(); uint16_t GetLength() const;
uint8_t* GetValue(); uint8_t* GetValue() const;
/* Virtual methods inherited from FeedbackItem. */ /* Virtual methods inherited from FeedbackItem. */
public: public:
virtual void Dump() override; virtual void Dump() override;
virtual size_t Serialize(uint8_t* buffer) override; virtual size_t Serialize(uint8_t* buffer) override;
virtual size_t GetSize() override; virtual size_t GetSize() const override;
private: private:
Header* header = nullptr; Header* header = nullptr;
...@@ -79,7 +79,7 @@ namespace RTC { namespace RTCP ...@@ -79,7 +79,7 @@ namespace RTC { namespace RTCP
{} {}
inline inline
size_t VbcmItem::GetSize() size_t VbcmItem::GetSize() const
{ {
size_t size = 8 + size_t(this->header->length); size_t size = 8 + size_t(this->header->length);
...@@ -88,31 +88,31 @@ namespace RTC { namespace RTCP ...@@ -88,31 +88,31 @@ namespace RTC { namespace RTCP
} }
inline inline
uint32_t VbcmItem::GetSsrc() uint32_t VbcmItem::GetSsrc() const
{ {
return (uint32_t)ntohl(this->header->ssrc); return (uint32_t)ntohl(this->header->ssrc);
} }
inline inline
uint8_t VbcmItem::GetSequenceNumber() uint8_t VbcmItem::GetSequenceNumber() const
{ {
return (uint8_t)this->header->sequence_number; return (uint8_t)this->header->sequence_number;
} }
inline inline
uint8_t VbcmItem::GetPayloadType() uint8_t VbcmItem::GetPayloadType() const
{ {
return (uint8_t)this->header->payload_type; return (uint8_t)this->header->payload_type;
} }
inline inline
uint16_t VbcmItem::GetLength() uint16_t VbcmItem::GetLength() const
{ {
return (uint16_t)ntohs(this->header->length); return (uint16_t)ntohs(this->header->length);
} }
inline inline
uint8_t* VbcmItem::GetValue() uint8_t* VbcmItem::GetValue() const
{ {
return this->header->value; return this->header->value;
} }
......
...@@ -30,7 +30,7 @@ namespace RTC { namespace RTCP ...@@ -30,7 +30,7 @@ namespace RTC { namespace RTCP
public: public:
virtual void Dump() override; virtual void Dump() override;
virtual size_t Serialize(uint8_t* buffer) override; virtual size_t Serialize(uint8_t* buffer) override;
virtual size_t GetSize() override; virtual size_t GetSize() const override;
private: private:
std::vector<Item*> items; std::vector<Item*> items;
...@@ -49,7 +49,7 @@ namespace RTC { namespace RTCP ...@@ -49,7 +49,7 @@ namespace RTC { namespace RTCP
{} {}
template<typename Item> template<typename Item>
size_t FeedbackRtpItemPacket<Item>::GetSize() size_t FeedbackRtpItemPacket<Item>::GetSize() const
{ {
size_t size = FeedbackRtpPacket::GetSize(); size_t size = FeedbackRtpPacket::GetSize();
......
...@@ -52,19 +52,19 @@ namespace RTC { namespace RTCP ...@@ -52,19 +52,19 @@ namespace RTC { namespace RTCP
explicit EcnItem(EcnItem* item); explicit EcnItem(EcnItem* item);
virtual ~EcnItem() {}; virtual ~EcnItem() {};
uint32_t GetSequenceNumber(); uint32_t GetSequenceNumber() const;
uint32_t GetEct0Counter(); uint32_t GetEct0Counter() const;
uint32_t GetEct1Counter(); uint32_t GetEct1Counter() const;
uint16_t GetEcnCeCounter(); uint16_t GetEcnCeCounter() const;
uint16_t GetNotEctCounter(); uint16_t GetNotEctCounter() const;
uint16_t GetLostPackets(); uint16_t GetLostPackets() const;
uint16_t GetDuplicatedPackets(); uint16_t GetDuplicatedPackets() const;
/* Virtual methods inherited from FeedbackItem. */ /* Virtual methods inherited from FeedbackItem. */
public: public:
virtual void Dump() override; virtual void Dump() override;
virtual size_t Serialize(uint8_t* buffer) override; virtual size_t Serialize(uint8_t* buffer) override;
virtual size_t GetSize() override; virtual size_t GetSize() const override;
private: private:
Header* header = nullptr; Header* header = nullptr;
...@@ -86,49 +86,49 @@ namespace RTC { namespace RTCP ...@@ -86,49 +86,49 @@ namespace RTC { namespace RTCP
{} {}
inline inline
size_t EcnItem::GetSize() size_t EcnItem::GetSize() const
{ {
return sizeof(Header); return sizeof(Header);
} }
inline inline
uint32_t EcnItem::GetSequenceNumber() uint32_t EcnItem::GetSequenceNumber() const
{ {
return ntohl(this->header->sequence_number); return ntohl(this->header->sequence_number);
} }
inline inline
uint32_t EcnItem::GetEct0Counter() uint32_t EcnItem::GetEct0Counter() const
{ {
return ntohl(this->header->ect0_counter); return ntohl(this->header->ect0_counter);
} }
inline inline
uint32_t EcnItem::GetEct1Counter() uint32_t EcnItem::GetEct1Counter() const
{ {
return ntohl(this->header->ect1_counter); return ntohl(this->header->ect1_counter);
} }
inline inline
uint16_t EcnItem::GetEcnCeCounter() uint16_t EcnItem::GetEcnCeCounter() const
{ {
return ntohs(this->header->ecn_ce_counter); return ntohs(this->header->ecn_ce_counter);
} }
inline inline
uint16_t EcnItem::GetNotEctCounter() uint16_t EcnItem::GetNotEctCounter() const
{ {
return ntohs(this->header->not_ect_counter); return ntohs(this->header->not_ect_counter);
} }
inline inline
uint16_t EcnItem::GetLostPackets() uint16_t EcnItem::GetLostPackets() const
{ {
return ntohs(this->header->lost_packets); return ntohs(this->header->lost_packets);
} }
inline inline
uint16_t EcnItem::GetDuplicatedPackets() uint16_t EcnItem::GetDuplicatedPackets() const
{ {
return ntohs(this->header->duplicated_packets); return ntohs(this->header->duplicated_packets);
} }
......
...@@ -37,14 +37,14 @@ namespace RTC { namespace RTCP ...@@ -37,14 +37,14 @@ namespace RTC { namespace RTCP
NackItem(uint16_t packetId, uint16_t lostPacketBitmask); NackItem(uint16_t packetId, uint16_t lostPacketBitmask);
virtual ~NackItem() {}; virtual ~NackItem() {};
uint16_t GetPacketId(); uint16_t GetPacketId() const;
uint16_t GetLostPacketBitmask(); uint16_t GetLostPacketBitmask() const;
/* Virtual methods inherited from FeedbackItem. */ /* Virtual methods inherited from FeedbackItem. */
public: public:
virtual void Dump() override; virtual void Dump() override;
virtual size_t Serialize(uint8_t* buffer) override; virtual size_t Serialize(uint8_t* buffer) override;
virtual size_t GetSize() override; virtual size_t GetSize() const override;
private: private:
Header* header = nullptr; Header* header = nullptr;
...@@ -66,19 +66,19 @@ namespace RTC { namespace RTCP ...@@ -66,19 +66,19 @@ namespace RTC { namespace RTCP
{} {}
inline inline
size_t NackItem::GetSize() size_t NackItem::GetSize() const
{ {
return sizeof(Header); return sizeof(Header);
} }
inline inline
uint16_t NackItem::GetPacketId() uint16_t NackItem::GetPacketId() const
{ {
return (uint16_t)ntohs(this->header->packet_id); return (uint16_t)ntohs(this->header->packet_id);
} }
inline inline
uint16_t NackItem::GetLostPacketBitmask() uint16_t NackItem::GetLostPacketBitmask() const
{ {
return (uint16_t)ntohs(this->header->lost_packet_bitmask); return (uint16_t)ntohs(this->header->lost_packet_bitmask);
} }
......
...@@ -37,14 +37,14 @@ namespace RTC { namespace RTCP ...@@ -37,14 +37,14 @@ namespace RTC { namespace RTCP
TlleiItem(uint16_t packetId, uint16_t lostPacketBitmask); TlleiItem(uint16_t packetId, uint16_t lostPacketBitmask);
virtual ~TlleiItem() {}; virtual ~TlleiItem() {};
uint16_t GetPacketId(); uint16_t GetPacketId() const;
uint16_t GetLostPacketBitmask(); uint16_t GetLostPacketBitmask() const;
/* Virtual methods inherited from FeedbackItem. */ /* Virtual methods inherited from FeedbackItem. */
public: public:
virtual void Dump() override; virtual void Dump() override;
virtual size_t Serialize(uint8_t* buffer) override; virtual size_t Serialize(uint8_t* buffer) override;
virtual size_t GetSize() override; virtual size_t GetSize() const override;
private: private:
Header* header = nullptr; Header* header = nullptr;
...@@ -66,19 +66,19 @@ namespace RTC { namespace RTCP ...@@ -66,19 +66,19 @@ namespace RTC { namespace RTCP
{} {}
inline inline
size_t TlleiItem::GetSize() size_t TlleiItem::GetSize() const
{ {
return sizeof(Header); return sizeof(Header);
} }
inline inline
uint16_t TlleiItem::GetPacketId() uint16_t TlleiItem::GetPacketId() const
{ {
return (uint16_t)ntohs(this->header->packet_id); return (uint16_t)ntohs(this->header->packet_id);
} }
inline inline
uint16_t TlleiItem::GetLostPacketBitmask() uint16_t TlleiItem::GetLostPacketBitmask() const
{ {
return (uint16_t)ntohs(this->header->lost_packet_bitmask); return (uint16_t)ntohs(this->header->lost_packet_bitmask);
} }
......
...@@ -40,18 +40,18 @@ namespace RTC { namespace RTCP ...@@ -40,18 +40,18 @@ namespace RTC { namespace RTCP
TmmbItem(uint32_t ssrc, uint64_t bitrate, uint32_t overhead); TmmbItem(uint32_t ssrc, uint64_t bitrate, uint32_t overhead);
virtual ~TmmbItem() {}; virtual ~TmmbItem() {};
uint32_t GetSsrc(); uint32_t GetSsrc() const;
void SetSsrc(uint32_t ssrc); void SetSsrc(uint32_t ssrc);
uint64_t GetBitrate(); uint64_t GetBitrate() const;
void SetBitrate(uint64_t bitrate); void SetBitrate(uint64_t bitrate);
uint16_t GetOverhead(); uint16_t GetOverhead() const;
void SetOverhead(uint16_t overhead); void SetOverhead(uint16_t overhead);
/* Virtual methods inherited from FeedbackItem. */ /* Virtual methods inherited from FeedbackItem. */
public: public:
virtual void Dump() override; virtual void Dump() override;
virtual size_t Serialize(uint8_t* buffer) override; virtual size_t Serialize(uint8_t* buffer) override;
virtual size_t GetSize() override; virtual size_t GetSize() const override;
private: private:
Header* header = nullptr; Header* header = nullptr;
...@@ -74,13 +74,13 @@ namespace RTC { namespace RTCP ...@@ -74,13 +74,13 @@ namespace RTC { namespace RTCP
/* Inline instance methods. */ /* Inline instance methods. */
template <typename T> template <typename T>
size_t TmmbItem<T>::GetSize() size_t TmmbItem<T>::GetSize() const
{ {
return sizeof(Header); return sizeof(Header);
} }
template <typename T> template <typename T>
uint32_t TmmbItem<T>::GetSsrc() uint32_t TmmbItem<T>::GetSsrc() const
{ {
return (uint32_t)ntohl(this->header->ssrc); return (uint32_t)ntohl(this->header->ssrc);
} }
...@@ -92,7 +92,7 @@ namespace RTC { namespace RTCP ...@@ -92,7 +92,7 @@ namespace RTC { namespace RTCP
} }
template <typename T> template <typename T>
uint64_t TmmbItem<T>::GetBitrate() uint64_t TmmbItem<T>::GetBitrate() const
{ {
return this->bitrate; return this->bitrate;
} }
...@@ -104,7 +104,7 @@ namespace RTC { namespace RTCP ...@@ -104,7 +104,7 @@ namespace RTC { namespace RTCP
} }
template <typename T> template <typename T>
uint16_t TmmbItem<T>::GetOverhead() uint16_t TmmbItem<T>::GetOverhead() const
{ {
return this->overhead; return this->overhead;
} }
......
...@@ -60,15 +60,15 @@ namespace RTC { namespace RTCP ...@@ -60,15 +60,15 @@ namespace RTC { namespace RTCP
virtual ~Packet(); virtual ~Packet();
void SetNext(Packet* packet); void SetNext(Packet* packet);
Packet* GetNext(); Packet* GetNext() const;
Type GetType(); Type GetType() const;
const uint8_t* GetData(); const uint8_t* GetData() const;
public: public:
virtual void Dump() = 0; virtual void Dump() = 0;
virtual size_t Serialize(uint8_t* buffer) = 0; virtual size_t Serialize(uint8_t* buffer) = 0;
virtual size_t GetCount() = 0; virtual size_t GetCount() const = 0;
virtual size_t GetSize() = 0; virtual size_t GetSize() const = 0;
private: private:
Type type; Type type;
...@@ -108,7 +108,7 @@ namespace RTC { namespace RTCP ...@@ -108,7 +108,7 @@ namespace RTC { namespace RTCP
{} {}
inline inline
Packet* Packet::GetNext() Packet* Packet::GetNext() const
{ {
return this->next; return this->next;
} }
...@@ -120,19 +120,19 @@ namespace RTC { namespace RTCP ...@@ -120,19 +120,19 @@ namespace RTC { namespace RTCP
} }
inline inline
Type Packet::GetType() Type Packet::GetType() const
{ {
return this->type; return this->type;
} }
inline inline
size_t Packet::GetCount() size_t Packet::GetCount() const
{ {
return 0; return 0;
} }
inline inline
const uint8_t* Packet::GetData() const uint8_t* Packet::GetData() const
{ {
return (uint8_t*)this->header; return (uint8_t*)this->header;
} }
......
...@@ -36,20 +36,20 @@ namespace RTC { namespace RTCP ...@@ -36,20 +36,20 @@ namespace RTC { namespace RTCP
void Dump(); void Dump();
size_t Serialize(uint8_t* buffer); size_t Serialize(uint8_t* buffer);
size_t GetSize(); size_t GetSize() const;
uint32_t GetSsrc(); uint32_t GetSsrc() const;
void SetSsrc(uint32_t ssrc); void SetSsrc(uint32_t ssrc);
uint8_t GetFractionLost(); uint8_t GetFractionLost() const;
void SetFractionLost(uint8_t fraction_lost); void SetFractionLost(uint8_t fraction_lost);
int32_t GetTotalLost(); int32_t GetTotalLost() const;
void SetTotalLost(int32_t total_lost); void SetTotalLost(int32_t total_lost);
uint32_t GetLastSeq(); uint32_t GetLastSeq() const;
void SetLastSeq(uint32_t last_seq); void SetLastSeq(uint32_t last_seq);
uint32_t GetJitter(); uint32_t GetJitter() const;
void SetJitter(uint32_t jitter); void SetJitter(uint32_t jitter);
uint32_t GetLastSenderReport(); uint32_t GetLastSenderReport() const;
void SetLastSenderReport(uint32_t lsr); void SetLastSenderReport(uint32_t lsr);
uint32_t GetDelaySinceLastSenderReport(); uint32_t GetDelaySinceLastSenderReport() const;
void SetDelaySinceLastSenderReport(uint32_t dlsr); void SetDelaySinceLastSenderReport(uint32_t dlsr);
private: private:
...@@ -70,7 +70,7 @@ namespace RTC { namespace RTCP ...@@ -70,7 +70,7 @@ namespace RTC { namespace RTCP
ReceiverReportPacket(); ReceiverReportPacket();
virtual ~ReceiverReportPacket(); virtual ~ReceiverReportPacket();
uint32_t GetSsrc(); uint32_t GetSsrc() const;
void SetSsrc(uint32_t ssrc); void SetSsrc(uint32_t ssrc);
void AddReport(ReceiverReport* report); void AddReport(ReceiverReport* report);
Iterator Begin(); Iterator Begin();
...@@ -80,8 +80,8 @@ namespace RTC { namespace RTCP ...@@ -80,8 +80,8 @@ namespace RTC { namespace RTCP
public: public:
virtual void Dump() override; virtual void Dump() override;
virtual size_t Serialize(uint8_t* buffer) override; virtual size_t Serialize(uint8_t* buffer) override;
virtual size_t GetCount() override; virtual size_t GetCount() const override;
virtual size_t GetSize() override; virtual size_t GetSize() const override;
private: private:
// SSRC of packet sender. // SSRC of packet sender.
...@@ -108,13 +108,13 @@ namespace RTC { namespace RTCP ...@@ -108,13 +108,13 @@ namespace RTC { namespace RTCP
{} {}
inline inline
size_t ReceiverReport::GetSize() size_t ReceiverReport::GetSize() const
{ {
return sizeof(Header); return sizeof(Header);
} }
inline inline
uint32_t ReceiverReport::GetSsrc() uint32_t ReceiverReport::GetSsrc() const
{ {
return (uint32_t)ntohl(this->header->ssrc); return (uint32_t)ntohl(this->header->ssrc);
} }
...@@ -126,7 +126,7 @@ namespace RTC { namespace RTCP ...@@ -126,7 +126,7 @@ namespace RTC { namespace RTCP
} }
inline inline
uint8_t ReceiverReport::GetFractionLost() uint8_t ReceiverReport::GetFractionLost() const
{ {
return (uint8_t)Utils::Byte::Get1Byte((uint8_t*)this->header, 4); return (uint8_t)Utils::Byte::Get1Byte((uint8_t*)this->header, 4);
} }
...@@ -138,7 +138,7 @@ namespace RTC { namespace RTCP ...@@ -138,7 +138,7 @@ namespace RTC { namespace RTCP
} }
inline inline
int32_t ReceiverReport::GetTotalLost() int32_t ReceiverReport::GetTotalLost() const
{ {
uint32_t value = (uint32_t)Utils::Byte::Get3Bytes((uint8_t*)this->header, 5); uint32_t value = (uint32_t)Utils::Byte::Get3Bytes((uint8_t*)this->header, 5);
...@@ -168,7 +168,7 @@ namespace RTC { namespace RTCP ...@@ -168,7 +168,7 @@ namespace RTC { namespace RTCP
} }
inline inline
uint32_t ReceiverReport::GetLastSeq() uint32_t ReceiverReport::GetLastSeq() const
{ {
return (uint32_t)ntohl(this->header->last_seq); return (uint32_t)ntohl(this->header->last_seq);
} }
...@@ -180,7 +180,7 @@ namespace RTC { namespace RTCP ...@@ -180,7 +180,7 @@ namespace RTC { namespace RTCP
} }
inline inline
uint32_t ReceiverReport::GetJitter() uint32_t ReceiverReport::GetJitter() const
{ {
return (uint32_t)ntohl(this->header->jitter); return (uint32_t)ntohl(this->header->jitter);
} }
...@@ -192,7 +192,7 @@ namespace RTC { namespace RTCP ...@@ -192,7 +192,7 @@ namespace RTC { namespace RTCP
} }
inline inline
uint32_t ReceiverReport::GetLastSenderReport() uint32_t ReceiverReport::GetLastSenderReport() const
{ {
return (uint32_t)ntohl(this->header->lsr); return (uint32_t)ntohl(this->header->lsr);
} }
...@@ -204,7 +204,7 @@ namespace RTC { namespace RTCP ...@@ -204,7 +204,7 @@ namespace RTC { namespace RTCP
} }
inline inline
uint32_t ReceiverReport::GetDelaySinceLastSenderReport() uint32_t ReceiverReport::GetDelaySinceLastSenderReport() const
{ {
return (uint32_t)ntohl(this->header->dlsr); return (uint32_t)ntohl(this->header->dlsr);
} }
...@@ -230,13 +230,13 @@ namespace RTC { namespace RTCP ...@@ -230,13 +230,13 @@ namespace RTC { namespace RTCP
} }
inline inline
size_t ReceiverReportPacket::GetCount() size_t ReceiverReportPacket::GetCount() const
{ {
return this->reports.size(); return this->reports.size();
} }
inline inline
size_t ReceiverReportPacket::GetSize() size_t ReceiverReportPacket::GetSize() const
{ {
size_t size = sizeof(Packet::CommonHeader) + sizeof(this->ssrc); size_t size = sizeof(Packet::CommonHeader) + sizeof(this->ssrc);
...@@ -249,7 +249,7 @@ namespace RTC { namespace RTCP ...@@ -249,7 +249,7 @@ namespace RTC { namespace RTCP
} }
inline inline
uint32_t ReceiverReportPacket::GetSsrc() uint32_t ReceiverReportPacket::GetSsrc() const
{ {
return (uint32_t)ntohl(this->ssrc); return (uint32_t)ntohl(this->ssrc);
} }
......
...@@ -46,11 +46,11 @@ namespace RTC { namespace RTCP ...@@ -46,11 +46,11 @@ namespace RTC { namespace RTCP
void Dump(); void Dump();
size_t Serialize(uint8_t* buffer); size_t Serialize(uint8_t* buffer);
size_t GetSize(); size_t GetSize() const;
SdesItem::Type GetType(); SdesItem::Type GetType() const;
uint8_t GetLength(); uint8_t GetLength() const;
char* GetValue(); char* GetValue() const;
private: private:
// Passed by argument. // Passed by argument.
...@@ -77,8 +77,8 @@ namespace RTC { namespace RTCP ...@@ -77,8 +77,8 @@ namespace RTC { namespace RTCP
void Dump(); void Dump();
void Serialize(); void Serialize();
size_t Serialize(uint8_t* buffer); size_t Serialize(uint8_t* buffer);
size_t GetSize(); size_t GetSize() const;
uint32_t GetSsrc(); uint32_t GetSsrc() const;
void SetSsrc(uint32_t ssrc); void SetSsrc(uint32_t ssrc);
void AddItem(SdesItem* item); void AddItem(SdesItem* item);
Iterator Begin(); Iterator Begin();
...@@ -110,8 +110,8 @@ namespace RTC { namespace RTCP ...@@ -110,8 +110,8 @@ namespace RTC { namespace RTCP
public: public:
virtual void Dump() override; virtual void Dump() override;
virtual size_t Serialize(uint8_t* buffer) override; virtual size_t Serialize(uint8_t* buffer) override;
virtual size_t GetCount() override; virtual size_t GetCount() const override;
virtual size_t GetSize() override; virtual size_t GetSize() const override;
private: private:
std::vector<SdesChunk*> chunks; std::vector<SdesChunk*> chunks;
...@@ -135,25 +135,25 @@ namespace RTC { namespace RTCP ...@@ -135,25 +135,25 @@ namespace RTC { namespace RTCP
} }
inline inline
size_t SdesItem::GetSize() size_t SdesItem::GetSize() const
{ {
return 2 + size_t(this->header->length); return 2 + size_t(this->header->length);
} }
inline inline
SdesItem::Type SdesItem::GetType() SdesItem::Type SdesItem::GetType() const
{ {
return (SdesItem::Type)this->header->type; return (SdesItem::Type)this->header->type;
} }
inline inline
uint8_t SdesItem::GetLength() uint8_t SdesItem::GetLength() const
{ {
return this->header->length; return this->header->length;
} }
inline inline
char* SdesItem::GetValue() char* SdesItem::GetValue() const
{ {
return this->header->value; return this->header->value;
} }
...@@ -187,7 +187,7 @@ namespace RTC { namespace RTCP ...@@ -187,7 +187,7 @@ namespace RTC { namespace RTCP
} }
inline inline
size_t SdesChunk::GetSize() size_t SdesChunk::GetSize() const
{ {
size_t size = sizeof(this->ssrc); size_t size = sizeof(this->ssrc);
...@@ -202,7 +202,7 @@ namespace RTC { namespace RTCP ...@@ -202,7 +202,7 @@ namespace RTC { namespace RTCP
} }
inline inline
uint32_t SdesChunk::GetSsrc() uint32_t SdesChunk::GetSsrc() const
{ {
return (uint32_t)ntohl(this->ssrc); return (uint32_t)ntohl(this->ssrc);
} }
...@@ -248,13 +248,13 @@ namespace RTC { namespace RTCP ...@@ -248,13 +248,13 @@ namespace RTC { namespace RTCP
} }
inline inline
size_t SdesPacket::GetCount() size_t SdesPacket::GetCount() const
{ {
return this->chunks.size(); return this->chunks.size();
} }
inline inline
size_t SdesPacket::GetSize() size_t SdesPacket::GetSize() const
{ {
size_t size = sizeof(Packet::CommonHeader); size_t size = sizeof(Packet::CommonHeader);
......
...@@ -34,18 +34,18 @@ namespace RTC { namespace RTCP ...@@ -34,18 +34,18 @@ namespace RTC { namespace RTCP
void Dump(); void Dump();
size_t Serialize(uint8_t* buffer); size_t Serialize(uint8_t* buffer);
size_t GetSize(); size_t GetSize() const;
uint32_t GetSsrc(); uint32_t GetSsrc() const;
void SetSsrc(uint32_t ssrc); void SetSsrc(uint32_t ssrc);
uint32_t GetNtpSec(); uint32_t GetNtpSec() const;
void SetNtpSec(uint32_t ntp_sec); void SetNtpSec(uint32_t ntp_sec);
uint32_t GetNtpFrac(); uint32_t GetNtpFrac() const;
void SetNtpFrac(uint32_t ntp_frac); void SetNtpFrac(uint32_t ntp_frac);
uint32_t GetRtpTs(); uint32_t GetRtpTs() const;
void SetRtpTs(uint32_t rtp_ts); void SetRtpTs(uint32_t rtp_ts);
uint32_t GetPacketCount(); uint32_t GetPacketCount() const;
void SetPacketCount(uint32_t packet_count); void SetPacketCount(uint32_t packet_count);
uint32_t GetOctetCount(); uint32_t GetOctetCount() const;
void SetOctetCount(uint32_t octet_count); void SetOctetCount(uint32_t octet_count);
private: private:
...@@ -74,8 +74,8 @@ namespace RTC { namespace RTCP ...@@ -74,8 +74,8 @@ namespace RTC { namespace RTCP
public: public:
virtual void Dump() override; virtual void Dump() override;
virtual size_t Serialize(uint8_t* buffer) override; virtual size_t Serialize(uint8_t* buffer) override;
virtual size_t GetCount() override; virtual size_t GetCount() const override;
virtual size_t GetSize() override; virtual size_t GetSize() const override;
private: private:
std::vector<SenderReport*> reports; std::vector<SenderReport*> reports;
...@@ -100,13 +100,13 @@ namespace RTC { namespace RTCP ...@@ -100,13 +100,13 @@ namespace RTC { namespace RTCP
{} {}
inline inline
size_t SenderReport::GetSize() size_t SenderReport::GetSize() const
{ {
return sizeof(Header); return sizeof(Header);
} }
inline inline
uint32_t SenderReport::GetSsrc() uint32_t SenderReport::GetSsrc() const
{ {
return (uint32_t)ntohl(this->header->ssrc); return (uint32_t)ntohl(this->header->ssrc);
} }
...@@ -118,7 +118,7 @@ namespace RTC { namespace RTCP ...@@ -118,7 +118,7 @@ namespace RTC { namespace RTCP
} }
inline inline
uint32_t SenderReport::GetNtpSec() uint32_t SenderReport::GetNtpSec() const
{ {
return (uint32_t)ntohl(this->header->ntp_sec); return (uint32_t)ntohl(this->header->ntp_sec);
} }
...@@ -130,7 +130,7 @@ namespace RTC { namespace RTCP ...@@ -130,7 +130,7 @@ namespace RTC { namespace RTCP
} }
inline inline
uint32_t SenderReport::GetNtpFrac() uint32_t SenderReport::GetNtpFrac() const
{ {
return (uint32_t)ntohl(this->header->ntp_frac); return (uint32_t)ntohl(this->header->ntp_frac);
} }
...@@ -142,7 +142,7 @@ namespace RTC { namespace RTCP ...@@ -142,7 +142,7 @@ namespace RTC { namespace RTCP
} }
inline inline
uint32_t SenderReport::GetRtpTs() uint32_t SenderReport::GetRtpTs() const
{ {
return (uint32_t)ntohl(this->header->rtp_ts); return (uint32_t)ntohl(this->header->rtp_ts);
} }
...@@ -155,7 +155,7 @@ namespace RTC { namespace RTCP ...@@ -155,7 +155,7 @@ namespace RTC { namespace RTCP
inline inline
uint32_t SenderReport::GetPacketCount() uint32_t SenderReport::GetPacketCount() const
{ {
return (uint32_t)ntohl(this->header->packet_count); return (uint32_t)ntohl(this->header->packet_count);
} }
...@@ -167,7 +167,7 @@ namespace RTC { namespace RTCP ...@@ -167,7 +167,7 @@ namespace RTC { namespace RTCP
} }
inline inline
uint32_t SenderReport::GetOctetCount() uint32_t SenderReport::GetOctetCount() const
{ {
return (uint32_t)ntohl(this->header->octet_count); return (uint32_t)ntohl(this->header->octet_count);
} }
...@@ -195,13 +195,13 @@ namespace RTC { namespace RTCP ...@@ -195,13 +195,13 @@ namespace RTC { namespace RTCP
} }
inline inline
size_t SenderReportPacket::GetCount() size_t SenderReportPacket::GetCount() const
{ {
return this->reports.size(); return this->reports.size();
} }
inline inline
size_t SenderReportPacket::GetSize() size_t SenderReportPacket::GetSize() const
{ {
size_t size = sizeof(Packet::CommonHeader); size_t size = sizeof(Packet::CommonHeader);
......
...@@ -42,12 +42,12 @@ namespace RTC ...@@ -42,12 +42,12 @@ namespace RTC
virtual ~Room(); virtual ~Room();
void Close(); void Close();
Json::Value toJson(); Json::Value toJson() const;
void HandleRequest(Channel::Request* request); void HandleRequest(Channel::Request* request);
RTC::RtpCapabilities& GetCapabilities(); const RTC::RtpCapabilities& GetCapabilities() const;
private: private:
RTC::Peer* GetPeerFromRequest(Channel::Request* request, uint32_t* peerId = nullptr); RTC::Peer* GetPeerFromRequest(Channel::Request* request, uint32_t* peerId = nullptr) const;
void SetCapabilities(std::vector<RTC::RtpCodecParameters>& mediaCodecs); void SetCapabilities(std::vector<RTC::RtpCodecParameters>& mediaCodecs);
/* Pure virtual methods inherited from RTC::Peer::Listener. */ /* Pure virtual methods inherited from RTC::Peer::Listener. */
...@@ -81,7 +81,7 @@ namespace RTC ...@@ -81,7 +81,7 @@ namespace RTC
/* Inline static methods. */ /* Inline static methods. */
inline inline
RTC::RtpCapabilities& Room::GetCapabilities() const RTC::RtpCapabilities& Room::GetCapabilities() const
{ {
return this->capabilities; return this->capabilities;
} }
......
...@@ -51,8 +51,8 @@ namespace RTC ...@@ -51,8 +51,8 @@ namespace RTC
public: public:
void Update(RTC::RtpPacket* packet); void Update(RTC::RtpPacket* packet);
uint32_t GetRate(uint64_t now); uint32_t GetRate(uint64_t now);
size_t GetPacketCount(); size_t GetPacketCount() const;
size_t GetBytes(); size_t GetBytes() const;
private: private:
RateCalculator rate; RateCalculator rate;
...@@ -82,19 +82,19 @@ namespace RTC ...@@ -82,19 +82,19 @@ namespace RTC
} }
inline inline
size_t RtpDataCounter::GetPacketCount() uint32_t RtpDataCounter::GetRate(uint64_t now)
{ {
return this->packets; return this->rate.GetRate(now);
} }
inline inline
uint32_t RtpDataCounter::GetRate(uint64_t now) size_t RtpDataCounter::GetPacketCount() const
{ {
return this->rate.GetRate(now); return this->packets;
} }
inline inline
size_t RtpDataCounter::GetBytes() size_t RtpDataCounter::GetBytes() const
{ {
return this->bytes; return this->bytes;
} }
......
...@@ -84,34 +84,34 @@ namespace RTC ...@@ -84,34 +84,34 @@ namespace RTC
public: public:
RtpCodecMime() {}; RtpCodecMime() {};
bool operator==(const RtpCodecMime& other) bool operator==(const RtpCodecMime& other) const
{ {
return this->type == other.type && this->subtype == other.subtype; return this->type == other.type && this->subtype == other.subtype;
} }
bool operator!=(const RtpCodecMime& other) bool operator!=(const RtpCodecMime& other) const
{ {
return !(*this == other); return !(*this == other);
} }
void SetName(std::string& name); void SetName(std::string& name);
std::string& GetName() const std::string& GetName() const
{ {
return this->name; return this->name;
} }
bool IsMediaCodec() bool IsMediaCodec() const
{ {
return this->subtype >= Subtype(100) && this->subtype < (Subtype)300; return this->subtype >= Subtype(100) && this->subtype < (Subtype)300;
} }
bool IsComplementaryCodec() bool IsComplementaryCodec() const
{ {
return this->subtype >= Subtype(300) && this->subtype < (Subtype)400; return this->subtype >= Subtype(300) && this->subtype < (Subtype)400;
} }
bool IsFeatureCodec() bool IsFeatureCodec() const
{ {
return this->subtype >= Subtype(400); return this->subtype >= Subtype(400);
} }
...@@ -147,7 +147,7 @@ namespace RTC ...@@ -147,7 +147,7 @@ namespace RTC
public: public:
explicit RtcpFeedback(Json::Value& data); explicit RtcpFeedback(Json::Value& data);
Json::Value toJson(); Json::Value toJson() const;
public: public:
std::string type; std::string type;
...@@ -160,7 +160,7 @@ namespace RTC ...@@ -160,7 +160,7 @@ namespace RTC
RtpCodecParameters() {}; RtpCodecParameters() {};
RtpCodecParameters(Json::Value& data, RTC::Scope scope); RtpCodecParameters(Json::Value& data, RTC::Scope scope);
Json::Value toJson(); Json::Value toJson() const;
bool Matches(RtpCodecParameters& codec, bool checkPayloadType = false); bool Matches(RtpCodecParameters& codec, bool checkPayloadType = false);
void ReduceRtcpFeedback(std::vector<RtcpFeedback>& supportedRtcpFeedback); void ReduceRtcpFeedback(std::vector<RtcpFeedback>& supportedRtcpFeedback);
...@@ -188,7 +188,7 @@ namespace RTC ...@@ -188,7 +188,7 @@ namespace RTC
public: public:
explicit RtpHeaderExtension(Json::Value& data); explicit RtpHeaderExtension(Json::Value& data);
Json::Value toJson(); Json::Value toJson() const;
public: public:
Media::Kind kind = Media::Kind::ALL; Media::Kind kind = Media::Kind::ALL;
...@@ -204,7 +204,7 @@ namespace RTC ...@@ -204,7 +204,7 @@ namespace RTC
RtpCapabilities() {}; RtpCapabilities() {};
RtpCapabilities(Json::Value& data, RTC::Scope scope); RtpCapabilities(Json::Value& data, RTC::Scope scope);
Json::Value toJson(); Json::Value toJson() const;
void ReduceHeaderExtensions(std::vector<RtpHeaderExtension>& supportedHeaderExtensions); void ReduceHeaderExtensions(std::vector<RtpHeaderExtension>& supportedHeaderExtensions);
void ReduceFecMechanisms(std::vector<std::string>& supportedFecMechanisms); void ReduceFecMechanisms(std::vector<std::string>& supportedFecMechanisms);
...@@ -223,7 +223,7 @@ namespace RTC ...@@ -223,7 +223,7 @@ namespace RTC
RtpFecParameters() {}; RtpFecParameters() {};
explicit RtpFecParameters(Json::Value& data); explicit RtpFecParameters(Json::Value& data);
Json::Value toJson(); Json::Value toJson() const;
public: public:
std::string mechanism; std::string mechanism;
...@@ -236,7 +236,7 @@ namespace RTC ...@@ -236,7 +236,7 @@ namespace RTC
RtpRtxParameters() {}; RtpRtxParameters() {};
explicit RtpRtxParameters(Json::Value& data); explicit RtpRtxParameters(Json::Value& data);
Json::Value toJson(); Json::Value toJson() const;
public: public:
uint32_t ssrc = 0; uint32_t ssrc = 0;
...@@ -248,7 +248,7 @@ namespace RTC ...@@ -248,7 +248,7 @@ namespace RTC
RtpEncodingParameters() {}; RtpEncodingParameters() {};
explicit RtpEncodingParameters(Json::Value& data); explicit RtpEncodingParameters(Json::Value& data);
Json::Value toJson(); Json::Value toJson() const;
public: public:
uint32_t ssrc = 0; uint32_t ssrc = 0;
...@@ -271,7 +271,7 @@ namespace RTC ...@@ -271,7 +271,7 @@ namespace RTC
public: public:
explicit RtpHeaderExtensionParameters(Json::Value& data); explicit RtpHeaderExtensionParameters(Json::Value& data);
Json::Value toJson(); Json::Value toJson() const;
public: public:
std::string uri; std::string uri;
...@@ -287,7 +287,7 @@ namespace RTC ...@@ -287,7 +287,7 @@ namespace RTC
RtcpParameters() {}; RtcpParameters() {};
explicit RtcpParameters(Json::Value& data); explicit RtcpParameters(Json::Value& data);
Json::Value toJson(); Json::Value toJson() const;
public: public:
std::string cname; std::string cname;
...@@ -301,10 +301,10 @@ namespace RTC ...@@ -301,10 +301,10 @@ namespace RTC
explicit RtpParameters(Json::Value& data); explicit RtpParameters(Json::Value& data);
explicit RtpParameters(const RtpParameters* RtpParameters); explicit RtpParameters(const RtpParameters* RtpParameters);
Json::Value toJson(); Json::Value toJson() const;
void ReduceCodecsAndEncodings(RtpCapabilities& capabilities); void ReduceCodecsAndEncodings(RtpCapabilities& capabilities);
void ReduceHeaderExtensions(std::vector<RtpHeaderExtension>& supportedHeaderExtensions); void ReduceHeaderExtensions(std::vector<RtpHeaderExtension>& supportedHeaderExtensions);
uint32_t GetClockRateForEncoding(RtpEncodingParameters& encoding); uint32_t GetClockRateForEncoding(RtpEncodingParameters& encoding) const;
private: private:
void ValidateCodecs(); void ValidateCodecs();
......
...@@ -13,10 +13,10 @@ namespace RTC ...@@ -13,10 +13,10 @@ namespace RTC
class RtpListener class RtpListener
{ {
public: public:
Json::Value toJson(); Json::Value toJson() const;
bool HasSsrc(uint32_t ssrc, RTC::RtpReceiver* rtpReceiver); bool HasSsrc(uint32_t ssrc, RTC::RtpReceiver* rtpReceiver) const;
bool HasMuxId(std::string& muxId, RTC::RtpReceiver* rtpReceiver); bool HasMuxId(std::string& muxId, RTC::RtpReceiver* rtpReceiver) const;
bool HasPayloadType(uint8_t payloadType, RTC::RtpReceiver* rtpReceiver); bool HasPayloadType(uint8_t payloadType, RTC::RtpReceiver* rtpReceiver) const;
void AddRtpReceiver(RTC::RtpReceiver* rtpReceiver); void AddRtpReceiver(RTC::RtpReceiver* rtpReceiver);
void RemoveRtpReceiver(RTC::RtpReceiver* rtpReceiver); void RemoveRtpReceiver(RTC::RtpReceiver* rtpReceiver);
RTC::RtpReceiver* GetRtpReceiver(RTC::RtpPacket* packet); RTC::RtpReceiver* GetRtpReceiver(RTC::RtpPacket* packet);
...@@ -37,7 +37,7 @@ namespace RTC ...@@ -37,7 +37,7 @@ namespace RTC
/* Inline instance methods. */ /* Inline instance methods. */
inline inline
bool RtpListener::HasSsrc(uint32_t ssrc, RTC::RtpReceiver* rtpReceiver) bool RtpListener::HasSsrc(uint32_t ssrc, RTC::RtpReceiver* rtpReceiver) const
{ {
auto it = this->ssrcTable.find(ssrc); auto it = this->ssrcTable.find(ssrc);
...@@ -52,7 +52,7 @@ namespace RTC ...@@ -52,7 +52,7 @@ namespace RTC
} }
inline inline
bool RtpListener::HasMuxId(std::string& muxId, RTC::RtpReceiver* rtpReceiver) bool RtpListener::HasMuxId(std::string& muxId, RTC::RtpReceiver* rtpReceiver) const
{ {
auto it = this->muxIdTable.find(muxId); auto it = this->muxIdTable.find(muxId);
...@@ -67,7 +67,7 @@ namespace RTC ...@@ -67,7 +67,7 @@ namespace RTC
} }
inline inline
bool RtpListener::HasPayloadType(uint8_t payloadType, RTC::RtpReceiver* rtpReceiver) bool RtpListener::HasPayloadType(uint8_t payloadType, RTC::RtpReceiver* rtpReceiver) const
{ {
auto it = this->ptTable.find(payloadType); auto it = this->ptTable.find(payloadType);
......
...@@ -77,31 +77,31 @@ namespace RTC ...@@ -77,31 +77,31 @@ namespace RTC
RtpPacket(Header* header, ExtensionHeader* extensionHeader, const uint8_t* payload, size_t payloadLen, uint8_t payloadPadding, size_t size); RtpPacket(Header* header, ExtensionHeader* extensionHeader, const uint8_t* payload, size_t payloadLen, uint8_t payloadPadding, size_t size);
~RtpPacket(); ~RtpPacket();
void Dump(); void Dump() const;
const uint8_t* GetData(); const uint8_t* GetData() const;
size_t GetSize(); size_t GetSize() const;
uint8_t GetPayloadType(); uint8_t GetPayloadType() const;
void SetPayloadType(uint8_t payload_type); void SetPayloadType(uint8_t payload_type);
bool HasMarker(); bool HasMarker() const;
void SetMarker(bool marker); void SetMarker(bool marker);
uint16_t GetSequenceNumber(); uint16_t GetSequenceNumber() const;
void SetSequenceNumber(uint16_t seq); void SetSequenceNumber(uint16_t seq);
uint32_t GetTimestamp(); uint32_t GetTimestamp() const;
void SetTimestamp(uint32_t timestamp); void SetTimestamp(uint32_t timestamp);
uint32_t GetSsrc(); uint32_t GetSsrc() const;
void SetSsrc(uint32_t ssrc); void SetSsrc(uint32_t ssrc);
bool HasExtensionHeader(); bool HasExtensionHeader() const;
uint16_t GetExtensionHeaderId(); uint16_t GetExtensionHeaderId() const;
size_t GetExtensionHeaderLength(); size_t GetExtensionHeaderLength() const;
uint8_t* GetExtensionHeaderValue(); uint8_t* GetExtensionHeaderValue() const;
void ParseExtensionElements(); void ParseExtensionElements();
bool HasOneByteExtensionElements(); bool HasOneByteExtensionElements() const;
bool HasTwoBytesExtensionElements(); bool HasTwoBytesExtensionElements() const;
uint8_t GetExtensionElementLength(uint8_t id); uint8_t GetExtensionElementLength(uint8_t id);
uint8_t* GetExtensionElementValue(uint8_t id); uint8_t* GetExtensionElementValue(uint8_t id);
void SetExtensionElementId(uint8_t old_id, uint8_t new_id); void SetExtensionElementId(uint8_t old_id, uint8_t new_id);
uint8_t* GetPayload(); uint8_t* GetPayload() const;
size_t GetPayloadLength(); size_t GetPayloadLength() const;
void Serialize(uint8_t* buffer); void Serialize(uint8_t* buffer);
RtpPacket* Clone(uint8_t* buffer); RtpPacket* Clone(uint8_t* buffer);
...@@ -139,19 +139,19 @@ namespace RTC ...@@ -139,19 +139,19 @@ namespace RTC
/* Inline instance methods. */ /* Inline instance methods. */
inline inline
const uint8_t* RtpPacket::GetData() const uint8_t* RtpPacket::GetData() const
{ {
return (const uint8_t*)this->header; return (const uint8_t*)this->header;
} }
inline inline
size_t RtpPacket::GetSize() size_t RtpPacket::GetSize() const
{ {
return this->size; return this->size;
} }
inline inline
uint8_t RtpPacket::GetPayloadType() uint8_t RtpPacket::GetPayloadType() const
{ {
return this->header->payload_type; return this->header->payload_type;
} }
...@@ -163,7 +163,7 @@ namespace RTC ...@@ -163,7 +163,7 @@ namespace RTC
} }
inline inline
bool RtpPacket::HasMarker() bool RtpPacket::HasMarker() const
{ {
return this->header->marker; return this->header->marker;
} }
...@@ -175,7 +175,7 @@ namespace RTC ...@@ -175,7 +175,7 @@ namespace RTC
} }
inline inline
uint16_t RtpPacket::GetSequenceNumber() uint16_t RtpPacket::GetSequenceNumber() const
{ {
return (uint16_t)ntohs(this->header->sequence_number); return (uint16_t)ntohs(this->header->sequence_number);
} }
...@@ -187,7 +187,7 @@ namespace RTC ...@@ -187,7 +187,7 @@ namespace RTC
} }
inline inline
uint32_t RtpPacket::GetTimestamp() uint32_t RtpPacket::GetTimestamp() const
{ {
return (uint32_t)ntohl(this->header->timestamp); return (uint32_t)ntohl(this->header->timestamp);
} }
...@@ -199,7 +199,7 @@ namespace RTC ...@@ -199,7 +199,7 @@ namespace RTC
} }
inline inline
uint32_t RtpPacket::GetSsrc() uint32_t RtpPacket::GetSsrc() const
{ {
return (uint32_t)ntohl(this->header->ssrc); return (uint32_t)ntohl(this->header->ssrc);
} }
...@@ -211,13 +211,13 @@ namespace RTC ...@@ -211,13 +211,13 @@ namespace RTC
} }
inline inline
bool RtpPacket::HasExtensionHeader() bool RtpPacket::HasExtensionHeader() const
{ {
return (this->extensionHeader ? true : false); return (this->extensionHeader ? true : false);
} }
inline inline
uint16_t RtpPacket::GetExtensionHeaderId() uint16_t RtpPacket::GetExtensionHeaderId() const
{ {
if (!this->extensionHeader) if (!this->extensionHeader)
return 0; return 0;
...@@ -226,7 +226,7 @@ namespace RTC ...@@ -226,7 +226,7 @@ namespace RTC
} }
inline inline
size_t RtpPacket::GetExtensionHeaderLength() size_t RtpPacket::GetExtensionHeaderLength() const
{ {
if (!this->extensionHeader) if (!this->extensionHeader)
return 0; return 0;
...@@ -235,7 +235,7 @@ namespace RTC ...@@ -235,7 +235,7 @@ namespace RTC
} }
inline inline
uint8_t* RtpPacket::GetExtensionHeaderValue() uint8_t* RtpPacket::GetExtensionHeaderValue() const
{ {
if (!this->extensionHeader) if (!this->extensionHeader)
return nullptr; return nullptr;
...@@ -244,13 +244,13 @@ namespace RTC ...@@ -244,13 +244,13 @@ namespace RTC
} }
inline inline
bool RtpPacket::HasOneByteExtensionElements() bool RtpPacket::HasOneByteExtensionElements() const
{ {
return GetExtensionHeaderId() == 0xBEDE; return GetExtensionHeaderId() == 0xBEDE;
} }
inline inline
bool RtpPacket::HasTwoBytesExtensionElements() bool RtpPacket::HasTwoBytesExtensionElements() const
{ {
return (GetExtensionHeaderId() & 0b1111111111110000) == 0b0001000000000000; return (GetExtensionHeaderId() & 0b1111111111110000) == 0b0001000000000000;
} }
...@@ -329,13 +329,13 @@ namespace RTC ...@@ -329,13 +329,13 @@ namespace RTC
} }
inline inline
uint8_t* RtpPacket::GetPayload() uint8_t* RtpPacket::GetPayload() const
{ {
return this->payload; return this->payload;
} }
inline inline
size_t RtpPacket::GetPayloadLength() size_t RtpPacket::GetPayloadLength() const
{ {
return this->payloadLength; return this->payloadLength;
} }
......
...@@ -44,12 +44,12 @@ namespace RTC ...@@ -44,12 +44,12 @@ namespace RTC
virtual ~RtpReceiver(); virtual ~RtpReceiver();
void Close(); void Close();
Json::Value toJson(); Json::Value toJson() const;
void HandleRequest(Channel::Request* request); void HandleRequest(Channel::Request* request);
void SetTransport(RTC::Transport* transport); void SetTransport(RTC::Transport* transport);
RTC::Transport* GetTransport(); RTC::Transport* GetTransport() const;
void RemoveTransport(RTC::Transport* transport); void RemoveTransport(RTC::Transport* transport);
RTC::RtpParameters* GetParameters(); RTC::RtpParameters* GetParameters() const;
void ReceiveRtpPacket(RTC::RtpPacket* packet); void ReceiveRtpPacket(RTC::RtpPacket* packet);
void ReceiveRtcpSenderReport(RTC::RTCP::SenderReport* report); void ReceiveRtcpSenderReport(RTC::RTCP::SenderReport* report);
void GetRtcp(RTC::RTCP::CompoundPacket *packet, uint64_t now); void GetRtcp(RTC::RTCP::CompoundPacket *packet, uint64_t now);
...@@ -93,7 +93,7 @@ namespace RTC ...@@ -93,7 +93,7 @@ namespace RTC
} }
inline inline
RTC::Transport* RtpReceiver::GetTransport() RTC::Transport* RtpReceiver::GetTransport() const
{ {
return this->transport; return this->transport;
} }
...@@ -106,7 +106,7 @@ namespace RTC ...@@ -106,7 +106,7 @@ namespace RTC
} }
inline inline
RTC::RtpParameters* RtpReceiver::GetParameters() RTC::RtpParameters* RtpReceiver::GetParameters() const
{ {
return this->rtpParameters; return this->rtpParameters;
} }
......
...@@ -49,15 +49,15 @@ namespace RTC ...@@ -49,15 +49,15 @@ namespace RTC
virtual ~RtpSender(); virtual ~RtpSender();
void Close(); void Close();
Json::Value toJson(); Json::Value toJson() const;
void HandleRequest(Channel::Request* request); void HandleRequest(Channel::Request* request);
void SetPeerCapabilities(RTC::RtpCapabilities* peerCapabilities); void SetPeerCapabilities(RTC::RtpCapabilities* peerCapabilities);
void Send(RTC::RtpParameters* rtpParameters); void Send(RTC::RtpParameters* rtpParameters);
void SetTransport(RTC::Transport* transport); void SetTransport(RTC::Transport* transport);
RTC::Transport* GetTransport(); RTC::Transport* GetTransport() const;
void RemoveTransport(RTC::Transport* transport); void RemoveTransport(RTC::Transport* transport);
RTC::RtpParameters* GetParameters(); RTC::RtpParameters* GetParameters() const;
bool GetActive(); bool GetActive() const;
void SendRtpPacket(RTC::RtpPacket* packet); void SendRtpPacket(RTC::RtpPacket* packet);
void GetRtcp(RTC::RTCP::CompoundPacket *packet, uint64_t now); void GetRtcp(RTC::RTCP::CompoundPacket *packet, uint64_t now);
void ReceiveNack(RTC::RTCP::FeedbackRtpNackPacket* nackPacket); void ReceiveNack(RTC::RTCP::FeedbackRtpNackPacket* nackPacket);
...@@ -65,7 +65,7 @@ namespace RTC ...@@ -65,7 +65,7 @@ namespace RTC
private: private:
void RetransmitRtpPacket(RTC::RtpPacket* packet); void RetransmitRtpPacket(RTC::RtpPacket* packet);
void EmitActiveChange(); void EmitActiveChange() const;
public: public:
// Passed by argument. // Passed by argument.
...@@ -110,7 +110,7 @@ namespace RTC ...@@ -110,7 +110,7 @@ namespace RTC
} }
inline inline
RTC::Transport* RtpSender::GetTransport() RTC::Transport* RtpSender::GetTransport() const
{ {
return this->transport; return this->transport;
} }
...@@ -128,13 +128,13 @@ namespace RTC ...@@ -128,13 +128,13 @@ namespace RTC
} }
inline inline
RTC::RtpParameters* RtpSender::GetParameters() RTC::RtpParameters* RtpSender::GetParameters() const
{ {
return this->rtpParameters; return this->rtpParameters;
} }
inline inline
bool RtpSender::GetActive() bool RtpSender::GetActive() const
{ {
return (this->available && this->transport && !this->disabled); return (this->available && this->transport && !this->disabled);
} }
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include "common.hpp" #include "common.hpp"
#include "RTC/RtpPacket.hpp" #include "RTC/RtpPacket.hpp"
#include <json/json.h>
namespace RTC namespace RTC
{ {
...@@ -12,6 +13,7 @@ namespace RTC ...@@ -12,6 +13,7 @@ namespace RTC
explicit RtpStream(uint32_t ssrc, uint32_t clockRate); explicit RtpStream(uint32_t ssrc, uint32_t clockRate);
virtual ~RtpStream(); virtual ~RtpStream();
virtual Json::Value toJson() const = 0;
uint32_t GetSsrc(); uint32_t GetSsrc();
virtual bool ReceivePacket(RTC::RtpPacket* packet); virtual bool ReceivePacket(RTC::RtpPacket* packet);
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include "RTC/RtpStream.hpp" #include "RTC/RtpStream.hpp"
#include "RTC/RTCP/ReceiverReport.hpp" #include "RTC/RTCP/ReceiverReport.hpp"
#include "RTC/RTCP/SenderReport.hpp" #include "RTC/RTCP/SenderReport.hpp"
#include <json/json.h>
namespace RTC namespace RTC
{ {
...@@ -22,7 +21,7 @@ namespace RTC ...@@ -22,7 +21,7 @@ namespace RTC
explicit RtpStreamRecv(Listener* listener, uint32_t ssrc, uint32_t clockRate, bool useNack); explicit RtpStreamRecv(Listener* listener, uint32_t ssrc, uint32_t clockRate, bool useNack);
virtual ~RtpStreamRecv(); virtual ~RtpStreamRecv();
Json::Value toJson(); virtual Json::Value toJson() const override;
virtual bool ReceivePacket(RTC::RtpPacket* packet) override; virtual bool ReceivePacket(RTC::RtpPacket* packet) override;
RTC::RTCP::ReceiverReport* GetRtcpReceiverReport(); RTC::RTCP::ReceiverReport* GetRtcpReceiverReport();
void ReceiveRtcpSenderReport(RTC::RTCP::SenderReport* report); void ReceiveRtcpSenderReport(RTC::RTCP::SenderReport* report);
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#include "RTC/RTCP/SenderReport.hpp" #include "RTC/RTCP/SenderReport.hpp"
#include <vector> #include <vector>
#include <list> #include <list>
#include <json/json.h>
namespace RTC namespace RTC
{ {
...@@ -29,7 +28,7 @@ namespace RTC ...@@ -29,7 +28,7 @@ namespace RTC
RtpStreamSend(uint32_t ssrc, uint32_t clockRate, size_t bufferSize); RtpStreamSend(uint32_t ssrc, uint32_t clockRate, size_t bufferSize);
virtual ~RtpStreamSend(); virtual ~RtpStreamSend();
Json::Value toJson(); virtual Json::Value toJson() const override;
bool ReceivePacket(RTC::RtpPacket* packet) override; bool ReceivePacket(RTC::RtpPacket* packet) override;
void RequestRtpRetransmission(uint16_t seq, uint16_t bitmask, std::vector<RTC::RtpPacket*>& container); void RequestRtpRetransmission(uint16_t seq, uint16_t bitmask, std::vector<RTC::RtpPacket*>& container);
RTC::RTCP::SenderReport* GetRtcpSenderReport(uint64_t now); RTC::RTCP::SenderReport* GetRtcpSenderReport(uint64_t now);
......
...@@ -63,11 +63,11 @@ namespace RTC ...@@ -63,11 +63,11 @@ namespace RTC
StunMessage(Class klass, Method method, const uint8_t* transactionId, const uint8_t* data, size_t size); StunMessage(Class klass, Method method, const uint8_t* transactionId, const uint8_t* data, size_t size);
~StunMessage(); ~StunMessage();
void Dump(); void Dump() const;
Class GetClass(); Class GetClass() const;
Method GetMethod(); Method GetMethod() const;
const uint8_t* GetData(); const uint8_t* GetData() const;
size_t GetSize(); size_t GetSize() const;
void SetUsername(const char* username, size_t len); void SetUsername(const char* username, size_t len);
void SetPriority(const uint32_t priority); void SetPriority(const uint32_t priority);
void SetIceControlling(const uint64_t iceControlling); void SetIceControlling(const uint64_t iceControlling);
...@@ -77,14 +77,14 @@ namespace RTC ...@@ -77,14 +77,14 @@ namespace RTC
void SetErrorCode(uint16_t errorCode); void SetErrorCode(uint16_t errorCode);
void SetMessageIntegrity(const uint8_t* messageIntegrity); void SetMessageIntegrity(const uint8_t* messageIntegrity);
void SetFingerprint(); void SetFingerprint();
const std::string& GetUsername(); const std::string& GetUsername() const;
uint32_t GetPriority(); uint32_t GetPriority() const;
uint64_t GetIceControlling(); uint64_t GetIceControlling() const;
uint64_t GetIceControlled(); uint64_t GetIceControlled() const;
bool HasUseCandidate(); bool HasUseCandidate() const;
uint16_t GetErrorCode(); uint16_t GetErrorCode() const;
bool HasMessageIntegrity(); bool HasMessageIntegrity() const;
bool HasFingerprint(); bool HasFingerprint() const;
Authentication CheckAuthentication(const std::string &local_username, const std::string &local_password); Authentication CheckAuthentication(const std::string &local_username, const std::string &local_password);
StunMessage* CreateSuccessResponse(); StunMessage* CreateSuccessResponse();
StunMessage* CreateErrorResponse(uint16_t errorCode); StunMessage* CreateErrorResponse(uint16_t errorCode);
...@@ -111,7 +111,7 @@ namespace RTC ...@@ -111,7 +111,7 @@ namespace RTC
std::string password; std::string password;
}; };
/* Inline methods. */ /* Inline class methods. */
inline inline
bool StunMessage::IsStun(const uint8_t* data, size_t len) bool StunMessage::IsStun(const uint8_t* data, size_t len)
...@@ -129,26 +129,28 @@ namespace RTC ...@@ -129,26 +129,28 @@ namespace RTC
); );
} }
/* Inline instance methods. */
inline inline
StunMessage::Class StunMessage::GetClass() StunMessage::Class StunMessage::GetClass() const
{ {
return this->klass; return this->klass;
} }
inline inline
StunMessage::Method StunMessage::GetMethod() StunMessage::Method StunMessage::GetMethod() const
{ {
return this->method; return this->method;
} }
inline inline
const uint8_t* StunMessage::GetData() const uint8_t* StunMessage::GetData() const
{ {
return this->data; return this->data;
} }
inline inline
size_t StunMessage::GetSize() size_t StunMessage::GetSize() const
{ {
return this->size; return this->size;
} }
...@@ -214,49 +216,49 @@ namespace RTC ...@@ -214,49 +216,49 @@ namespace RTC
} }
inline inline
const std::string& StunMessage::GetUsername() const std::string& StunMessage::GetUsername() const
{ {
return this->username; return this->username;
} }
inline inline
uint32_t StunMessage::GetPriority() uint32_t StunMessage::GetPriority() const
{ {
return this->priority; return this->priority;
} }
inline inline
uint64_t StunMessage::GetIceControlling() uint64_t StunMessage::GetIceControlling() const
{ {
return this->iceControlling; return this->iceControlling;
} }
inline inline
uint64_t StunMessage::GetIceControlled() uint64_t StunMessage::GetIceControlled() const
{ {
return this->iceControlled; return this->iceControlled;
} }
inline inline
bool StunMessage::HasUseCandidate() bool StunMessage::HasUseCandidate() const
{ {
return this->hasUseCandidate; return this->hasUseCandidate;
} }
inline inline
uint16_t StunMessage::GetErrorCode() uint16_t StunMessage::GetErrorCode() const
{ {
return this->errorCode; return this->errorCode;
} }
inline inline
bool StunMessage::HasMessageIntegrity() bool StunMessage::HasMessageIntegrity() const
{ {
return (this->messageIntegrity ? true : false); return (this->messageIntegrity ? true : false);
} }
inline inline
bool StunMessage::HasFingerprint() bool StunMessage::HasFingerprint() const
{ {
return this->hasFingerprint; return this->hasFingerprint;
} }
......
...@@ -44,7 +44,7 @@ namespace RTC ...@@ -44,7 +44,7 @@ namespace RTC
virtual ~Transport(); virtual ~Transport();
void Close(); void Close();
Json::Value toJson(); Json::Value toJson() const;
void HandleRequest(Channel::Request* request); void HandleRequest(Channel::Request* request);
void AddRtpReceiver(RTC::RtpReceiver* rtpReceiver); void AddRtpReceiver(RTC::RtpReceiver* rtpReceiver);
void RemoveRtpReceiver(RTC::RtpReceiver* rtpReceiver); void RemoveRtpReceiver(RTC::RtpReceiver* rtpReceiver);
......
...@@ -23,14 +23,14 @@ namespace RTC ...@@ -23,14 +23,14 @@ namespace RTC
explicit TransportTuple(RTC::TcpConnection* tcpConnection); explicit TransportTuple(RTC::TcpConnection* tcpConnection);
void Close(); void Close();
Json::Value toJson(); Json::Value toJson() const;
void Dump(); void Dump() const;
void StoreUdpRemoteAddress(); void StoreUdpRemoteAddress();
bool Compare(TransportTuple* tuple); bool Compare(TransportTuple* tuple) const;
void Send(const uint8_t* data, size_t len); void Send(const uint8_t* data, size_t len);
Protocol GetProtocol(); Protocol GetProtocol() const;
const struct sockaddr* GetLocalAddress(); const struct sockaddr* GetLocalAddress() const;
const struct sockaddr* GetRemoteAddress(); const struct sockaddr* GetRemoteAddress() const;
private: private:
// Passed by argument. // Passed by argument.
...@@ -74,13 +74,13 @@ namespace RTC ...@@ -74,13 +74,13 @@ namespace RTC
} }
inline inline
TransportTuple::Protocol TransportTuple::GetProtocol() TransportTuple::Protocol TransportTuple::GetProtocol() const
{ {
return this->protocol; return this->protocol;
} }
inline inline
bool TransportTuple::Compare(TransportTuple* tuple) bool TransportTuple::Compare(TransportTuple* tuple) const
{ {
if (this->protocol == Protocol::UDP && tuple->GetProtocol() == Protocol::UDP) if (this->protocol == Protocol::UDP && tuple->GetProtocol() == Protocol::UDP)
{ {
...@@ -106,7 +106,7 @@ namespace RTC ...@@ -106,7 +106,7 @@ namespace RTC
} }
inline inline
const struct sockaddr* TransportTuple::GetLocalAddress() const struct sockaddr* TransportTuple::GetLocalAddress() const
{ {
if (this->protocol == Protocol::UDP) if (this->protocol == Protocol::UDP)
return this->udpSocket->GetLocalAddress(); return this->udpSocket->GetLocalAddress();
...@@ -115,7 +115,7 @@ namespace RTC ...@@ -115,7 +115,7 @@ namespace RTC
} }
inline inline
const struct sockaddr* TransportTuple::GetRemoteAddress() const struct sockaddr* TransportTuple::GetRemoteAddress() const
{ {
if (this->protocol == Protocol::UDP) if (this->protocol == Protocol::UDP)
return (const struct sockaddr*)this->udpRemoteAddr; return (const struct sockaddr*)this->udpRemoteAddr;
......
...@@ -33,21 +33,21 @@ public: ...@@ -33,21 +33,21 @@ public:
virtual ~TcpConnection(); virtual ~TcpConnection();
void Close(); void Close();
virtual void Dump(); virtual void Dump() const;
void Setup(Listener* listener, struct sockaddr_storage* localAddr, const std::string &localIP, uint16_t localPort); void Setup(Listener* listener, struct sockaddr_storage* localAddr, const std::string &localIP, uint16_t localPort);
bool IsClosing(); bool IsClosing() const;
uv_tcp_t* GetUvHandle(); uv_tcp_t* GetUvHandle() const;
void Start(); void Start();
void Write(const uint8_t* data, size_t len); void Write(const uint8_t* data, size_t len);
void Write(const uint8_t* data1, size_t len1, const uint8_t* data2, size_t len2); void Write(const uint8_t* data1, size_t len1, const uint8_t* data2, size_t len2);
void Write(const std::string &data); void Write(const std::string &data);
const struct sockaddr* GetLocalAddress(); const struct sockaddr* GetLocalAddress() const;
int GetLocalFamily(); int GetLocalFamily() const;
const std::string& GetLocalIP(); const std::string& GetLocalIP() const;
uint16_t GetLocalPort(); uint16_t GetLocalPort() const;
const struct sockaddr* GetPeerAddress(); const struct sockaddr* GetPeerAddress() const;
const std::string& GetPeerIP(); const std::string& GetPeerIP() const;
uint16_t GetPeerPort(); uint16_t GetPeerPort() const;
private: private:
bool SetPeerAddress(); bool SetPeerAddress();
...@@ -92,13 +92,13 @@ protected: ...@@ -92,13 +92,13 @@ protected:
/* Inline methods. */ /* Inline methods. */
inline inline
bool TcpConnection::IsClosing() bool TcpConnection::IsClosing() const
{ {
return this->isClosing; return this->isClosing;
} }
inline inline
uv_tcp_t* TcpConnection::GetUvHandle() uv_tcp_t* TcpConnection::GetUvHandle() const
{ {
return this->uvHandle; return this->uvHandle;
} }
...@@ -110,43 +110,43 @@ void TcpConnection::Write(const std::string &data) ...@@ -110,43 +110,43 @@ void TcpConnection::Write(const std::string &data)
} }
inline inline
const struct sockaddr* TcpConnection::GetLocalAddress() const struct sockaddr* TcpConnection::GetLocalAddress() const
{ {
return (const struct sockaddr*)this->localAddr; return (const struct sockaddr*)this->localAddr;
} }
inline inline
int TcpConnection::GetLocalFamily() int TcpConnection::GetLocalFamily() const
{ {
return ((const struct sockaddr*)&this->localAddr)->sa_family; return ((const struct sockaddr*)&this->localAddr)->sa_family;
} }
inline inline
const std::string& TcpConnection::GetLocalIP() const std::string& TcpConnection::GetLocalIP() const
{ {
return this->localIP; return this->localIP;
} }
inline inline
uint16_t TcpConnection::GetLocalPort() uint16_t TcpConnection::GetLocalPort() const
{ {
return this->localPort; return this->localPort;
} }
inline inline
const struct sockaddr* TcpConnection::GetPeerAddress() const struct sockaddr* TcpConnection::GetPeerAddress() const
{ {
return (const struct sockaddr*)&this->peerAddr; return (const struct sockaddr*)&this->peerAddr;
} }
inline inline
const std::string& TcpConnection::GetPeerIP() const std::string& TcpConnection::GetPeerIP() const
{ {
return this->peerIP; return this->peerIP;
} }
inline inline
uint16_t TcpConnection::GetPeerPort() uint16_t TcpConnection::GetPeerPort() const
{ {
return this->peerPort; return this->peerPort;
} }
......
...@@ -18,13 +18,13 @@ public: ...@@ -18,13 +18,13 @@ public:
virtual ~TcpServer(); virtual ~TcpServer();
void Close(); void Close();
virtual void Dump(); virtual void Dump() const;
bool IsClosing(); bool IsClosing() const;
const struct sockaddr* GetLocalAddress(); const struct sockaddr* GetLocalAddress() const;
int GetLocalFamily(); int GetLocalFamily() const;
const std::string& GetLocalIP(); const std::string& GetLocalIP() const;
uint16_t GetLocalPort(); uint16_t GetLocalPort() const;
size_t GetNumConnections(); size_t GetNumConnections() const;
private: private:
bool SetLocalAddress(); bool SetLocalAddress();
...@@ -61,37 +61,37 @@ protected: ...@@ -61,37 +61,37 @@ protected:
/* Inline methods. */ /* Inline methods. */
inline inline
bool TcpServer::IsClosing() bool TcpServer::IsClosing() const
{ {
return this->isClosing; return this->isClosing;
} }
inline inline
size_t TcpServer::GetNumConnections() size_t TcpServer::GetNumConnections() const
{ {
return this->connections.size(); return this->connections.size();
} }
inline inline
const struct sockaddr* TcpServer::GetLocalAddress() const struct sockaddr* TcpServer::GetLocalAddress() const
{ {
return (const struct sockaddr*)&this->localAddr; return (const struct sockaddr*)&this->localAddr;
} }
inline inline
int TcpServer::GetLocalFamily() int TcpServer::GetLocalFamily() const
{ {
return ((const struct sockaddr*)&this->localAddr)->sa_family; return ((const struct sockaddr*)&this->localAddr)->sa_family;
} }
inline inline
const std::string& TcpServer::GetLocalIP() const std::string& TcpServer::GetLocalIP() const
{ {
return this->localIP; return this->localIP;
} }
inline inline
uint16_t TcpServer::GetLocalPort() uint16_t TcpServer::GetLocalPort() const
{ {
return this->localPort; return this->localPort;
} }
......
...@@ -30,15 +30,15 @@ public: ...@@ -30,15 +30,15 @@ public:
virtual ~UdpSocket(); virtual ~UdpSocket();
void Close(); void Close();
virtual void Dump(); virtual void Dump() const;
void Send(const uint8_t* data, size_t len, const struct sockaddr* addr); void Send(const uint8_t* data, size_t len, const struct sockaddr* addr);
void Send(const std::string &data, const struct sockaddr* addr); void Send(const std::string &data, const struct sockaddr* addr);
void Send(const uint8_t* data, size_t len, const std::string &ip, uint16_t port); void Send(const uint8_t* data, size_t len, const std::string &ip, uint16_t port);
void Send(const std::string &data, const std::string &ip, uint16_t port); void Send(const std::string &data, const std::string &ip, uint16_t port);
const struct sockaddr* GetLocalAddress(); const struct sockaddr* GetLocalAddress() const;
int GetLocalFamily(); int GetLocalFamily() const;
const std::string& GetLocalIP(); const std::string& GetLocalIP() const;
uint16_t GetLocalPort(); uint16_t GetLocalPort() const;
private: private:
bool SetLocalAddress(); bool SetLocalAddress();
...@@ -82,25 +82,25 @@ void UdpSocket::Send(const std::string &data, const std::string &ip, uint16_t po ...@@ -82,25 +82,25 @@ void UdpSocket::Send(const std::string &data, const std::string &ip, uint16_t po
} }
inline inline
const struct sockaddr* UdpSocket::GetLocalAddress() const struct sockaddr* UdpSocket::GetLocalAddress() const
{ {
return (const struct sockaddr*)&this->localAddr; return (const struct sockaddr*)&this->localAddr;
} }
inline inline
int UdpSocket::GetLocalFamily() int UdpSocket::GetLocalFamily() const
{ {
return ((const struct sockaddr*)&this->localAddr)->sa_family; return ((const struct sockaddr*)&this->localAddr)->sa_family;
} }
inline inline
const std::string& UdpSocket::GetLocalIP() const std::string& UdpSocket::GetLocalIP() const
{ {
return this->localIP; return this->localIP;
} }
inline inline
uint16_t UdpSocket::GetLocalPort() uint16_t UdpSocket::GetLocalPort() const
{ {
return this->localPort; return this->localPort;
} }
......
...@@ -23,7 +23,7 @@ public: ...@@ -23,7 +23,7 @@ public:
virtual ~UnixStreamSocket(); virtual ~UnixStreamSocket();
void Close(); void Close();
bool IsClosing(); bool IsClosing() const;
void Write(const uint8_t* data, size_t len); void Write(const uint8_t* data, size_t len);
void Write(const std::string &data); void Write(const std::string &data);
...@@ -60,7 +60,7 @@ protected: ...@@ -60,7 +60,7 @@ protected:
/* Inline methods. */ /* Inline methods. */
inline inline
bool UnixStreamSocket::IsClosing() bool UnixStreamSocket::IsClosing() const
{ {
return this->isClosing; return this->isClosing;
} }
......
...@@ -558,7 +558,7 @@ namespace RTC ...@@ -558,7 +558,7 @@ namespace RTC
delete this; delete this;
} }
void DtlsTransport::Dump() void DtlsTransport::Dump() const
{ {
MS_TRACE(); MS_TRACE();
......
...@@ -187,7 +187,7 @@ namespace RTC ...@@ -187,7 +187,7 @@ namespace RTC
} }
} }
bool IceServer::IsValidTuple(RTC::TransportTuple* tuple) bool IceServer::IsValidTuple(RTC::TransportTuple* tuple) const
{ {
MS_TRACE(); MS_TRACE();
...@@ -441,7 +441,7 @@ namespace RTC ...@@ -441,7 +441,7 @@ namespace RTC
} }
inline inline
RTC::TransportTuple* IceServer::HasTuple(RTC::TransportTuple* tuple) RTC::TransportTuple* IceServer::HasTuple(RTC::TransportTuple* tuple) const
{ {
MS_TRACE(); MS_TRACE();
...@@ -457,7 +457,7 @@ namespace RTC ...@@ -457,7 +457,7 @@ namespace RTC
// Otherwise check other stored tuples. // Otherwise check other stored tuples.
for (auto it = this->tuples.begin(); it != this->tuples.end(); ++it) for (auto it = this->tuples.begin(); it != this->tuples.end(); ++it)
{ {
RTC::TransportTuple* stored_tuple = std::addressof(*it); RTC::TransportTuple* stored_tuple = const_cast<RTC::TransportTuple*>(std::addressof(*it));
if (stored_tuple->Compare(tuple)) if (stored_tuple->Compare(tuple))
return stored_tuple; return stored_tuple;
......
...@@ -87,7 +87,7 @@ namespace RTC ...@@ -87,7 +87,7 @@ namespace RTC
delete this; delete this;
} }
Json::Value Peer::toJson() Json::Value Peer::toJson() const
{ {
MS_TRACE(); MS_TRACE();
...@@ -517,7 +517,7 @@ namespace RTC ...@@ -517,7 +517,7 @@ namespace RTC
this->notifier->Emit(this->peerId, "newrtpsender", event_data); this->notifier->Emit(this->peerId, "newrtpsender", event_data);
} }
RTC::RtpSender* Peer::GetRtpSender(uint32_t ssrc) RTC::RtpSender* Peer::GetRtpSender(uint32_t ssrc) const
{ {
MS_TRACE(); MS_TRACE();
...@@ -612,7 +612,7 @@ namespace RTC ...@@ -612,7 +612,7 @@ namespace RTC
} }
} }
RTC::Transport* Peer::GetTransportFromRequest(Channel::Request* request, uint32_t* transportId) RTC::Transport* Peer::GetTransportFromRequest(Channel::Request* request, uint32_t* transportId) const
{ {
MS_TRACE(); MS_TRACE();
...@@ -639,7 +639,7 @@ namespace RTC ...@@ -639,7 +639,7 @@ namespace RTC
} }
} }
RTC::RtpReceiver* Peer::GetRtpReceiverFromRequest(Channel::Request* request, uint32_t* rtpReceiverId) RTC::RtpReceiver* Peer::GetRtpReceiverFromRequest(Channel::Request* request, uint32_t* rtpReceiverId) const
{ {
MS_TRACE(); MS_TRACE();
...@@ -666,7 +666,7 @@ namespace RTC ...@@ -666,7 +666,7 @@ namespace RTC
} }
} }
RTC::RtpSender* Peer::GetRtpSenderFromRequest(Channel::Request* request, uint32_t* rtpSenderId) RTC::RtpSender* Peer::GetRtpSenderFromRequest(Channel::Request* request, uint32_t* rtpSenderId) const
{ {
MS_TRACE(); MS_TRACE();
......
...@@ -140,7 +140,7 @@ namespace RTC ...@@ -140,7 +140,7 @@ namespace RTC
delete this; delete this;
} }
Json::Value Room::toJson() Json::Value Room::toJson() const
{ {
MS_TRACE(); MS_TRACE();
...@@ -330,7 +330,7 @@ namespace RTC ...@@ -330,7 +330,7 @@ namespace RTC
} }
} }
RTC::Peer* Room::GetPeerFromRequest(Channel::Request* request, uint32_t* peerId) RTC::Peer* Room::GetPeerFromRequest(Channel::Request* request, uint32_t* peerId) const
{ {
MS_TRACE(); MS_TRACE();
......
...@@ -8,7 +8,7 @@ namespace RTC ...@@ -8,7 +8,7 @@ namespace RTC
{ {
/* Instance methods. */ /* Instance methods. */
Json::Value Parameters::toJson() Json::Value Parameters::toJson() const
{ {
MS_TRACE(); MS_TRACE();
......
...@@ -30,7 +30,7 @@ namespace RTC ...@@ -30,7 +30,7 @@ namespace RTC
this->parameter = data[k_parameter].asString(); this->parameter = data[k_parameter].asString();
} }
Json::Value RtcpFeedback::toJson() Json::Value RtcpFeedback::toJson() const
{ {
MS_TRACE(); MS_TRACE();
......
...@@ -37,7 +37,7 @@ namespace RTC ...@@ -37,7 +37,7 @@ namespace RTC
this->reducedSize = data[k_reducedSize].asBool(); this->reducedSize = data[k_reducedSize].asBool();
} }
Json::Value RtcpParameters::toJson() Json::Value RtcpParameters::toJson() const
{ {
MS_TRACE(); MS_TRACE();
......
...@@ -67,7 +67,7 @@ namespace RTC ...@@ -67,7 +67,7 @@ namespace RTC
ValidateCodecs(scope); ValidateCodecs(scope);
} }
Json::Value RtpCapabilities::toJson() Json::Value RtpCapabilities::toJson() const
{ {
MS_TRACE(); MS_TRACE();
......
...@@ -112,7 +112,7 @@ namespace RTC ...@@ -112,7 +112,7 @@ namespace RTC
CheckCodec(); CheckCodec();
} }
Json::Value RtpCodecParameters::toJson() Json::Value RtpCodecParameters::toJson() const
{ {
MS_TRACE(); MS_TRACE();
......
...@@ -88,7 +88,7 @@ namespace RTC ...@@ -88,7 +88,7 @@ namespace RTC
} }
} }
Json::Value RtpEncodingParameters::toJson() Json::Value RtpEncodingParameters::toJson() const
{ {
MS_TRACE(); MS_TRACE();
......
...@@ -30,7 +30,7 @@ namespace RTC ...@@ -30,7 +30,7 @@ namespace RTC
this->ssrc = (uint32_t)data[k_ssrc].asUInt(); this->ssrc = (uint32_t)data[k_ssrc].asUInt();
} }
Json::Value RtpFecParameters::toJson() Json::Value RtpFecParameters::toJson() const
{ {
MS_TRACE(); MS_TRACE();
......
...@@ -52,7 +52,7 @@ namespace RTC ...@@ -52,7 +52,7 @@ namespace RTC
this->preferredEncrypt = data[k_preferredEncrypt].asBool(); this->preferredEncrypt = data[k_preferredEncrypt].asBool();
} }
Json::Value RtpHeaderExtension::toJson() Json::Value RtpHeaderExtension::toJson() const
{ {
MS_TRACE(); MS_TRACE();
......
...@@ -47,7 +47,7 @@ namespace RTC ...@@ -47,7 +47,7 @@ namespace RTC
this->parameters.Set(data[k_parameters]); this->parameters.Set(data[k_parameters]);
} }
Json::Value RtpHeaderExtensionParameters::toJson() Json::Value RtpHeaderExtensionParameters::toJson() const
{ {
MS_TRACE(); MS_TRACE();
......
...@@ -107,7 +107,7 @@ namespace RTC ...@@ -107,7 +107,7 @@ namespace RTC
MS_TRACE(); MS_TRACE();
} }
Json::Value RtpParameters::toJson() Json::Value RtpParameters::toJson() const
{ {
MS_TRACE(); MS_TRACE();
...@@ -247,7 +247,7 @@ namespace RTC ...@@ -247,7 +247,7 @@ namespace RTC
this->headerExtensions = updatedHeaderExtensions; this->headerExtensions = updatedHeaderExtensions;
} }
uint32_t RtpParameters::GetClockRateForEncoding(RtpEncodingParameters& encoding) uint32_t RtpParameters::GetClockRateForEncoding(RtpEncodingParameters& encoding) const
{ {
MS_TRACE(); MS_TRACE();
......
...@@ -23,7 +23,7 @@ namespace RTC ...@@ -23,7 +23,7 @@ namespace RTC
this->ssrc = (uint32_t)data[k_ssrc].asUInt(); this->ssrc = (uint32_t)data[k_ssrc].asUInt();
} }
Json::Value RtpRtxParameters::toJson() Json::Value RtpRtxParameters::toJson() const
{ {
MS_TRACE(); MS_TRACE();
......
...@@ -9,7 +9,7 @@ namespace RTC ...@@ -9,7 +9,7 @@ namespace RTC
{ {
/* Instance methods. */ /* Instance methods. */
Json::Value RtpListener::toJson() Json::Value RtpListener::toJson() const
{ {
MS_TRACE(); MS_TRACE();
...@@ -323,7 +323,7 @@ namespace RTC ...@@ -323,7 +323,7 @@ namespace RTC
} }
} }
// TODO: We may emit "unhandledrtp" event. // TODO: We may emit 'unhandledrtp' event.
return nullptr; return nullptr;
} }
......
...@@ -142,7 +142,7 @@ namespace RTC ...@@ -142,7 +142,7 @@ namespace RTC
MS_TRACE(); MS_TRACE();
} }
void RtpPacket::Dump() void RtpPacket::Dump() const
{ {
MS_TRACE(); MS_TRACE();
......
...@@ -58,7 +58,7 @@ namespace RTC ...@@ -58,7 +58,7 @@ namespace RTC
delete this; delete this;
} }
Json::Value RtpReceiver::toJson() Json::Value RtpReceiver::toJson() const
{ {
MS_TRACE(); MS_TRACE();
......
...@@ -60,7 +60,7 @@ namespace RTC ...@@ -60,7 +60,7 @@ namespace RTC
delete this; delete this;
} }
Json::Value RtpSender::toJson() Json::Value RtpSender::toJson() const
{ {
MS_TRACE(); MS_TRACE();
...@@ -423,7 +423,7 @@ namespace RTC ...@@ -423,7 +423,7 @@ namespace RTC
} }
inline inline
void RtpSender::EmitActiveChange() void RtpSender::EmitActiveChange() const
{ {
MS_TRACE(); MS_TRACE();
......
...@@ -23,7 +23,7 @@ namespace RTC ...@@ -23,7 +23,7 @@ namespace RTC
MS_TRACE(); MS_TRACE();
} }
Json::Value RtpStreamRecv::toJson() Json::Value RtpStreamRecv::toJson() const
{ {
MS_TRACE(); MS_TRACE();
......
...@@ -28,7 +28,7 @@ namespace RTC ...@@ -28,7 +28,7 @@ namespace RTC
ClearBuffer(); ClearBuffer();
} }
Json::Value RtpStreamSend::toJson() Json::Value RtpStreamSend::toJson() const
{ {
MS_TRACE(); MS_TRACE();
......
...@@ -240,7 +240,7 @@ namespace RTC ...@@ -240,7 +240,7 @@ namespace RTC
MS_TRACE(); MS_TRACE();
} }
void StunMessage::Dump() void StunMessage::Dump() const
{ {
MS_TRACE(); MS_TRACE();
......
...@@ -247,7 +247,7 @@ namespace RTC ...@@ -247,7 +247,7 @@ namespace RTC
} }
} }
Json::Value Transport::toJson() Json::Value Transport::toJson() const
{ {
MS_TRACE(); MS_TRACE();
......
...@@ -10,7 +10,7 @@ namespace RTC ...@@ -10,7 +10,7 @@ namespace RTC
{ {
/* Instance methods. */ /* Instance methods. */
Json::Value TransportTuple::toJson() Json::Value TransportTuple::toJson() const
{ {
MS_TRACE(); MS_TRACE();
...@@ -42,7 +42,7 @@ namespace RTC ...@@ -42,7 +42,7 @@ namespace RTC
return json; return json;
} }
void TransportTuple::Dump() void TransportTuple::Dump() const
{ {
MS_TRACE(); MS_TRACE();
......
...@@ -131,7 +131,7 @@ void TcpConnection::Close() ...@@ -131,7 +131,7 @@ void TcpConnection::Close()
} }
} }
void TcpConnection::Dump() void TcpConnection::Dump() const
{ {
MS_DUMP("<TcpConnection>"); MS_DUMP("<TcpConnection>");
MS_DUMP(" [TCP, local:%s :%" PRIu16 ", remote:%s :%" PRIu16 ", status:%s]", MS_DUMP(" [TCP, local:%s :%" PRIu16 ", remote:%s :%" PRIu16 ", status:%s]",
......
...@@ -152,7 +152,7 @@ void TcpServer::Close() ...@@ -152,7 +152,7 @@ void TcpServer::Close()
} }
} }
void TcpServer::Dump() void TcpServer::Dump() const
{ {
MS_DUMP("<TcpServer>"); MS_DUMP("<TcpServer>");
MS_DUMP(" [TCP, local:%s :%" PRIu16 ", status:%s, connections:%zu]", MS_DUMP(" [TCP, local:%s :%" PRIu16 ", status:%s, connections:%zu]",
......
...@@ -170,7 +170,7 @@ void UdpSocket::Close() ...@@ -170,7 +170,7 @@ void UdpSocket::Close()
uv_close((uv_handle_t*)this->uvHandle, (uv_close_cb)on_close); uv_close((uv_handle_t*)this->uvHandle, (uv_close_cb)on_close);
} }
void UdpSocket::Dump() void UdpSocket::Dump() const
{ {
MS_DUMP("<UdpSocket>"); MS_DUMP("<UdpSocket>");
MS_DUMP(" [UDP, local:%s :%" PRIu16 ", status:%s]", MS_DUMP(" [UDP, local:%s :%" PRIu16 ", status:%s]",
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论