From c6d2b41d977410fe57ee9aa053919b9c16c413d6 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Sun, 16 May 2021 21:49:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84rtp=20ext=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E5=A4=84=E7=90=86=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webrtc/WebRtcTransport.cpp | 8 ++++---- webrtc/WebRtcTransport.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/webrtc/WebRtcTransport.cpp b/webrtc/WebRtcTransport.cpp index 5d7b0cdc..0d8fb0d8 100644 --- a/webrtc/WebRtcTransport.cpp +++ b/webrtc/WebRtcTransport.cpp @@ -668,7 +668,7 @@ void WebRtcTransportImp::onRtcp(const char *buf, size_t len) { /////////////////////////////////////////////////////////////////// -void WebRtcTransportImp::changeRtpExtId(const RtpHeader *header, bool is_recv, bool is_rtx) const{ +void WebRtcTransportImp::changeRtpExtId(const RtpPayloadInfo *info, const RtpHeader *header, bool is_recv, bool is_rtx) const{ auto ext_map = RtpExt::getExtValue(header); for (auto &pr : ext_map) { if (is_recv) { @@ -732,7 +732,7 @@ void WebRtcTransportImp::onRtp_l(const char *buf, size_t len, bool rtx) { info->rtcp_context_recv->onRtp(seq, stamp_ms, len); } //修改ext id至统一 - changeRtpExtId(rtp, true); + changeRtpExtId(info.get(), rtp, true, rtx); //解析并排序rtp info->receiver->inputRtp(info->media->type, info->plan_rtp->sample_rate, (uint8_t *) buf, len); return; @@ -817,12 +817,12 @@ void WebRtcTransportImp::onBeforeEncryptRtp(const char *buf, size_t &len, void * if (!pr->first || !pr->second->plan_rtx) { //普通的rtp,或者不支持rtx, 修改目标pt和ssrc - changeRtpExtId(header, false, false); + changeRtpExtId(pr->second, header, false, false); header->pt = pr->second->plan_rtp->pt; header->ssrc = htonl(pr->second->answer_ssrc_rtp); } else { //重传的rtp, rtx - changeRtpExtId(header, false, true); + changeRtpExtId(pr->second, header, false, true); header->pt = pr->second->plan_rtx->pt; if (pr->second->answer_ssrc_rtx) { //有rtx单独的ssrc,有些情况下,浏览器支持rtx,但是未指定rtx单独的ssrc diff --git a/webrtc/WebRtcTransport.h b/webrtc/WebRtcTransport.h index 7ed7b9dc..7f0dbb6b 100644 --- a/webrtc/WebRtcTransport.h +++ b/webrtc/WebRtcTransport.h @@ -338,7 +338,6 @@ private: SdpAttrCandidate::Ptr getIceCandidate() const; bool canSendRtp() const; bool canRecvRtp() const; - void changeRtpExtId(const RtpHeader *header, bool is_recv, bool is_rtx = false) const; class RtpPayloadInfo { public: @@ -359,6 +358,7 @@ private: void onSortedRtp(RtpPayloadInfo &info, RtpPacket::Ptr rtp); void onSendNack(RtpPayloadInfo &info, const FCI_NACK &nack); + void changeRtpExtId(const RtpPayloadInfo *info, const RtpHeader *header, bool is_recv, bool is_rtx = false) const; private: uint16_t _rtx_seq[2] = {0, 0};