| 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/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 // There is no need to hold a lock here since the caller guarantees that | 412 // There is no need to hold a lock here since the caller guarantees that |
| 413 // there is no more OnPlayoutData() callback on the render thread. | 413 // there is no more OnPlayoutData() callback on the render thread. |
| 414 render_thread_checker_.DetachFromThread(); | 414 render_thread_checker_.DetachFromThread(); |
| 415 render_fifo_.reset(); | 415 render_fifo_.reset(); |
| 416 } | 416 } |
| 417 | 417 |
| 418 void MediaStreamAudioProcessor::GetStats(AudioProcessorStats* stats) { | 418 void MediaStreamAudioProcessor::GetStats(AudioProcessorStats* stats) { |
| 419 stats->typing_noise_detected = | 419 stats->typing_noise_detected = |
| 420 (base::subtle::Acquire_Load(&typing_detected_) != false); | 420 (base::subtle::Acquire_Load(&typing_detected_) != false); |
| 421 GetAecStats(audio_processing_.get(), stats); | 421 GetAecStats(audio_processing_.get(), stats); |
| 422 if (echo_information_) | |
| 423 echo_information_.get()->UpdateAecDelayStats(stats->echo_delay_median_ms); | |
| 424 } | 422 } |
| 425 | 423 |
| 426 void MediaStreamAudioProcessor::InitializeAudioProcessingModule( | 424 void MediaStreamAudioProcessor::InitializeAudioProcessingModule( |
| 427 const blink::WebMediaConstraints& constraints, int effects) { | 425 const blink::WebMediaConstraints& constraints, int effects) { |
| 428 DCHECK(main_thread_checker_.CalledOnValidThread()); | 426 DCHECK(main_thread_checker_.CalledOnValidThread()); |
| 429 DCHECK(!audio_processing_); | 427 DCHECK(!audio_processing_); |
| 430 | 428 |
| 431 MediaAudioConstraints audio_constraints(constraints, effects); | 429 MediaAudioConstraints audio_constraints(constraints, effects); |
| 432 | 430 |
| 433 // Audio mirroring can be enabled even though audio processing is otherwise | 431 // Audio mirroring can be enabled even though audio processing is otherwise |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 DCHECK_EQ(err, 0) << "ProcessStream() error: " << err; | 670 DCHECK_EQ(err, 0) << "ProcessStream() error: " << err; |
| 673 | 671 |
| 674 if (typing_detector_) { | 672 if (typing_detector_) { |
| 675 webrtc::VoiceDetection* vad = ap->voice_detection(); | 673 webrtc::VoiceDetection* vad = ap->voice_detection(); |
| 676 DCHECK(vad->is_enabled()); | 674 DCHECK(vad->is_enabled()); |
| 677 bool detected = typing_detector_->Process(key_pressed, | 675 bool detected = typing_detector_->Process(key_pressed, |
| 678 vad->stream_has_voice()); | 676 vad->stream_has_voice()); |
| 679 base::subtle::Release_Store(&typing_detected_, detected); | 677 base::subtle::Release_Store(&typing_detected_, detected); |
| 680 } | 678 } |
| 681 | 679 |
| 680 if (echo_information_) { |
| 681 echo_information_.get()->UpdateAecDelayStats(ap->echo_cancellation()); |
| 682 } |
| 683 |
| 682 // Return 0 if the volume hasn't been changed, and otherwise the new volume. | 684 // Return 0 if the volume hasn't been changed, and otherwise the new volume. |
| 683 return (agc->stream_analog_level() == volume) ? | 685 return (agc->stream_analog_level() == volume) ? |
| 684 0 : agc->stream_analog_level(); | 686 0 : agc->stream_analog_level(); |
| 685 } | 687 } |
| 686 | 688 |
| 687 } // namespace content | 689 } // namespace content |
| OLD | NEW |