From 5756ed46e04097aefbc4152bc77e8a2c804ad182 Mon Sep 17 00:00:00 2001 From: xia-chu <771730766@qq.com> Date: Fri, 7 May 2021 18:34:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0ext=E8=B0=83=E8=AF=95?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webrtc/WebRtcTransport.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/webrtc/WebRtcTransport.cpp b/webrtc/WebRtcTransport.cpp index 7ce870ae..eda327a0 100644 --- a/webrtc/WebRtcTransport.cpp +++ b/webrtc/WebRtcTransport.cpp @@ -10,6 +10,7 @@ #include "WebRtcTransport.h" #include +#include "RtpExt.h" #include "Rtcp/Rtcp.h" #include "Rtcp/RtcpFCI.h" #include "Rtsp/RtpReceiver.h" @@ -187,13 +188,7 @@ void WebRtcTransport::onCheckSdp(SdpType type, RtcSession &sdp){ void WebRtcTransport::onRtcConfigure(RtcConfigure &configure) const { //开启remb后关闭twcc,因为开启twcc后remb无效 GET_CONFIG(size_t, remb_bit_rate, RTC::kRembBitRate); - if (remb_bit_rate) { - configure.enableREMB(true); - configure.enableTWCC(false); - } else { - configure.enableREMB(false); - configure.enableTWCC(true); - } + configure.enableTWCC(!remb_bit_rate); } std::string WebRtcTransport::getAnswerSdp(const string &offer){ @@ -633,6 +628,19 @@ void WebRtcTransportImp::onSortedRtp(const RtpPayloadInfo &info, RtpPacket::Ptr sendRtcpRemb(_recv_video_ssrc, remb_bit_rate); } } + + auto header = rtp->getHeader(); + auto ext_map = RtpExt::getExtValue(header, *(info.media)); + for (auto &pr : ext_map) { + if (rtp->type == TrackVideo) { + InfoL << pr.second.dumpString(); + } else { + DebugL << pr.second.dumpString(); + } + //推流时修改ext id为统一的id,播放时再修改为对方设置的ext id + pr.second.setExtId((uint8_t) pr.first); + } + if (_push_src) { _push_src->onWrite(std::move(rtp), false); }