diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-03-15 09:11:31 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-03-15 09:11:31 +0100 |
commit | 82b361dc4463b13ebda30090e239db487f5aa308 (patch) | |
tree | fdc6fd06e695188735d636da57b02b6c7e0c1c5f /media/webrtc/signaling/src | |
parent | 4bb98e2b61ce75d7f5d19398b658441a7ceed04b (diff) | |
parent | 71429dc7ecc496c5924c770746e8c28449ecb7a2 (diff) | |
download | UXP-82b361dc4463b13ebda30090e239db487f5aa308.tar UXP-82b361dc4463b13ebda30090e239db487f5aa308.tar.gz UXP-82b361dc4463b13ebda30090e239db487f5aa308.tar.lz UXP-82b361dc4463b13ebda30090e239db487f5aa308.tar.xz UXP-82b361dc4463b13ebda30090e239db487f5aa308.zip |
Merge branch 'ported-upstream'
Diffstat (limited to 'media/webrtc/signaling/src')
-rw-r--r-- | media/webrtc/signaling/src/jsep/JsepTrack.cpp | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/media/webrtc/signaling/src/jsep/JsepTrack.cpp b/media/webrtc/signaling/src/jsep/JsepTrack.cpp index 1b045d8ec..cf5df96bf 100644 --- a/media/webrtc/signaling/src/jsep/JsepTrack.cpp +++ b/media/webrtc/signaling/src/jsep/JsepTrack.cpp @@ -410,21 +410,26 @@ JsepTrack::NegotiateCodecs( // TODO(bug 814227): Remove this once we're ready to put multiple codecs in an // answer. For now, remove all but the first codec unless the red codec - // exists, and then we include the others per RFC 5109, section 14.2. - // Note: now allows keeping the telephone-event codec, if it appears, as the - // last codec in the list. + // exists, in which case we include the others per RFC 5109, section 14.2. if (!codecs->empty() && !red) { - int newSize = dtmf ? 2 : 1; - for (size_t i = 1; i < codecs->size(); ++i) { - if (!dtmf || dtmf != (*codecs)[i]) { - delete (*codecs)[i]; - (*codecs)[i] = nullptr; + std::vector<JsepCodecDescription*> codecsToKeep; + + bool foundPreferredCodec = false; + for (auto codec: *codecs) { + if (codec == dtmf) { + codecsToKeep.push_back(codec); + // TODO: keep ulpfec when we enable it in Bug 875922 + // } else if (codec == ulpfec) { + // codecsToKeep.push_back(codec); + } else if (!foundPreferredCodec) { + codecsToKeep.insert(codecsToKeep.begin(), codec); + foundPreferredCodec = true; + } else { + delete codec; } } - if (dtmf) { - (*codecs)[newSize-1] = dtmf; - } - codecs->resize(newSize); + + *codecs = codecsToKeep; } } |