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

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

Issue 1312493004: Add support for external decoders in ACM (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@isac-lock-2
Patch Set: Created 5 years, 4 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/main/acm2/acm_receiver.cc
diff --git a/webrtc/modules/audio_coding/main/acm2/acm_receiver.cc b/webrtc/modules/audio_coding/main/acm2/acm_receiver.cc
index ae5a04f25e05aebd80ac21d6b222929e1b3ba896..4c11197f49f97ebca6cabd7809baaba0fe923cc3 100644
--- a/webrtc/modules/audio_coding/main/acm2/acm_receiver.cc
+++ b/webrtc/modules/audio_coding/main/acm2/acm_receiver.cc
@@ -476,8 +476,10 @@ int32_t AcmReceiver::AddCodec(int acm_codec_id,
int channels,
int sample_rate_hz,
AudioDecoder* audio_decoder) {
- assert(acm_codec_id >= 0);
- NetEqDecoder neteq_decoder = ACMCodecDB::neteq_decoders_[acm_codec_id];
+ assert(acm_codec_id >= -1); // -1 means external decoder
+ NetEqDecoder neteq_decoder = (acm_codec_id == -1)
+ ? kDecoderArbitrary
+ : ACMCodecDB::neteq_decoders_[acm_codec_id];
// Make sure the right decoder is registered for Opus.
if (neteq_decoder == kDecoderOpus && channels == 2) {
@@ -491,14 +493,15 @@ int32_t AcmReceiver::AddCodec(int acm_codec_id,
auto it = decoders_.find(payload_type);
if (it != decoders_.end()) {
const Decoder& decoder = it->second;
- if (decoder.acm_codec_id == acm_codec_id && decoder.channels == channels &&
+ if (acm_codec_id != -1 && decoder.acm_codec_id == acm_codec_id &&
+ decoder.channels == channels &&
decoder.sample_rate_hz == sample_rate_hz) {
// Re-registering the same codec. Do nothing and return.
return 0;
}
- // Changing codec or number of channels. First unregister the old codec,
- // then register the new one.
+ // Changing codec. First unregister the old codec, then register the new
+ // one.
if (neteq_->RemovePayloadType(payload_type) != NetEq::kOK) {
LOG(LERROR) << "Cannot remove payload " << static_cast<int>(payload_type);
return -1;
« no previous file with comments | « webrtc/modules/audio_coding/main/acm2/acm_receiver.h ('k') | webrtc/modules/audio_coding/main/acm2/audio_coding_module_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698