mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 10:40:05 +08:00
兼容webrtc offer sdp中重复行的情况 (#3038)
This commit is contained in:
parent
644a333ec3
commit
586bb73912
@ -267,16 +267,23 @@ void RtcSessionSdp::parse(const string &str) {
|
|||||||
static auto flag = registerAllItem();
|
static auto flag = registerAllItem();
|
||||||
RtcSdpBase *media = nullptr;
|
RtcSdpBase *media = nullptr;
|
||||||
auto lines = split(str, "\n");
|
auto lines = split(str, "\n");
|
||||||
for(auto &line : lines){
|
std::set<std::string> line_set;
|
||||||
|
for (auto &line : lines) {
|
||||||
trim(line);
|
trim(line);
|
||||||
if(line.size() < 3 || line[1] != '='){
|
if (line.size() < 3 || line[1] != '=') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!line_set.emplace(line).second) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
auto key = line.substr(0, 1);
|
auto key = line.substr(0, 1);
|
||||||
auto value = line.substr(2);
|
auto value = line.substr(2);
|
||||||
if (!strcasecmp(key.data(), "m")) {
|
if (!strcasecmp(key.data(), "m")) {
|
||||||
medias.emplace_back(RtcSdpBase());
|
medias.emplace_back(RtcSdpBase());
|
||||||
media = &medias.back();
|
media = &medias.back();
|
||||||
|
line_set.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
SdpItem::Ptr item;
|
SdpItem::Ptr item;
|
||||||
|
Loading…
Reference in New Issue
Block a user