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

Side by Side Diff: webrtc/modules/audio_coding/acm2/audio_coding_module.cc

Issue 2411613002: Renaming AudioEncoder::SetTargetBitrate and SetProjectedPacketLossRate. (Closed)
Patch Set: 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 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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 } 395 }
396 void Reset() override { return enc_->Reset(); } 396 void Reset() override { return enc_->Reset(); }
397 bool SetFec(bool enable) override { return enc_->SetFec(enable); } 397 bool SetFec(bool enable) override { return enc_->SetFec(enable); }
398 bool SetDtx(bool enable) override { return enc_->SetDtx(enable); } 398 bool SetDtx(bool enable) override { return enc_->SetDtx(enable); }
399 bool SetApplication(Application application) override { 399 bool SetApplication(Application application) override {
400 return enc_->SetApplication(application); 400 return enc_->SetApplication(application);
401 } 401 }
402 void SetMaxPlaybackRate(int frequency_hz) override { 402 void SetMaxPlaybackRate(int frequency_hz) override {
403 return enc_->SetMaxPlaybackRate(frequency_hz); 403 return enc_->SetMaxPlaybackRate(frequency_hz);
404 } 404 }
405 void SetProjectedPacketLossRate(double fraction) override {
406 return enc_->SetProjectedPacketLossRate(fraction);
407 }
408 void SetTargetBitrate(int target_bps) override {
409 return enc_->SetTargetBitrate(target_bps);
410 }
411 405
412 private: 406 private:
413 AudioEncoder* enc_; 407 AudioEncoder* enc_;
414 }; 408 };
415 409
416 // Return false on error. 410 // Return false on error.
417 bool CreateSpeechEncoderIfNecessary(EncoderFactory* ef) { 411 bool CreateSpeechEncoderIfNecessary(EncoderFactory* ef) {
418 auto* sp = ef->codec_manager.GetStackParams(); 412 auto* sp = ef->codec_manager.GetStackParams();
419 if (sp->speech_encoder) { 413 if (sp->speech_encoder) {
420 // Do nothing; we already have a speech encoder. 414 // Do nothing; we already have a speech encoder.
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 "SendFrequency Failed, no codec is registered"); 636 "SendFrequency Failed, no codec is registered");
643 return -1; 637 return -1;
644 } 638 }
645 639
646 return encoder_stack_->SampleRateHz(); 640 return encoder_stack_->SampleRateHz();
647 } 641 }
648 642
649 void AudioCodingModuleImpl::SetBitRate(int bitrate_bps) { 643 void AudioCodingModuleImpl::SetBitRate(int bitrate_bps) {
650 rtc::CritScope lock(&acm_crit_sect_); 644 rtc::CritScope lock(&acm_crit_sect_);
651 if (encoder_stack_) { 645 if (encoder_stack_) {
652 encoder_stack_->SetTargetBitrate(bitrate_bps); 646 encoder_stack_->OnReceivedTargetAudioBitrate(bitrate_bps);
653 } 647 }
654 } 648 }
655 649
656 // Register a transport callback which will be called to deliver 650 // Register a transport callback which will be called to deliver
657 // the encoded buffers. 651 // the encoded buffers.
658 int AudioCodingModuleImpl::RegisterTransportCallback( 652 int AudioCodingModuleImpl::RegisterTransportCallback(
659 AudioPacketizationCallback* transport) { 653 AudioPacketizationCallback* transport) {
660 rtc::CritScope lock(&callback_crit_sect_); 654 rtc::CritScope lock(&callback_crit_sect_);
661 packetization_callback_ = transport; 655 packetization_callback_ = transport;
662 return 0; 656 return 0;
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 return sp->use_codec_fec ? 0 : -1; 888 return sp->use_codec_fec ? 0 : -1;
895 } else { 889 } else {
896 RTC_DCHECK(!sp->use_codec_fec); 890 RTC_DCHECK(!sp->use_codec_fec);
897 return 0; 891 return 0;
898 } 892 }
899 } 893 }
900 894
901 int AudioCodingModuleImpl::SetPacketLossRate(int loss_rate) { 895 int AudioCodingModuleImpl::SetPacketLossRate(int loss_rate) {
902 rtc::CritScope lock(&acm_crit_sect_); 896 rtc::CritScope lock(&acm_crit_sect_);
903 if (HaveValidEncoder("SetPacketLossRate")) { 897 if (HaveValidEncoder("SetPacketLossRate")) {
904 encoder_stack_->SetProjectedPacketLossRate(loss_rate / 100.0); 898 encoder_stack_->OnReceivedUplinkPacketLossFraction(loss_rate / 100.0);
905 } 899 }
906 return 0; 900 return 0;
907 } 901 }
908 902
909 ///////////////////////////////////////// 903 /////////////////////////////////////////
910 // (VAD) Voice Activity Detection 904 // (VAD) Voice Activity Detection
911 // 905 //
912 int AudioCodingModuleImpl::SetVAD(bool enable_dtx, 906 int AudioCodingModuleImpl::SetVAD(bool enable_dtx,
913 bool enable_vad, 907 bool enable_vad,
914 ACMVADMode mode) { 908 ACMVADMode mode) {
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
1356 // Checks the validity of the parameters of the given codec 1350 // Checks the validity of the parameters of the given codec
1357 bool AudioCodingModule::IsCodecValid(const CodecInst& codec) { 1351 bool AudioCodingModule::IsCodecValid(const CodecInst& codec) {
1358 bool valid = acm2::RentACodec::IsCodecValid(codec); 1352 bool valid = acm2::RentACodec::IsCodecValid(codec);
1359 if (!valid) 1353 if (!valid)
1360 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, -1, 1354 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, -1,
1361 "Invalid codec setting"); 1355 "Invalid codec setting");
1362 return valid; 1356 return valid;
1363 } 1357 }
1364 1358
1365 } // namespace webrtc 1359 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698