From 232874f4b68180ddff4a59c8080c3e8239151d97 Mon Sep 17 00:00:00 2001 From: Jianjun Zhu Date: Thu, 1 Jun 2023 15:16:57 +0800 Subject: [PATCH] Ignore rejected sections to avoid malformatted SDP. m=section could be rejected because of no match codecs. In this case, munging SDP here may result media format description to be empty. --- talk/owt/sdk/base/sdputils.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/talk/owt/sdk/base/sdputils.cc b/talk/owt/sdk/base/sdputils.cc index a8f495366..00a1281a4 100644 --- a/talk/owt/sdk/base/sdputils.cc +++ b/talk/owt/sdk/base/sdputils.cc @@ -256,6 +256,10 @@ std::string SdpUtils::SetPreferCodecs(const std::string& sdp, RTC_LOG(LS_WARNING) << "Wrong SDP format description: " << m_line; return sdp; } + if (m_line_vector[1] == "0") { + RTC_LOG(LS_WARNING) << "Ignore rejected section: " << m_line; + return sdp; + } std::stringstream m_line_stream; for (int i = 0; i < 3; i++) { if (i < 2)