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

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

Issue 2538493006: Reland "Renaming AudioEncoder::SetTargetBitrate and SetProjectedPacketLossRate." (Closed)
Patch Set: fixing Created 4 years 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
« no previous file with comments | « no previous file | webrtc/modules/audio_coding/codecs/audio_encoder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 } 400 }
401 void Reset() override { return enc_->Reset(); } 401 void Reset() override { return enc_->Reset(); }
402 bool SetFec(bool enable) override { return enc_->SetFec(enable); } 402 bool SetFec(bool enable) override { return enc_->SetFec(enable); }
403 bool SetDtx(bool enable) override { return enc_->SetDtx(enable); } 403 bool SetDtx(bool enable) override { return enc_->SetDtx(enable); }
404 bool SetApplication(Application application) override { 404 bool SetApplication(Application application) override {
405 return enc_->SetApplication(application); 405 return enc_->SetApplication(application);
406 } 406 }
407 void SetMaxPlaybackRate(int frequency_hz) override { 407 void SetMaxPlaybackRate(int frequency_hz) override {
408 return enc_->SetMaxPlaybackRate(frequency_hz); 408 return enc_->SetMaxPlaybackRate(frequency_hz);
409 } 409 }
410 void SetProjectedPacketLossRate(double fraction) override {
411 return enc_->SetProjectedPacketLossRate(fraction);
412 }
413 void SetTargetBitrate(int target_bps) override {
414 return enc_->SetTargetBitrate(target_bps);
415 }
416 410
417 private: 411 private:
418 AudioEncoder* enc_; 412 AudioEncoder* enc_;
419 }; 413 };
420 414
421 // Return false on error. 415 // Return false on error.
422 bool CreateSpeechEncoderIfNecessary(EncoderFactory* ef) { 416 bool CreateSpeechEncoderIfNecessary(EncoderFactory* ef) {
423 auto* sp = ef->codec_manager.GetStackParams(); 417 auto* sp = ef->codec_manager.GetStackParams();
424 if (sp->speech_encoder) { 418 if (sp->speech_encoder) {
425 // Do nothing; we already have a speech encoder. 419 // Do nothing; we already have a speech encoder.
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 "SendFrequency Failed, no codec is registered"); 641 "SendFrequency Failed, no codec is registered");
648 return -1; 642 return -1;
649 } 643 }
650 644
651 return encoder_stack_->SampleRateHz(); 645 return encoder_stack_->SampleRateHz();
652 } 646 }
653 647
654 void AudioCodingModuleImpl::SetBitRate(int bitrate_bps) { 648 void AudioCodingModuleImpl::SetBitRate(int bitrate_bps) {
655 rtc::CritScope lock(&acm_crit_sect_); 649 rtc::CritScope lock(&acm_crit_sect_);
656 if (encoder_stack_) { 650 if (encoder_stack_) {
657 encoder_stack_->SetTargetBitrate(bitrate_bps); 651 encoder_stack_->OnReceivedTargetAudioBitrate(bitrate_bps);
658 } 652 }
659 } 653 }
660 654
661 // Register a transport callback which will be called to deliver 655 // Register a transport callback which will be called to deliver
662 // the encoded buffers. 656 // the encoded buffers.
663 int AudioCodingModuleImpl::RegisterTransportCallback( 657 int AudioCodingModuleImpl::RegisterTransportCallback(
664 AudioPacketizationCallback* transport) { 658 AudioPacketizationCallback* transport) {
665 rtc::CritScope lock(&callback_crit_sect_); 659 rtc::CritScope lock(&callback_crit_sect_);
666 packetization_callback_ = transport; 660 packetization_callback_ = transport;
667 return 0; 661 return 0;
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 return sp->use_codec_fec ? 0 : -1; 893 return sp->use_codec_fec ? 0 : -1;
900 } else { 894 } else {
901 RTC_DCHECK(!sp->use_codec_fec); 895 RTC_DCHECK(!sp->use_codec_fec);
902 return 0; 896 return 0;
903 } 897 }
904 } 898 }
905 899
906 int AudioCodingModuleImpl::SetPacketLossRate(int loss_rate) { 900 int AudioCodingModuleImpl::SetPacketLossRate(int loss_rate) {
907 rtc::CritScope lock(&acm_crit_sect_); 901 rtc::CritScope lock(&acm_crit_sect_);
908 if (HaveValidEncoder("SetPacketLossRate")) { 902 if (HaveValidEncoder("SetPacketLossRate")) {
909 encoder_stack_->SetProjectedPacketLossRate(loss_rate / 100.0); 903 encoder_stack_->OnReceivedUplinkPacketLossFraction(loss_rate / 100.0);
910 } 904 }
911 return 0; 905 return 0;
912 } 906 }
913 907
914 ///////////////////////////////////////// 908 /////////////////////////////////////////
915 // (VAD) Voice Activity Detection 909 // (VAD) Voice Activity Detection
916 // 910 //
917 int AudioCodingModuleImpl::SetVAD(bool enable_dtx, 911 int AudioCodingModuleImpl::SetVAD(bool enable_dtx,
918 bool enable_vad, 912 bool enable_vad,
919 ACMVADMode mode) { 913 ACMVADMode mode) {
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
1381 // Checks the validity of the parameters of the given codec 1375 // Checks the validity of the parameters of the given codec
1382 bool AudioCodingModule::IsCodecValid(const CodecInst& codec) { 1376 bool AudioCodingModule::IsCodecValid(const CodecInst& codec) {
1383 bool valid = acm2::RentACodec::IsCodecValid(codec); 1377 bool valid = acm2::RentACodec::IsCodecValid(codec);
1384 if (!valid) 1378 if (!valid)
1385 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, -1, 1379 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, -1,
1386 "Invalid codec setting"); 1380 "Invalid codec setting");
1387 return valid; 1381 return valid;
1388 } 1382 }
1389 1383
1390 } // namespace webrtc 1384 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/audio_coding/codecs/audio_encoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698