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

Side by Side Diff: webrtc/modules/audio_coding/main/acm2/audio_coding_module_impl.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, 3 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 return -1; 660 return -1;
661 } 661 }
662 662
663 // Get |decoder| associated with |codec|. |decoder| is NULL if |codec| does 663 // Get |decoder| associated with |codec|. |decoder| is NULL if |codec| does
664 // not own its decoder. 664 // not own its decoder.
665 return receiver_.AddCodec(codec_id, codec.pltype, codec.channels, 665 return receiver_.AddCodec(codec_id, codec.pltype, codec.channels,
666 codec.plfreq, 666 codec.plfreq,
667 codec_manager_.GetAudioDecoder(codec)); 667 codec_manager_.GetAudioDecoder(codec));
668 } 668 }
669 669
670 int AudioCodingModuleImpl::RegisterExternalReceiveCodec(
671 int rtp_payload_type,
672 AudioDecoder* external_decoder,
673 int sample_rate_hz,
674 int num_channels) {
675 CriticalSectionScoped lock(acm_crit_sect_);
676 DCHECK(receiver_initialized_);
677 if (num_channels > 2 || num_channels < 0) {
678 LOG_F(LS_ERROR) << "Unsupported number of channels: " << num_channels;
679 return -1;
680 }
681
682 // Check if the payload-type is valid.
683 if (!ACMCodecDB::ValidPayloadType(rtp_payload_type)) {
684 LOG_F(LS_ERROR) << "Invalid payload-type " << rtp_payload_type
685 << " for external decoder.";
686 return -1;
687 }
688
689 return receiver_.AddCodec(-1 /* external */, rtp_payload_type, num_channels,
690 sample_rate_hz, external_decoder);
691 }
692
670 // Get current received codec. 693 // Get current received codec.
671 int AudioCodingModuleImpl::ReceiveCodec(CodecInst* current_codec) const { 694 int AudioCodingModuleImpl::ReceiveCodec(CodecInst* current_codec) const {
672 CriticalSectionScoped lock(acm_crit_sect_); 695 CriticalSectionScoped lock(acm_crit_sect_);
673 return receiver_.LastAudioCodec(current_codec); 696 return receiver_.LastAudioCodec(current_codec);
674 } 697 }
675 698
676 // Incoming packet from network parsed and ready for decode. 699 // Incoming packet from network parsed and ready for decode.
677 int AudioCodingModuleImpl::IncomingPacket(const uint8_t* incoming_payload, 700 int AudioCodingModuleImpl::IncomingPacket(const uint8_t* incoming_payload,
678 const size_t payload_length, 701 const size_t payload_length,
679 const WebRtcRTPHeader& rtp_header) { 702 const WebRtcRTPHeader& rtp_header) {
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
1273 *channels = 1; 1296 *channels = 1;
1274 break; 1297 break;
1275 #endif 1298 #endif
1276 default: 1299 default:
1277 FATAL() << "Codec type " << codec_type << " not supported."; 1300 FATAL() << "Codec type " << codec_type << " not supported.";
1278 } 1301 }
1279 return true; 1302 return true;
1280 } 1303 }
1281 1304
1282 } // namespace webrtc 1305 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698