兼容Firefox

This commit is contained in:
xiongziliang 2021-04-06 22:51:16 +08:00
parent b5bf930467
commit a42b56ba94
2 changed files with 7 additions and 2 deletions

View File

@ -604,9 +604,10 @@ void SdpAttrFmtp::parse(const string &str) {
trim(item); trim(item);
auto pos = item.find('='); auto pos = item.find('=');
if(pos == string::npos){ 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()) { if (arr.empty()) {
SDP_THROW(); 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.ice_pwd = media.getStringItem('a', "ice-pwd");
rtc_media.role = media.getItemClass<SdpAttrSetup>('a', "setup").role; rtc_media.role = media.getItemClass<SdpAttrSetup>('a', "setup").role;
rtc_media.fingerprint = media.getItemClass<SdpAttrFingerprint>('a', "fingerprint"); rtc_media.fingerprint = media.getItemClass<SdpAttrFingerprint>('a', "fingerprint");
if (rtc_media.fingerprint.empty()) {
rtc_media.fingerprint = sdp.getItemClass<SdpAttrFingerprint>('a', "fingerprint");
}
rtc_media.ice_lite = media.getItem('a', "ice-lite").operator bool(); rtc_media.ice_lite = media.getItem('a', "ice-lite").operator bool();
auto ice_options = media.getItemClass<SdpAttrIceOption>('a', "ice-options"); auto ice_options = media.getItemClass<SdpAttrIceOption>('a', "ice-options");
rtc_media.ice_trickle = ice_options.trickle; rtc_media.ice_trickle = ice_options.trickle;

View File

@ -301,6 +301,7 @@ public:
void parse(const string &str) override; void parse(const string &str) override;
string toString() const override; string toString() const override;
const char* getKey() const override { return "fingerprint";} const char* getKey() const override { return "fingerprint";}
bool empty() const { return algorithm.empty() || hash.empty(); }
}; };
class SdpAttrSetup : public SdpItem { class SdpAttrSetup : public SdpItem {