From 606f25131130159bfa24662281b5b4358235a60e Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Mon, 5 Apr 2021 11:07:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=9F=B3=E9=A2=91=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webrtc/Sdp.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/webrtc/Sdp.cpp b/webrtc/Sdp.cpp index 42e85241..6c55c9a1 100644 --- a/webrtc/Sdp.cpp +++ b/webrtc/Sdp.cpp @@ -558,6 +558,10 @@ void SdpAttrRtpMap::parse(const string &str) { if (sscanf(str.data(), "%" SCNu8 " %31[^/]/%" SCNd32, &pt, buf, &sample_rate) != 3) { SDP_THROW(); } + if (getTrackType(getCodecId(buf)) == TrackAudio) { + //未指定通道数时,且为音频时,那么通道数默认为1 + channel = 1; + } } codec = buf; } @@ -890,7 +894,7 @@ void RtcSession::loadFrom(const string &str, bool check) { auto rtpmap_it = rtpmap_map.find(pt); if (rtpmap_it == rtpmap_map.end()) { plan.pt = pt; - plan.codec = RtpPayload::getCodecId(pt); + plan.codec = RtpPayload::getName(pt); plan.sample_rate = RtpPayload::getClockRate(pt); plan.channel = RtpPayload::getAudioChannel(pt); } else {