Skip to content

Commit

Permalink
setCodecPreferences: dont insert red codec twice
Browse files Browse the repository at this point in the history
this could happen if setCodecPreferences is used to prefer
red over opus as it is done for red+opus.

BUG=webrtc:13287

Change-Id: I3d61cd8f1a364572bc531a75dcc239c3919138cc
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/237800
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Philipp Hancke <philipp.hancke@googlemail.com>
Cr-Commit-Position: refs/heads/main@{#35344}
  • Loading branch information
fippo authored and WebRTC LUCI CQ committed Nov 15, 2021
1 parent 62bb58f commit 60c01cc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pc/media_session.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1084,14 +1084,20 @@ static Codecs MatchCodecPreference(
break;
}
} else if (IsRedCodec(codec)) {
// For RED, do not insert the codec again if it was already
// inserted. audio/red for opus gets enabled by having RED before
// the primary codec.
const auto fmtp =
codec.params.find(cricket::kCodecParamNotInNameValueFormat);
if (fmtp != codec.params.end()) {
std::vector<std::string> redundant_payloads;
rtc::split(fmtp->second, '/', &redundant_payloads);
if (redundant_payloads.size() > 0 &&
redundant_payloads[0] == id) {
filtered_codecs.push_back(codec);
if (std::find(filtered_codecs.begin(), filtered_codecs.end(),
codec) == filtered_codecs.end()) {
filtered_codecs.push_back(codec);
}
break;
}
}
Expand Down

0 comments on commit 60c01cc

Please sign in to comment.