diff --git a/lib/sdp_media.cpp b/lib/sdp_media.cpp index 86214c80..2ab03a08 100644 --- a/lib/sdp_media.cpp +++ b/lib/sdp_media.cpp @@ -603,6 +603,7 @@ namespace SDP{ SDP::Media *currMedia = NULL; std::stringstream ss(sdp); std::string line; + bool mozilla = false; while (std::getline(ss, line, '\n')){ @@ -611,6 +612,7 @@ namespace SDP{ if (line.empty()){ continue; } + if (line.find("mozilla") != std::string::npos){mozilla = true;} // Parse session (or) media data. else if (line.substr(0, 2) == "m="){ @@ -662,6 +664,8 @@ namespace SDP{ sdp_get_attribute_value(line, currMedia->mediaID); }else if (line.substr(0, 7) == "a=ssrc:"){ currMedia->parseSSRCLine(line); + }else if (mozilla && line.substr(0, 9) == "a=extmap:"){ + currMedia->extmap.insert(line); } }// while @@ -1022,7 +1026,14 @@ namespace SDP{ }else if (fmtMedia->encodingName == "OPUS"){ addLine("a=fmtp:%u minptime=10;useinbandfec=1", fmtMedia->payloadType); } - + //hacky way of adding sdes:mid extension line + if (isVideoEnabled && isAudioEnabled){ + for (std::set::iterator it = media->extmap.begin(); it != media->extmap.end(); ++it){ + if (it->find("sdes:mid") != std::string::npos){ + addLine(*it); + } + } + } addLine("a=candidate:1 1 udp 2130706431 %s %u typ host", candidateIP.c_str(), candidatePort); addLine("a=end-of-candidates"); } diff --git a/lib/sdp_media.h b/lib/sdp_media.h index f01914a4..88886ab0 100644 --- a/lib/sdp_media.h +++ b/lib/sdp_media.h @@ -131,6 +131,7 @@ namespace SDP{ bool supportsRTCPMux; ///< From `a=rtcp-mux`, indicates if it can mux RTP and RTCP on one ///< transport channel. bool supportsRTCPReducedSize; ///< From `a=rtcp-rsize`, reduced size RTCP packets. + std::set extmap; std::string payloadTypes; ///< From `m=` line, all the payload types as string, separated by space. std::map formats; ///< Formats indexed by payload type. Payload type is the number in the ///< field(s) from the `m=` line.