diff --git a/webrtc/WebRtcTransport.cpp b/webrtc/WebRtcTransport.cpp index 3ff65047..9a911cde 100644 --- a/webrtc/WebRtcTransport.cpp +++ b/webrtc/WebRtcTransport.cpp @@ -269,7 +269,7 @@ void WebRtcTransport::inputSockData(char *buf, size_t len, RTC::TransportTuple * } } -void WebRtcTransport::sendRtpPacket(char *buf, size_t len, bool flush, void *ctx) { +void WebRtcTransport::sendRtpPacket(const char *buf, size_t len, bool flush, void *ctx) { if (_srtp_session_send) { //预留rtx加入的两个字节 CHECK(len + SRTP_MAX_TRAILER_LEN + 2 <= sizeof(_srtp_buf)); @@ -281,7 +281,7 @@ void WebRtcTransport::sendRtpPacket(char *buf, size_t len, bool flush, void *ctx } } -void WebRtcTransport::sendRtcpPacket(char *buf, size_t len, bool flush, void *ctx){ +void WebRtcTransport::sendRtcpPacket(const char *buf, size_t len, bool flush, void *ctx){ if (_srtp_session_send) { CHECK(len + SRTP_MAX_TRAILER_LEN <= sizeof(_srtp_buf)); memcpy(_srtp_buf, buf, len); @@ -720,13 +720,13 @@ void WebRtcTransportImp::onRtp_l(const char *buf, size_t len, bool rtx) { if (!rtx) { //统计rtp接受情况,便于生成nack rtcp包 info->nack_ctx.received(seq); - //修改ext id至统一 - changeRtpExtId(rtp, _rtp_ext_id_to_type); //时间戳转换成毫秒 auto stamp_ms = ntohl(rtp->stamp) * uint64_t(1000) / info->plan_rtp->sample_rate; //统计rtp收到的情况,好做rr汇报 info->rtcp_context_recv->onRtp(seq, stamp_ms, len); } + //修改ext id至统一 + changeRtpExtId(rtp, _rtp_ext_id_to_type); //解析并排序rtp info->receiver->inputRtp(info->media->type, info->plan_rtp->sample_rate, (uint8_t *) buf, len); return; diff --git a/webrtc/WebRtcTransport.h b/webrtc/WebRtcTransport.h index 21b09372..512db38b 100644 --- a/webrtc/WebRtcTransport.h +++ b/webrtc/WebRtcTransport.h @@ -63,8 +63,8 @@ public: * @param flush 是否flush socket * @param ctx 用户指针 */ - void sendRtpPacket(char *buf, size_t len, bool flush, void *ctx = nullptr); - void sendRtcpPacket(char *buf, size_t len, bool flush, void *ctx = nullptr); + 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); const EventPoller::Ptr& getPoller() const;