From 7cdd5ed9dfb123b2b4db7bbf6ed539f435a22b3e Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Sun, 16 May 2021 16:59:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Drtx=E5=8C=85=E6=9C=AA?= =?UTF-8?q?=E4=BF=AE=E6=94=B9rtp=20ext=20id=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webrtc/WebRtcTransport.cpp | 8 ++++---- webrtc/WebRtcTransport.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) 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;