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

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

Issue 177113012: Minor fixes to the capturer and the processor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | content/renderer/media/webrtc_audio_capturer.cc » ('j') | 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 "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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 DCHECK(main_thread_checker_.CalledOnValidThread()); 158 DCHECK(main_thread_checker_.CalledOnValidThread());
159 StopAudioProcessing(); 159 StopAudioProcessing();
160 } 160 }
161 161
162 void MediaStreamAudioProcessor::PushCaptureData(media::AudioBus* audio_source) { 162 void MediaStreamAudioProcessor::PushCaptureData(media::AudioBus* audio_source) {
163 DCHECK(capture_thread_checker_.CalledOnValidThread()); 163 DCHECK(capture_thread_checker_.CalledOnValidThread());
164 if (audio_mirroring_ && 164 if (audio_mirroring_ &&
165 capture_converter_->source_parameters().channel_layout() == 165 capture_converter_->source_parameters().channel_layout() ==
166 media::CHANNEL_LAYOUT_STEREO) { 166 media::CHANNEL_LAYOUT_STEREO) {
167 // Swap the first and second channels. 167 // Swap the first and second channels.
168 audio_source->SwapChannels(0, 1); 168 audio_source->SwapChannels(0, 1);
no longer working on chromium 2014/03/06 08:35:14 FYI, audio_mirroring is done without the APM.
169 } 169 }
170 170
171 capture_converter_->Push(audio_source); 171 capture_converter_->Push(audio_source);
172 } 172 }
173 173
174 bool MediaStreamAudioProcessor::ProcessAndConsumeData( 174 bool MediaStreamAudioProcessor::ProcessAndConsumeData(
175 base::TimeDelta capture_delay, int volume, bool key_pressed, 175 base::TimeDelta capture_delay, int volume, bool key_pressed,
176 int* new_volume, int16** out) { 176 int* new_volume, int16** out) {
177 DCHECK(capture_thread_checker_.CalledOnValidThread()); 177 DCHECK(capture_thread_checker_.CalledOnValidThread());
178 TRACE_EVENT0("audio", "MediaStreamAudioProcessor::ProcessAndConsumeData"); 178 TRACE_EVENT0("audio", "MediaStreamAudioProcessor::ProcessAndConsumeData");
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 MediaConstraintsInterface::kExperimentalNoiseSuppression); 264 MediaConstraintsInterface::kExperimentalNoiseSuppression);
265 const bool enable_high_pass_filter = GetPropertyFromConstraints( 265 const bool enable_high_pass_filter = GetPropertyFromConstraints(
266 &native_constraints, MediaConstraintsInterface::kHighpassFilter); 266 &native_constraints, MediaConstraintsInterface::kHighpassFilter);
267 267
268 audio_mirroring_ = GetPropertyFromConstraints( 268 audio_mirroring_ = GetPropertyFromConstraints(
269 &native_constraints, webrtc::MediaConstraintsInterface::kAudioMirroring); 269 &native_constraints, webrtc::MediaConstraintsInterface::kAudioMirroring);
270 270
271 // Return immediately if no audio processing component is enabled. 271 // Return immediately if no audio processing component is enabled.
272 if (!enable_aec && !enable_experimental_aec && !enable_ns && 272 if (!enable_aec && !enable_experimental_aec && !enable_ns &&
273 !enable_high_pass_filter && !enable_typing_detection && !enable_agc && 273 !enable_high_pass_filter && !enable_typing_detection && !enable_agc &&
274 !audio_mirroring_ && !enable_experimental_ns) { 274 !enable_experimental_ns) {
Henrik Grunell 2014/03/06 07:59:10 I can't say if this is correct, since I don't unde
no longer working on chromium 2014/03/06 08:35:14 I can confirm that this is correct, since the mirr
Henrik Grunell 2014/03/06 09:50:09 OK, thanks for clarifying.
275 return; 275 return;
276 } 276 }
277 277
278 // Create and configure the webrtc::AudioProcessing. 278 // Create and configure the webrtc::AudioProcessing.
279 audio_processing_.reset(webrtc::AudioProcessing::Create(0)); 279 audio_processing_.reset(webrtc::AudioProcessing::Create(0));
280 280
281 // Enable the audio processing components. 281 // Enable the audio processing components.
282 if (enable_aec) { 282 if (enable_aec) {
283 EnableEchoCancellation(audio_processing_.get()); 283 EnableEchoCancellation(audio_processing_.get());
284 if (enable_experimental_aec) 284 if (enable_experimental_aec)
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 if (!audio_processing_.get()) 431 if (!audio_processing_.get())
432 return; 432 return;
433 433
434 if (playout_data_source_) 434 if (playout_data_source_)
435 playout_data_source_->RemovePlayoutSink(this); 435 playout_data_source_->RemovePlayoutSink(this);
436 436
437 audio_processing_.reset(); 437 audio_processing_.reset();
438 } 438 }
439 439
440 } // namespace content 440 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/media/webrtc_audio_capturer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698