From a42b56ba94256aaeb319c9a199edc4ccd1e709b4 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Tue, 6 Apr 2021 22:51:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=BC=E5=AE=B9Firefox?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webrtc/Sdp.cpp | 8 ++++++-- webrtc/Sdp.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/webrtc/Sdp.cpp b/webrtc/Sdp.cpp index 8951e0ee..fc7f2154 100644 --- a/webrtc/Sdp.cpp +++ b/webrtc/Sdp.cpp @@ -604,9 +604,10 @@ void SdpAttrFmtp::parse(const string &str) { trim(item); auto pos = item.find('='); if(pos == string::npos){ - SDP_THROW(); + arr.emplace_back(std::make_pair(item, "")); + } else { + arr.emplace_back(std::make_pair(item.substr(0, pos), item.substr(pos + 1))); } - arr.emplace_back(std::make_pair(item.substr(0, pos), item.substr(pos + 1))); } if (arr.empty()) { SDP_THROW(); @@ -784,6 +785,9 @@ void RtcSession::loadFrom(const string &str, bool check) { rtc_media.ice_pwd = media.getStringItem('a', "ice-pwd"); rtc_media.role = media.getItemClass('a', "setup").role; rtc_media.fingerprint = media.getItemClass('a', "fingerprint"); + if (rtc_media.fingerprint.empty()) { + rtc_media.fingerprint = sdp.getItemClass('a', "fingerprint"); + } rtc_media.ice_lite = media.getItem('a', "ice-lite").operator bool(); auto ice_options = media.getItemClass('a', "ice-options"); rtc_media.ice_trickle = ice_options.trickle; diff --git a/webrtc/Sdp.h b/webrtc/Sdp.h index b8328577..7fc0b0b9 100644 --- a/webrtc/Sdp.h +++ b/webrtc/Sdp.h @@ -301,6 +301,7 @@ public: void parse(const string &str) override; string toString() const override; const char* getKey() const override { return "fingerprint";} + bool empty() const { return algorithm.empty() || hash.empty(); } }; class SdpAttrSetup : public SdpItem {