From bda378c340f52727d5b18a9c8575376f3c81044a Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Sun, 16 May 2021 18:06:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=8F=91=E9=80=81rtx=20rtp?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webrtc/WebRtcTransport.cpp | 5 ++++- webrtc/WebRtcTransport.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/webrtc/WebRtcTransport.cpp b/webrtc/WebRtcTransport.cpp index 9a911cde..d898c31a 100644 --- a/webrtc/WebRtcTransport.cpp +++ b/webrtc/WebRtcTransport.cpp @@ -820,11 +820,14 @@ void WebRtcTransportImp::onBeforeEncryptRtp(const char *buf, size_t &len, void * if (pr->second->answer_ssrc_rtx) { //有rtx单独的ssrc,有些情况下,浏览器支持rtx,但是未指定rtx单独的ssrc header->ssrc = htonl(pr->second->answer_ssrc_rtx); + } else { + //未单独指定rtx的ssrc,那么使用rtp的ssrc + header->ssrc = htonl(pr->second->answer_ssrc_rtp); } auto origin_seq = ntohs(header->seq); //seq跟原来的不一样 - header->seq = htons(origin_seq + 100); + header->seq = htons(_rtx_seq[pr->second->media->type]++); auto payload = header->getPayloadData(); auto payload_size = header->getPayloadSize(len); if (payload_size) { diff --git a/webrtc/WebRtcTransport.h b/webrtc/WebRtcTransport.h index 512db38b..11544eb6 100644 --- a/webrtc/WebRtcTransport.h +++ b/webrtc/WebRtcTransport.h @@ -360,6 +360,7 @@ private: void onSendNack(RtpPayloadInfo &info, const FCI_NACK &nack); private: + uint16_t _rtx_seq[2] = {0, 0}; //用掉的总流量 uint64_t _bytes_usage = 0; //媒体相关元数据