diff --git a/media/engine/webrtc_voice_engine.cc b/media/engine/webrtc_voice_engine.cc index a7568696db..f8c237173f 100644 --- a/media/engine/webrtc_voice_engine.cc +++ b/media/engine/webrtc_voice_engine.cc @@ -413,8 +413,8 @@ std::vector LegacyCollectCodecs( if (allocate_pt) { std::string red_fmtp = rtc::ToString(codec.id) + "/" + rtc::ToString(codec.id); - cricket::Codec red_codec = - CreateAudioCodec({kRedCodecName, 48000, 2, {{"", red_fmtp}}}); + cricket::Codec red_codec = CreateAudioCodec( + {kRedCodecName, codec.clockrate, codec.channels, {{"", red_fmtp}}}); red_codec.id = pt_mapper.SuggestMapping(red_codec, nullptr).value(); out.push_back(red_codec); } else { diff --git a/pc/media_session.cc b/pc/media_session.cc index c5c262a6f7..755d6fe967 100644 --- a/pc/media_session.cc +++ b/pc/media_session.cc @@ -434,7 +434,7 @@ webrtc::RTCError AssignCodecIdsAndLinkRed( webrtc::PayloadTypeSuggester* pt_suggester, const std::string& mid, std::vector& codecs) { - int opus_codec = Codec::kIdNotSet; + int codec_payload_type = Codec::kIdNotSet; for (cricket::Codec& codec : codecs) { if (codec.id == Codec::kIdNotSet) { // Add payload types to codecs, if needed @@ -449,18 +449,18 @@ webrtc::RTCError AssignCodecIdsAndLinkRed( } // record first Opus codec id if (absl::EqualsIgnoreCase(codec.name, kOpusCodecName) && - opus_codec == Codec::kIdNotSet) { - opus_codec = codec.id; + codec_payload_type == Codec::kIdNotSet) { + codec_payload_type = codec.id; } } - if (opus_codec != Codec::kIdNotSet) { + if (codec_payload_type != Codec::kIdNotSet) { for (cricket::Codec& codec : codecs) { if (codec.type == Codec::Type::kAudio && absl::EqualsIgnoreCase(codec.name, kRedCodecName)) { if (codec.params.empty()) { char buffer[100]; rtc::SimpleStringBuilder param(buffer); - param << opus_codec << "/" << opus_codec; + param << codec_payload_type << "/" << codec_payload_type; RTC_LOG(LS_ERROR) << "DEBUG: Setting RED param to " << param.str(); codec.SetParam(kCodecParamNotInNameValueFormat, param.str()); }