diff --git a/webrtc/SrtpSession.cpp b/webrtc/SrtpSession.cpp index c4e30240..4b81efad 100644 --- a/webrtc/SrtpSession.cpp +++ b/webrtc/SrtpSession.cpp @@ -231,7 +231,7 @@ namespace RTC } } - bool SrtpSession::EncryptRtp(uint8_t* data, size_t* len) + bool SrtpSession::EncryptRtp(uint8_t* data, int* len) { MS_TRACE(); srtp_err_status_t err = @@ -246,7 +246,7 @@ namespace RTC return true; } - bool SrtpSession::DecryptSrtp(uint8_t* data, size_t* len) + bool SrtpSession::DecryptSrtp(uint8_t* data, int* len) { MS_TRACE(); @@ -262,7 +262,7 @@ namespace RTC return true; } - bool SrtpSession::EncryptRtcp(uint8_t* data, size_t* len) + bool SrtpSession::EncryptRtcp(uint8_t* data, int* len) { MS_TRACE(); srtp_err_status_t err = srtp_protect_rtcp( @@ -277,7 +277,7 @@ namespace RTC return true; } - bool SrtpSession::DecryptSrtcp(uint8_t* data, size_t* len) + bool SrtpSession::DecryptSrtcp(uint8_t* data, int* len) { MS_TRACE(); diff --git a/webrtc/SrtpSession.hpp b/webrtc/SrtpSession.hpp index a50684e5..69a562f0 100644 --- a/webrtc/SrtpSession.hpp +++ b/webrtc/SrtpSession.hpp @@ -64,10 +64,10 @@ namespace RTC ~SrtpSession(); public: - bool EncryptRtp(uint8_t* data, size_t* len); - bool DecryptSrtp(uint8_t* data, size_t* len); - bool EncryptRtcp(uint8_t* data, size_t* len); - bool DecryptSrtcp(uint8_t* data, size_t* len); + bool EncryptRtp(uint8_t* data, int* len); + bool DecryptSrtp(uint8_t* data, int* len); + bool EncryptRtcp(uint8_t* data, int* len); + bool DecryptSrtcp(uint8_t* data, int* len); void RemoveStream(uint32_t ssrc) { srtp_remove_stream(this->session, uint32_t{ htonl(ssrc) }); diff --git a/webrtc/WebRtcTransport.cpp b/webrtc/WebRtcTransport.cpp index dde68fc1..cbbb3b72 100644 --- a/webrtc/WebRtcTransport.cpp +++ b/webrtc/WebRtcTransport.cpp @@ -236,7 +236,7 @@ bool is_rtcp(char *buf) { return ((header->pt >= 64) && (header->pt < 96)); } -void WebRtcTransport::inputSockData(char *buf, size_t len, RTC::TransportTuple *tuple) { +void WebRtcTransport::inputSockData(char *buf, int len, RTC::TransportTuple *tuple) { if (RTC::StunPacket::IsStun((const uint8_t *) buf, len)) { RTC::StunPacket *packet = RTC::StunPacket::Parse((const uint8_t *) buf, len); if (packet == nullptr) { @@ -264,7 +264,7 @@ void WebRtcTransport::inputSockData(char *buf, size_t len, RTC::TransportTuple * } } -void WebRtcTransport::sendRtpPacket(const char *buf, size_t len, bool flush, void *ctx) { +void WebRtcTransport::sendRtpPacket(const char *buf, int len, bool flush, void *ctx) { if (_srtp_session_send) { //预留rtx加入的两个字节 CHECK(len + SRTP_MAX_TRAILER_LEN + 2 <= sizeof(_srtp_buf)); @@ -276,7 +276,7 @@ void WebRtcTransport::sendRtpPacket(const char *buf, size_t len, bool flush, voi } } -void WebRtcTransport::sendRtcpPacket(const char *buf, size_t len, bool flush, void *ctx){ +void WebRtcTransport::sendRtcpPacket(const char *buf, int len, bool flush, void *ctx){ if (_srtp_session_send) { CHECK(len + SRTP_MAX_TRAILER_LEN <= sizeof(_srtp_buf)); memcpy(_srtp_buf, buf, len); @@ -901,7 +901,7 @@ void WebRtcTransportImp::onSendRtp(const RtpPacket::Ptr &rtp, bool flush, bool r _bytes_usage += rtp->size() - RtpPacket::kRtpTcpHeaderSize; } -void WebRtcTransportImp::onBeforeEncryptRtp(const char *buf, size_t &len, void *ctx) { +void WebRtcTransportImp::onBeforeEncryptRtp(const char *buf, int &len, void *ctx) { auto pr = (pair *) ctx; auto header = (RtpHeader *) buf; diff --git a/webrtc/WebRtcTransport.h b/webrtc/WebRtcTransport.h index 30ba2f95..d96a8939 100644 --- a/webrtc/WebRtcTransport.h +++ b/webrtc/WebRtcTransport.h @@ -56,7 +56,7 @@ public: * @param len 数据长度 * @param tuple 数据来源 */ - void inputSockData(char *buf, size_t len, RTC::TransportTuple *tuple); + void inputSockData(char *buf, int len, RTC::TransportTuple *tuple); /** * 发送rtp @@ -65,8 +65,8 @@ public: * @param flush 是否flush socket * @param ctx 用户指针 */ - void sendRtpPacket(const char *buf, size_t len, bool flush, void *ctx = nullptr); - void sendRtcpPacket(const char *buf, size_t len, bool flush, void *ctx = nullptr); + void sendRtpPacket(const char *buf, int len, bool flush, void *ctx = nullptr); + void sendRtcpPacket(const char *buf, int len, bool flush, void *ctx = nullptr); const EventPoller::Ptr& getPoller() const; @@ -103,8 +103,8 @@ protected: virtual void onRtp(const char *buf, size_t len) = 0; virtual void onRtcp(const char *buf, size_t len) = 0; virtual void onShutdown(const SockException &ex) = 0; - virtual void onBeforeEncryptRtp(const char *buf, size_t &len, void *ctx) = 0; - virtual void onBeforeEncryptRtcp(const char *buf, size_t &len, void *ctx) = 0; + virtual void onBeforeEncryptRtp(const char *buf, int &len, void *ctx) = 0; + virtual void onBeforeEncryptRtcp(const char *buf, int &len, void *ctx) = 0; protected: const RtcSession& getSdp(SdpType type) const; @@ -176,8 +176,8 @@ protected: void onRtp(const char *buf, size_t len) override; void onRtcp(const char *buf, size_t len) override; - void onBeforeEncryptRtp(const char *buf, size_t &len, void *ctx) override; - void onBeforeEncryptRtcp(const char *buf, size_t &len, void *ctx) override {}; + void onBeforeEncryptRtp(const char *buf, int &len, void *ctx) override; + void onBeforeEncryptRtcp(const char *buf, int &len, void *ctx) override {}; void onShutdown(const SockException &ex) override;