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

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

Issue 2177263002: Regression test for issue where Opus DTX status was being forgotten. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Renamed GetOpusDtx to GetOpusDtxStatus to avoid naming conflict with FakeWebRtcVoiceEngine. Created 4 years, 4 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
« 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 30 matching lines...) Expand all
41 41
42 // Can be called multiple times for Codec, CNG, RED. 42 // Can be called multiple times for Codec, CNG, RED.
43 int RegisterSendCodec(const CodecInst& send_codec) override; 43 int RegisterSendCodec(const CodecInst& send_codec) override;
44 44
45 void RegisterExternalSendCodec( 45 void RegisterExternalSendCodec(
46 AudioEncoder* external_speech_encoder) override; 46 AudioEncoder* external_speech_encoder) override;
47 47
48 void ModifyEncoder( 48 void ModifyEncoder(
49 FunctionView<void(std::unique_ptr<AudioEncoder>*)> modifier) override; 49 FunctionView<void(std::unique_ptr<AudioEncoder>*)> modifier) override;
50 50
51 void QueryEncoder(FunctionView<void(const AudioEncoder*)> query) override;
52
51 // Get current send codec. 53 // Get current send codec.
52 rtc::Optional<CodecInst> SendCodec() const override; 54 rtc::Optional<CodecInst> SendCodec() const override;
53 55
54 // Get current send frequency. 56 // Get current send frequency.
55 int SendFrequency() const override; 57 int SendFrequency() const override;
56 58
57 // Sets the bitrate to the specified value in bits/sec. In case the codec does 59 // Sets the bitrate to the specified value in bits/sec. In case the codec does
58 // not support the requested value it will choose an appropriate value 60 // not support the requested value it will choose an appropriate value
59 // instead. 61 // instead.
60 void SetBitRate(int bitrate_bps) override; 62 void SetBitRate(int bitrate_bps) override;
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 // Wipe the encoder factory, so that everything that relies on it will fail. 591 // Wipe the encoder factory, so that everything that relies on it will fail.
590 // We don't want the complexity of supporting swapping back and forth. 592 // We don't want the complexity of supporting swapping back and forth.
591 if (encoder_factory_) { 593 if (encoder_factory_) {
592 encoder_factory_.reset(); 594 encoder_factory_.reset();
593 RTC_CHECK(!encoder_stack_); // Ensure we hadn't started using the factory. 595 RTC_CHECK(!encoder_stack_); // Ensure we hadn't started using the factory.
594 } 596 }
595 597
596 modifier(&encoder_stack_); 598 modifier(&encoder_stack_);
597 } 599 }
598 600
601 void AudioCodingModuleImpl::QueryEncoder(
602 FunctionView<void(const AudioEncoder*)> query) {
603 rtc::CritScope lock(&acm_crit_sect_);
604 query(encoder_stack_.get());
605 }
606
599 // Get current send codec. 607 // Get current send codec.
600 rtc::Optional<CodecInst> AudioCodingModuleImpl::SendCodec() const { 608 rtc::Optional<CodecInst> AudioCodingModuleImpl::SendCodec() const {
601 rtc::CritScope lock(&acm_crit_sect_); 609 rtc::CritScope lock(&acm_crit_sect_);
602 if (encoder_factory_) { 610 if (encoder_factory_) {
603 auto* ci = encoder_factory_->codec_manager.GetCodecInst(); 611 auto* ci = encoder_factory_->codec_manager.GetCodecInst();
604 if (ci) { 612 if (ci) {
605 return rtc::Optional<CodecInst>(*ci); 613 return rtc::Optional<CodecInst>(*ci);
606 } 614 }
607 CreateSpeechEncoderIfNecessary(encoder_factory_.get()); 615 CreateSpeechEncoderIfNecessary(encoder_factory_.get());
608 const std::unique_ptr<AudioEncoder>& enc = 616 const std::unique_ptr<AudioEncoder>& enc =
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
1333 // Checks the validity of the parameters of the given codec 1341 // Checks the validity of the parameters of the given codec
1334 bool AudioCodingModule::IsCodecValid(const CodecInst& codec) { 1342 bool AudioCodingModule::IsCodecValid(const CodecInst& codec) {
1335 bool valid = acm2::RentACodec::IsCodecValid(codec); 1343 bool valid = acm2::RentACodec::IsCodecValid(codec);
1336 if (!valid) 1344 if (!valid)
1337 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, -1, 1345 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, -1,
1338 "Invalid codec setting"); 1346 "Invalid codec setting");
1339 return valid; 1347 return valid;
1340 } 1348 }
1341 1349
1342 } // namespace webrtc 1350 } // 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