Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 432 } | 432 } |
| 433 | 433 |
| 434 return 0; | 434 return 0; |
| 435 } | 435 } |
| 436 | 436 |
| 437 int32_t AcmReceiver::AddCodec(int acm_codec_id, | 437 int32_t AcmReceiver::AddCodec(int acm_codec_id, |
| 438 uint8_t payload_type, | 438 uint8_t payload_type, |
| 439 int channels, | 439 int channels, |
| 440 int sample_rate_hz, | 440 int sample_rate_hz, |
| 441 AudioDecoder* audio_decoder) { | 441 AudioDecoder* audio_decoder) { |
| 442 assert(acm_codec_id >= -1); // -1 means external decoder | 442 const auto neteq_decoder = [acm_codec_id, channels]() -> NetEqDecoder { |
| 443 NetEqDecoder neteq_decoder = (acm_codec_id == -1) | 443 if (acm_codec_id == -1) |
| 444 ? kDecoderArbitrary | 444 return NetEqDecoder::kDecoderArbitrary; // External decoder. |
| 445 : ACMCodecDB::neteq_decoders_[acm_codec_id]; | 445 const rtc::Maybe<RentACodec::CodecId> cid = |
| 446 | 446 RentACodec::CodecIdFromIndex(acm_codec_id); |
| 447 // Make sure the right decoder is registered for Opus. | 447 RTC_DCHECK(cid); // acm_codec_id was a valid codec index. |
|
hlundin-webrtc
2015/10/28 15:14:47
I prefer you stream the debug information to RTC_D
kwiberg-webrtc
2015/10/29 09:29:15
Done.
| |
| 448 if (neteq_decoder == kDecoderOpus && channels == 2) { | 448 const rtc::Maybe<NetEqDecoder> ned = |
| 449 neteq_decoder = kDecoderOpus_2ch; | 449 RentACodec::NetEqDecoderFromCodecId(*cid, channels); |
| 450 } | 450 RTC_DCHECK(ned); // CodecIdFromIndex gives a valid CodecId. |
| 451 return *ned; | |
| 452 }(); | |
| 451 | 453 |
| 452 CriticalSectionScoped lock(crit_sect_.get()); | 454 CriticalSectionScoped lock(crit_sect_.get()); |
| 453 | 455 |
| 454 // The corresponding NetEq decoder ID. | 456 // The corresponding NetEq decoder ID. |
| 455 // If this codec has been registered before. | 457 // If this codec has been registered before. |
| 456 auto it = decoders_.find(payload_type); | 458 auto it = decoders_.find(payload_type); |
| 457 if (it != decoders_.end()) { | 459 if (it != decoders_.end()) { |
| 458 const Decoder& decoder = it->second; | 460 const Decoder& decoder = it->second; |
| 459 if (acm_codec_id != -1 && decoder.acm_codec_id == acm_codec_id && | 461 if (acm_codec_id != -1 && decoder.acm_codec_id == acm_codec_id && |
| 460 decoder.channels == channels && | 462 decoder.channels == channels && |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 786 | 788 |
| 787 void AcmReceiver::GetDecodingCallStatistics( | 789 void AcmReceiver::GetDecodingCallStatistics( |
| 788 AudioDecodingCallStats* stats) const { | 790 AudioDecodingCallStats* stats) const { |
| 789 CriticalSectionScoped lock(crit_sect_.get()); | 791 CriticalSectionScoped lock(crit_sect_.get()); |
| 790 *stats = call_stats_.GetDecodingStatistics(); | 792 *stats = call_stats_.GetDecodingStatistics(); |
| 791 } | 793 } |
| 792 | 794 |
| 793 } // namespace acm2 | 795 } // namespace acm2 |
| 794 | 796 |
| 795 } // namespace webrtc | 797 } // namespace webrtc |
| OLD | NEW |