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

Side by Side Diff: content/renderer/media/media_stream_audio_processor.cc

Issue 1983843002: Add aec-refined-adaptive-filter command line switch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Created 4 years, 7 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 | « content/public/common/content_switches.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/media/media_stream_audio_processor.h" 5 #include "content/renderer/media/media_stream_audio_processor.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 // on the command line. 110 // on the command line.
111 bool GetStartupMinVolumeForAgc(int* startup_min_volume) { 111 bool GetStartupMinVolumeForAgc(int* startup_min_volume) {
112 DCHECK(startup_min_volume); 112 DCHECK(startup_min_volume);
113 std::string min_volume_str( 113 std::string min_volume_str(
114 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 114 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
115 switches::kAgcStartupMinVolume)); 115 switches::kAgcStartupMinVolume));
116 return !min_volume_str.empty() && 116 return !min_volume_str.empty() &&
117 base::StringToInt(min_volume_str, startup_min_volume); 117 base::StringToInt(min_volume_str, startup_min_volume);
118 } 118 }
119 119
120 // Checks if the AEC's refined adaptive filter tuning was enabled on the command
121 // line.
122 bool UseAecRefinedAdaptiveFilter() {
123 return base::CommandLine::ForCurrentProcess()->HasSwitch(
124 switches::kAecRefinedAdaptiveFilter);
125 }
126
120 } // namespace 127 } // namespace
121 128
122 // Wraps AudioBus to provide access to the array of channel pointers, since this 129 // Wraps AudioBus to provide access to the array of channel pointers, since this
123 // is the type webrtc::AudioProcessing deals in. The array is refreshed on every 130 // is the type webrtc::AudioProcessing deals in. The array is refreshed on every
124 // channel_ptrs() call, and will be valid until the underlying AudioBus pointers 131 // channel_ptrs() call, and will be valid until the underlying AudioBus pointers
125 // are changed, e.g. through calls to SetChannelData() or SwapChannels(). 132 // are changed, e.g. through calls to SetChannelData() or SwapChannels().
126 // 133 //
127 // All methods are called on one of the capture or render audio threads 134 // All methods are called on one of the capture or render audio threads
128 // exclusively. 135 // exclusively.
129 class MediaStreamAudioBus { 136 class MediaStreamAudioBus {
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 } 529 }
523 530
524 // Experimental options provided at creation. 531 // Experimental options provided at creation.
525 webrtc::Config config; 532 webrtc::Config config;
526 config.Set<webrtc::ExtendedFilter>( 533 config.Set<webrtc::ExtendedFilter>(
527 new webrtc::ExtendedFilter(goog_experimental_aec)); 534 new webrtc::ExtendedFilter(goog_experimental_aec));
528 config.Set<webrtc::ExperimentalNs>( 535 config.Set<webrtc::ExperimentalNs>(
529 new webrtc::ExperimentalNs(goog_experimental_ns)); 536 new webrtc::ExperimentalNs(goog_experimental_ns));
530 if (IsDelayAgnosticAecEnabled()) 537 if (IsDelayAgnosticAecEnabled())
531 config.Set<webrtc::DelayAgnostic>(new webrtc::DelayAgnostic(true)); 538 config.Set<webrtc::DelayAgnostic>(new webrtc::DelayAgnostic(true));
539 if (UseAecRefinedAdaptiveFilter()) {
540 config.Set<webrtc::RefinedAdaptiveFilter>(
541 new webrtc::RefinedAdaptiveFilter(true));
542 }
532 if (goog_beamforming) { 543 if (goog_beamforming) {
533 const auto& geometry = 544 const auto& geometry =
534 GetArrayGeometryPreferringConstraints(audio_constraints, input_params); 545 GetArrayGeometryPreferringConstraints(audio_constraints, input_params);
535 546
536 // Only enable beamforming if we have at least two mics. 547 // Only enable beamforming if we have at least two mics.
537 config.Set<webrtc::Beamforming>( 548 config.Set<webrtc::Beamforming>(
538 new webrtc::Beamforming(geometry.size() > 1, geometry)); 549 new webrtc::Beamforming(geometry.size() > 1, geometry));
539 } 550 }
540 551
541 // If the experimental AGC is enabled, check for overridden config params. 552 // If the experimental AGC is enabled, check for overridden config params.
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 if (echo_information_) { 752 if (echo_information_) {
742 echo_information_.get()->UpdateAecDelayStats(ap->echo_cancellation()); 753 echo_information_.get()->UpdateAecDelayStats(ap->echo_cancellation());
743 } 754 }
744 755
745 // Return 0 if the volume hasn't been changed, and otherwise the new volume. 756 // Return 0 if the volume hasn't been changed, and otherwise the new volume.
746 return (agc->stream_analog_level() == volume) ? 757 return (agc->stream_analog_level() == volume) ?
747 0 : agc->stream_analog_level(); 758 0 : agc->stream_analog_level();
748 } 759 }
749 760
750 } // namespace content 761 } // namespace content
OLDNEW
« no previous file with comments | « content/public/common/content_switches.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698