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

Side by Side Diff: webrtc/modules/audio_coding/main/acm2/audio_coding_module_impl.cc

Issue 1430043003: Move ACMCodecDB::ValidPayloadType to RentACodec (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 1 month 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 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 auto codec_id = 556 auto codec_id =
557 RentACodec::CodecIdByParams(codec.plname, codec.plfreq, codec.channels); 557 RentACodec::CodecIdByParams(codec.plname, codec.plfreq, codec.channels);
558 if (!codec_id) { 558 if (!codec_id) {
559 LOG_F(LS_ERROR) << "Wrong codec params to be registered as receive codec"; 559 LOG_F(LS_ERROR) << "Wrong codec params to be registered as receive codec";
560 return -1; 560 return -1;
561 } 561 }
562 auto codec_index = RentACodec::CodecIndexFromId(*codec_id); 562 auto codec_index = RentACodec::CodecIndexFromId(*codec_id);
563 RTC_CHECK(codec_index) << "Invalid codec ID: " << static_cast<int>(*codec_id); 563 RTC_CHECK(codec_index) << "Invalid codec ID: " << static_cast<int>(*codec_id);
564 564
565 // Check if the payload-type is valid. 565 // Check if the payload-type is valid.
566 if (!ACMCodecDB::ValidPayloadType(codec.pltype)) { 566 if (!RentACodec::IsPayloadTypeValid(codec.pltype)) {
567 LOG_F(LS_ERROR) << "Invalid payload type " << codec.pltype << " for " 567 LOG_F(LS_ERROR) << "Invalid payload type " << codec.pltype << " for "
568 << codec.plname; 568 << codec.plname;
569 return -1; 569 return -1;
570 } 570 }
571 571
572 // Get |decoder| associated with |codec|. |decoder| is NULL if |codec| does 572 // Get |decoder| associated with |codec|. |decoder| is NULL if |codec| does
573 // not own its decoder. 573 // not own its decoder.
574 return receiver_.AddCodec(*codec_index, codec.pltype, codec.channels, 574 return receiver_.AddCodec(*codec_index, codec.pltype, codec.channels,
575 codec.plfreq, 575 codec.plfreq,
576 codec_manager_.GetAudioDecoder(codec)); 576 codec_manager_.GetAudioDecoder(codec));
577 } 577 }
578 578
579 int AudioCodingModuleImpl::RegisterExternalReceiveCodec( 579 int AudioCodingModuleImpl::RegisterExternalReceiveCodec(
580 int rtp_payload_type, 580 int rtp_payload_type,
581 AudioDecoder* external_decoder, 581 AudioDecoder* external_decoder,
582 int sample_rate_hz, 582 int sample_rate_hz,
583 int num_channels) { 583 int num_channels) {
584 CriticalSectionScoped lock(acm_crit_sect_.get()); 584 CriticalSectionScoped lock(acm_crit_sect_.get());
585 RTC_DCHECK(receiver_initialized_); 585 RTC_DCHECK(receiver_initialized_);
586 if (num_channels > 2 || num_channels < 0) { 586 if (num_channels > 2 || num_channels < 0) {
587 LOG_F(LS_ERROR) << "Unsupported number of channels: " << num_channels; 587 LOG_F(LS_ERROR) << "Unsupported number of channels: " << num_channels;
588 return -1; 588 return -1;
589 } 589 }
590 590
591 // Check if the payload-type is valid. 591 // Check if the payload-type is valid.
592 if (!ACMCodecDB::ValidPayloadType(rtp_payload_type)) { 592 if (!RentACodec::IsPayloadTypeValid(rtp_payload_type)) {
593 LOG_F(LS_ERROR) << "Invalid payload-type " << rtp_payload_type 593 LOG_F(LS_ERROR) << "Invalid payload-type " << rtp_payload_type
594 << " for external decoder."; 594 << " for external decoder.";
595 return -1; 595 return -1;
596 } 596 }
597 597
598 return receiver_.AddCodec(-1 /* external */, rtp_payload_type, num_channels, 598 return receiver_.AddCodec(-1 /* external */, rtp_payload_type, num_channels,
599 sample_rate_hz, external_decoder); 599 sample_rate_hz, external_decoder);
600 } 600 }
601 601
602 // Get current received codec. 602 // Get current received codec.
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 return receiver_.LeastRequiredDelayMs(); 781 return receiver_.LeastRequiredDelayMs();
782 } 782 }
783 783
784 void AudioCodingModuleImpl::GetDecodingCallStatistics( 784 void AudioCodingModuleImpl::GetDecodingCallStatistics(
785 AudioDecodingCallStats* call_stats) const { 785 AudioDecodingCallStats* call_stats) const {
786 receiver_.GetDecodingCallStatistics(call_stats); 786 receiver_.GetDecodingCallStatistics(call_stats);
787 } 787 }
788 788
789 } // namespace acm2 789 } // namespace acm2
790 } // namespace webrtc 790 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/main/acm2/acm_codec_database.cc ('k') | webrtc/modules/audio_coding/main/acm2/codec_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698