From 4dcac10b3af32f832687b2c37d8f57f02624800c Mon Sep 17 00:00:00 2001 From: ziyue <1213642868@qq.com> Date: Mon, 18 Oct 2021 17:35:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dwebrtc=20echo=20test=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E5=9C=A8chrome=E4=B8=8A=E4=BD=BF=E7=94=A8=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webrtc/WebRtcEchoTest.cpp | 11 +++++++++++ webrtc/WebRtcEchoTest.h | 1 + 2 files changed, 12 insertions(+) diff --git a/webrtc/WebRtcEchoTest.cpp b/webrtc/WebRtcEchoTest.cpp index cb03c195..d2ad8e92 100644 --- a/webrtc/WebRtcEchoTest.cpp +++ b/webrtc/WebRtcEchoTest.cpp @@ -34,3 +34,14 @@ void WebRtcEchoTest::onRtp(const char *buf, size_t len, uint64_t stamp_ms) { void WebRtcEchoTest::onRtcp(const char *buf, size_t len) { sendRtcpPacket(buf, len, true, nullptr); } + +//修改mline的a=msid属性,目的是在echo test的情况下,如果offer和answer的msid相同,chrome会忽略远端的track +void WebRtcEchoTest::onCheckSdp(SdpType type, RtcSession &sdp) { + if (type == SdpType::answer) { + for (auto &m : sdp.media) { + for (auto &ssrc : m.rtp_rtx_ssrc) { + ssrc.msid = "zlmediakit msid"; + } + } + } +} \ No newline at end of file diff --git a/webrtc/WebRtcEchoTest.h b/webrtc/WebRtcEchoTest.h index b212ac41..75feda5e 100644 --- a/webrtc/WebRtcEchoTest.h +++ b/webrtc/WebRtcEchoTest.h @@ -22,6 +22,7 @@ public: protected: ///////WebRtcTransportImp override/////// void onRtcConfigure(RtcConfigure &configure) const override; + void onCheckSdp(SdpType type, RtcSession &sdp) override; void onRtp(const char *buf, size_t len, uint64_t stamp_ms) override; void onRtcp(const char *buf, size_t len) override;