OLD | NEW |
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 #if defined(OS_MACOSX) | 9 #if defined(OS_MACOSX) |
10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 typing_detected_(false), | 192 typing_detected_(false), |
193 stopped_(false) { | 193 stopped_(false) { |
194 capture_thread_checker_.DetachFromThread(); | 194 capture_thread_checker_.DetachFromThread(); |
195 render_thread_checker_.DetachFromThread(); | 195 render_thread_checker_.DetachFromThread(); |
196 InitializeAudioProcessingModule(constraints, effects); | 196 InitializeAudioProcessingModule(constraints, effects); |
197 if (IsAudioTrackProcessingEnabled()) { | 197 if (IsAudioTrackProcessingEnabled()) { |
198 aec_dump_message_filter_ = AecDumpMessageFilter::Get(); | 198 aec_dump_message_filter_ = AecDumpMessageFilter::Get(); |
199 // In unit tests not creating a message filter, |aec_dump_message_filter_| | 199 // In unit tests not creating a message filter, |aec_dump_message_filter_| |
200 // will be NULL. We can just ignore that. Other unit tests and browser tests | 200 // will be NULL. We can just ignore that. Other unit tests and browser tests |
201 // ensure that we do get the filter when we should. | 201 // ensure that we do get the filter when we should. |
202 if (aec_dump_message_filter_) | 202 if (aec_dump_message_filter_.get()) |
203 aec_dump_message_filter_->AddDelegate(this); | 203 aec_dump_message_filter_->AddDelegate(this); |
204 } | 204 } |
205 } | 205 } |
206 | 206 |
207 MediaStreamAudioProcessor::~MediaStreamAudioProcessor() { | 207 MediaStreamAudioProcessor::~MediaStreamAudioProcessor() { |
208 DCHECK(main_thread_checker_.CalledOnValidThread()); | 208 DCHECK(main_thread_checker_.CalledOnValidThread()); |
209 Stop(); | 209 Stop(); |
210 } | 210 } |
211 | 211 |
212 void MediaStreamAudioProcessor::OnCaptureFormatChanged( | 212 void MediaStreamAudioProcessor::OnCaptureFormatChanged( |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 return true; | 264 return true; |
265 } | 265 } |
266 | 266 |
267 void MediaStreamAudioProcessor::Stop() { | 267 void MediaStreamAudioProcessor::Stop() { |
268 DCHECK(main_thread_checker_.CalledOnValidThread()); | 268 DCHECK(main_thread_checker_.CalledOnValidThread()); |
269 if (stopped_) | 269 if (stopped_) |
270 return; | 270 return; |
271 | 271 |
272 stopped_ = true; | 272 stopped_ = true; |
273 | 273 |
274 if (aec_dump_message_filter_) { | 274 if (aec_dump_message_filter_.get()) { |
275 aec_dump_message_filter_->RemoveDelegate(this); | 275 aec_dump_message_filter_->RemoveDelegate(this); |
276 aec_dump_message_filter_ = NULL; | 276 aec_dump_message_filter_ = NULL; |
277 } | 277 } |
278 | 278 |
279 if (!audio_processing_.get()) | 279 if (!audio_processing_.get()) |
280 return; | 280 return; |
281 | 281 |
282 StopEchoCancellationDump(audio_processing_.get()); | 282 StopEchoCancellationDump(audio_processing_.get()); |
283 | 283 |
284 if (playout_data_source_) { | 284 if (playout_data_source_) { |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 vad->stream_has_voice()); | 579 vad->stream_has_voice()); |
580 base::subtle::Release_Store(&typing_detected_, detected); | 580 base::subtle::Release_Store(&typing_detected_, detected); |
581 } | 581 } |
582 | 582 |
583 // Return 0 if the volume hasn't been changed, and otherwise the new volume. | 583 // Return 0 if the volume hasn't been changed, and otherwise the new volume. |
584 return (agc->stream_analog_level() == volume) ? | 584 return (agc->stream_analog_level() == volume) ? |
585 0 : agc->stream_analog_level(); | 585 0 : agc->stream_analog_level(); |
586 } | 586 } |
587 | 587 |
588 } // namespace content | 588 } // namespace content |
OLD | NEW |