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 {