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 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
10 #include "content/public/common/content_switches.h" | 10 #include "content/public/common/content_switches.h" |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 base::subtle::Release_Store(&render_delay_ms_, audio_delay_milliseconds); | 240 base::subtle::Release_Store(&render_delay_ms_, audio_delay_milliseconds); |
241 | 241 |
242 InitializeRenderConverterIfNeeded(sample_rate, audio_bus->channels(), | 242 InitializeRenderConverterIfNeeded(sample_rate, audio_bus->channels(), |
243 audio_bus->frames()); | 243 audio_bus->frames()); |
244 | 244 |
245 render_converter_->Push(audio_bus); | 245 render_converter_->Push(audio_bus); |
246 while (render_converter_->Convert(&render_frame_)) | 246 while (render_converter_->Convert(&render_frame_)) |
247 audio_processing_->AnalyzeReverseStream(&render_frame_); | 247 audio_processing_->AnalyzeReverseStream(&render_frame_); |
248 } | 248 } |
249 | 249 |
250 void MediaStreamAudioProcessor::OnPlayoutDataSourceChanged() { | |
251 DCHECK(main_thread_checker_.CalledOnValidThread()); | |
252 // There is no need to hold a lock here since the caller guarantees that | |
253 // there is no more OnPlayoutData() callback on the render thread. | |
254 render_thread_checker_.DetachFromThread(); | |
255 render_converter_.reset(); | |
256 } | |
257 | |
258 void MediaStreamAudioProcessor::GetStats(AudioProcessorStats* stats) { | 250 void MediaStreamAudioProcessor::GetStats(AudioProcessorStats* stats) { |
259 stats->typing_noise_detected = | 251 stats->typing_noise_detected = |
260 (base::subtle::Acquire_Load(&typing_detected_) != false); | 252 (base::subtle::Acquire_Load(&typing_detected_) != false); |
261 GetAecStats(audio_processing_.get(), stats); | 253 GetAecStats(audio_processing_.get(), stats); |
262 } | 254 } |
263 | 255 |
264 void MediaStreamAudioProcessor::InitializeAudioProcessingModule( | 256 void MediaStreamAudioProcessor::InitializeAudioProcessingModule( |
265 const blink::WebMediaConstraints& constraints, int effects, | 257 const blink::WebMediaConstraints& constraints, int effects, |
266 MediaStreamType type) { | 258 MediaStreamType type) { |
267 DCHECK(!audio_processing_); | 259 DCHECK(!audio_processing_); |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 } | 480 } |
489 | 481 |
490 bool MediaStreamAudioProcessor::IsAudioTrackProcessingEnabled() const { | 482 bool MediaStreamAudioProcessor::IsAudioTrackProcessingEnabled() const { |
491 const std::string group_name = | 483 const std::string group_name = |
492 base::FieldTrialList::FindFullName("MediaStreamAudioTrackProcessing"); | 484 base::FieldTrialList::FindFullName("MediaStreamAudioTrackProcessing"); |
493 return group_name == "Enabled" || CommandLine::ForCurrentProcess()->HasSwitch( | 485 return group_name == "Enabled" || CommandLine::ForCurrentProcess()->HasSwitch( |
494 switches::kEnableAudioTrackProcessing); | 486 switches::kEnableAudioTrackProcessing); |
495 } | 487 } |
496 | 488 |
497 } // namespace content | 489 } // namespace content |
OLD | NEW |