mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-23 07:37:29 +09:00
Bug 1433005 - Simplify codec pruning in NegotiateCodecs. r=bwc, a=lizzard
--HG-- extra : source : 90ae99509f1e9cb5bdf19350a5fbb1a02d34ff0a
This commit is contained in:
parent
98beed2404
commit
62821e5092
1 changed files with 17 additions and 12 deletions
|
|
@ -410,21 +410,26 @@ JsepTrack::NegotiateCodecs(
|
||||||
|
|
||||||
// TODO(bug 814227): Remove this once we're ready to put multiple codecs in an
|
// 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
|
// 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.
|
// exists, in which case 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.
|
|
||||||
if (!codecs->empty() && !red) {
|
if (!codecs->empty() && !red) {
|
||||||
int newSize = dtmf ? 2 : 1;
|
std::vector<JsepCodecDescription*> codecsToKeep;
|
||||||
for (size_t i = 1; i < codecs->size(); ++i) {
|
|
||||||
if (!dtmf || dtmf != (*codecs)[i]) {
|
bool foundPreferredCodec = false;
|
||||||
delete (*codecs)[i];
|
for (auto codec: *codecs) {
|
||||||
(*codecs)[i] = nullptr;
|
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 = codecsToKeep;
|
||||||
}
|
|
||||||
codecs->resize(newSize);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue