Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(294)

Unified Diff: webrtc/modules/audio_coding/acm2/acm_receiver.cc

Issue 2393873002: Remove old AcmReceiver::AddCodec overload
Patch Set: rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_coding/acm2/acm_receiver.cc
diff --git a/webrtc/modules/audio_coding/acm2/acm_receiver.cc b/webrtc/modules/audio_coding/acm2/acm_receiver.cc
index 73518b84fc9ac7f5a6c8fac0f359e5e2e536178f..e275e446c62bbbd76b7b601d65005168d808f243 100644
--- a/webrtc/modules/audio_coding/acm2/acm_receiver.cc
+++ b/webrtc/modules/audio_coding/acm2/acm_receiver.cc
@@ -179,59 +179,6 @@ int AcmReceiver::GetAudio(int desired_freq_hz,
return 0;
}
-int32_t AcmReceiver::AddCodec(int acm_codec_id,
- uint8_t payload_type,
- size_t channels,
- int /*sample_rate_hz*/,
- AudioDecoder* audio_decoder,
- const std::string& name) {
- // TODO(kwiberg): This function has been ignoring the |sample_rate_hz|
- // argument for a long time. Arguably, it should simply be removed.
-
- const auto neteq_decoder = [acm_codec_id, channels]() -> NetEqDecoder {
- if (acm_codec_id == -1)
- return NetEqDecoder::kDecoderArbitrary; // External decoder.
- const rtc::Optional<RentACodec::CodecId> cid =
- RentACodec::CodecIdFromIndex(acm_codec_id);
- RTC_DCHECK(cid) << "Invalid codec index: " << acm_codec_id;
- const rtc::Optional<NetEqDecoder> ned =
- RentACodec::NetEqDecoderFromCodecId(*cid, channels);
- RTC_DCHECK(ned) << "Invalid codec ID: " << static_cast<int>(*cid);
- return *ned;
- }();
- const rtc::Optional<SdpAudioFormat> new_format =
- RentACodec::NetEqDecoderToSdpAudioFormat(neteq_decoder);
-
- rtc::CritScope lock(&crit_sect_);
-
- const auto old_format = neteq_->GetDecoderFormat(payload_type);
- if (old_format && new_format && *old_format == *new_format) {
- // Re-registering the same codec. Do nothing and return.
- return 0;
- }
-
- if (neteq_->RemovePayloadType(payload_type) != NetEq::kOK &&
- neteq_->LastError() != NetEq::kDecoderNotFound) {
- LOG(LERROR) << "Cannot remove payload " << static_cast<int>(payload_type);
- return -1;
- }
-
- int ret_val;
- if (!audio_decoder) {
- ret_val = neteq_->RegisterPayloadType(neteq_decoder, name, payload_type);
- } else {
- ret_val = neteq_->RegisterExternalDecoder(
- audio_decoder, neteq_decoder, name, payload_type);
- }
- if (ret_val != NetEq::kOK) {
- LOG(LERROR) << "AcmReceiver::AddCodec " << acm_codec_id
- << static_cast<int>(payload_type)
- << " channels: " << channels;
- return -1;
- }
- return 0;
-}
-
bool AcmReceiver::AddCodec(int rtp_payload_type,
const SdpAudioFormat& audio_format) {
const auto old_format = neteq_->GetDecoderFormat(rtp_payload_type);
« no previous file with comments | « webrtc/modules/audio_coding/acm2/acm_receiver.h ('k') | webrtc/modules/audio_coding/acm2/acm_receiver_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698