mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-21 01:13:37 +08:00
修复webrtc srtp相关功能在大端64位系统崩溃的问题
This commit is contained in:
parent
8fd9853bc9
commit
1d161bcdc2
@ -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();
|
||||
|
||||
|
@ -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) });
|
||||
|
@ -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<bool/*rtx*/, MediaTrack *> *) ctx;
|
||||
auto header = (RtpHeader *) buf;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user