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

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

Issue 190643003: Fix/Add content_unittests to work for the code behind --enable-audio-track-processing (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: ready for review Created 6 years, 9 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 // 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 "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "content/public/common/content_switches.h" 9 #include "content/public/common/content_switches.h"
10 #include "content/renderer/media/media_stream_audio_processor_options.h" 10 #include "content/renderer/media/media_stream_audio_processor_options.h"
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 void MediaStreamAudioProcessor::GetStats(AudioProcessorStats* stats) { 257 void MediaStreamAudioProcessor::GetStats(AudioProcessorStats* stats) {
258 stats->typing_noise_detected = 258 stats->typing_noise_detected =
259 (base::subtle::Acquire_Load(&typing_detected_) != false); 259 (base::subtle::Acquire_Load(&typing_detected_) != false);
260 GetAecStats(audio_processing_.get(), stats); 260 GetAecStats(audio_processing_.get(), stats);
261 } 261 }
262 262
263 void MediaStreamAudioProcessor::InitializeAudioProcessingModule( 263 void MediaStreamAudioProcessor::InitializeAudioProcessingModule(
264 const blink::WebMediaConstraints& constraints, int effects, 264 const blink::WebMediaConstraints& constraints, int effects,
265 MediaStreamType type) { 265 MediaStreamType type) {
266 DCHECK(!audio_processing_); 266 DCHECK(!audio_processing_);
267 if (!CommandLine::ForCurrentProcess()->HasSwitch( 267 if (!IsAudioTrackProcessingEnabled())
268 switches::kEnableAudioTrackProcessing)) {
269 return; 268 return;
270 }
271 269
272 RTCMediaConstraints native_constraints(constraints); 270 RTCMediaConstraints native_constraints(constraints);
273 271
274 // Only apply the fixed constraints for gUM of MEDIA_DEVICE_AUDIO_CAPTURE. 272 // Only apply the fixed constraints for gUM of MEDIA_DEVICE_AUDIO_CAPTURE.
275 DCHECK(IsAudioMediaType(type)); 273 DCHECK(IsAudioMediaType(type));
276 if (type == MEDIA_DEVICE_AUDIO_CAPTURE) 274 if (type == MEDIA_DEVICE_AUDIO_CAPTURE)
277 ApplyFixedAudioConstraints(&native_constraints); 275 ApplyFixedAudioConstraints(&native_constraints);
278 276
279 if (effects & media::AudioParameters::ECHO_CANCELLER) { 277 if (effects & media::AudioParameters::ECHO_CANCELLER) {
280 // If platform echo canceller is enabled, disable the software AEC. 278 // If platform echo canceller is enabled, disable the software AEC.
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 return; 479 return;
482 480
483 StopAecDump(); 481 StopAecDump();
484 482
485 if (playout_data_source_) 483 if (playout_data_source_)
486 playout_data_source_->RemovePlayoutSink(this); 484 playout_data_source_->RemovePlayoutSink(this);
487 485
488 audio_processing_.reset(); 486 audio_processing_.reset();
489 } 487 }
490 488
489 bool MediaStreamAudioProcessor::IsAudioTrackProcessingEnabled() const {
490 return CommandLine::ForCurrentProcess()->HasSwitch(
491 switches::kEnableAudioTrackProcessing);
492 }
493
491 } // namespace content 494 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698