Fixed Firefox WebRTC support through temporary hack

This commit is contained in:
Thulinma 2022-01-14 16:40:11 +01:00
parent 75559a367b
commit a8305396a2
2 changed files with 13 additions and 1 deletions

View file

@ -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<std::string>::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");
}

View file

@ -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<std::string> extmap;
std::string payloadTypes; ///< From `m=` line, all the payload types as string, separated by space.
std::map<uint64_t, MediaFormat> formats; ///< Formats indexed by payload type. Payload type is the number in the <fmt>
///< field(s) from the `m=` line.