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

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

Issue 1894963002: Add aec-refined-adaptive-filter command line switch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 // on the command line. 104 // on the command line.
105 bool GetStartupMinVolumeForAgc(int* startup_min_volume) { 105 bool GetStartupMinVolumeForAgc(int* startup_min_volume) {
106 DCHECK(startup_min_volume); 106 DCHECK(startup_min_volume);
107 std::string min_volume_str( 107 std::string min_volume_str(
108 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 108 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
109 switches::kAgcStartupMinVolume)); 109 switches::kAgcStartupMinVolume));
110 return !min_volume_str.empty() && 110 return !min_volume_str.empty() &&
111 base::StringToInt(min_volume_str, startup_min_volume); 111 base::StringToInt(min_volume_str, startup_min_volume);
112 } 112 }
113 113
114 // Checks if the AEC's refined adaptive filter tuning was enabled on the command
115 // line.
116 bool UseAecRefinedAdaptiveFilter() {
117 return base::CommandLine::ForCurrentProcess()->HasSwitch(
aluebs-chromium 2016/04/18 20:52:49 Just out of curiosity, does this kind of switches
hlundin-chromium 2016/04/19 06:13:35 The plan is to maybe run a Finch experiment, but n
aluebs-chromium 2016/04/19 16:20:51 Yes, that is what I thought. I was just curious :)
118 switches::kAecRefinedAdaptiveFilter);
119 }
120
114 } // namespace 121 } // namespace
115 122
116 // Wraps AudioBus to provide access to the array of channel pointers, since this 123 // Wraps AudioBus to provide access to the array of channel pointers, since this
117 // is the type webrtc::AudioProcessing deals in. The array is refreshed on every 124 // is the type webrtc::AudioProcessing deals in. The array is refreshed on every
118 // channel_ptrs() call, and will be valid until the underlying AudioBus pointers 125 // channel_ptrs() call, and will be valid until the underlying AudioBus pointers
119 // are changed, e.g. through calls to SetChannelData() or SwapChannels(). 126 // are changed, e.g. through calls to SetChannelData() or SwapChannels().
120 // 127 //
121 // All methods are called on one of the capture or render audio threads 128 // All methods are called on one of the capture or render audio threads
122 // exclusively. 129 // exclusively.
123 class MediaStreamAudioBus { 130 class MediaStreamAudioBus {
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 return; 516 return;
510 } 517 }
511 518
512 // Experimental options provided at creation. 519 // Experimental options provided at creation.
513 webrtc::Config config; 520 webrtc::Config config;
514 config.Set<webrtc::ExtendedFilter>( 521 config.Set<webrtc::ExtendedFilter>(
515 new webrtc::ExtendedFilter(goog_experimental_aec)); 522 new webrtc::ExtendedFilter(goog_experimental_aec));
516 config.Set<webrtc::ExperimentalNs>( 523 config.Set<webrtc::ExperimentalNs>(
517 new webrtc::ExperimentalNs(goog_experimental_ns)); 524 new webrtc::ExperimentalNs(goog_experimental_ns));
518 config.Set<webrtc::DelayAgnostic>(new webrtc::DelayAgnostic(true)); 525 config.Set<webrtc::DelayAgnostic>(new webrtc::DelayAgnostic(true));
526 if (UseAecRefinedAdaptiveFilter()) {
527 config.Set<webrtc::RefinedAdaptiveFilter>(
528 new webrtc::RefinedAdaptiveFilter(true));
529 }
aluebs-chromium 2016/04/18 20:52:49 Do you want to rely on the default WebRTC behavior
hlundin-chromium 2016/04/19 06:13:35 Ack. I'm relying on the default behavior for now.
aluebs-chromium 2016/04/19 16:20:51 Ack
519 if (goog_beamforming) { 530 if (goog_beamforming) {
520 const auto& geometry = 531 const auto& geometry =
521 GetArrayGeometryPreferringConstraints(audio_constraints, input_params); 532 GetArrayGeometryPreferringConstraints(audio_constraints, input_params);
522 533
523 // Only enable beamforming if we have at least two mics. 534 // Only enable beamforming if we have at least two mics.
524 config.Set<webrtc::Beamforming>( 535 config.Set<webrtc::Beamforming>(
525 new webrtc::Beamforming(geometry.size() > 1, geometry)); 536 new webrtc::Beamforming(geometry.size() > 1, geometry));
526 } 537 }
527 538
528 // If the experimental AGC is enabled, check for overridden config params. 539 // If the experimental AGC is enabled, check for overridden config params.
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 if (echo_information_) { 739 if (echo_information_) {
729 echo_information_.get()->UpdateAecDelayStats(ap->echo_cancellation()); 740 echo_information_.get()->UpdateAecDelayStats(ap->echo_cancellation());
730 } 741 }
731 742
732 // Return 0 if the volume hasn't been changed, and otherwise the new volume. 743 // Return 0 if the volume hasn't been changed, and otherwise the new volume.
733 return (agc->stream_analog_level() == volume) ? 744 return (agc->stream_analog_level() == volume) ?
734 0 : agc->stream_analog_level(); 745 0 : agc->stream_analog_level();
735 } 746 }
736 747
737 } // namespace content 748 } // 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