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; //媒体相关元数据