summaryrefslogtreecommitdiffstats
path: root/media/webrtc/signaling/src/jsep
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-03-30 09:44:21 +0200
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-03-30 09:44:21 +0200
commita1a007a4856fa50d6d811c2268f881e3666f4c67 (patch)
tree24b082c1bfb5777f1770c82a534bf765160bc1b8 /media/webrtc/signaling/src/jsep
parenteddd0de2ae80e176011f41a5400e81522d53f4f3 (diff)
parent59bf4204a84f7638d3f89a29bc7c04e5dc401369 (diff)
downloadUXP-a1a007a4856fa50d6d811c2268f881e3666f4c67.tar
UXP-a1a007a4856fa50d6d811c2268f881e3666f4c67.tar.gz
UXP-a1a007a4856fa50d6d811c2268f881e3666f4c67.tar.lz
UXP-a1a007a4856fa50d6d811c2268f881e3666f4c67.tar.xz
UXP-a1a007a4856fa50d6d811c2268f881e3666f4c67.zip
Merge branch 'master' of https://github.com/MoonchildProductions/UXP into html_input_datetime_1
Diffstat (limited to 'media/webrtc/signaling/src/jsep')
-rw-r--r--media/webrtc/signaling/src/jsep/JsepTrack.cpp29
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;
}
}