| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/metrics/field_trial.h" | 12 #include "base/metrics/field_trial.h" |
| 13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
| 14 #include "base/single_thread_task_runner.h" |
| 14 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/trace_event/trace_event.h" | 16 #include "base/trace_event/trace_event.h" |
| 16 #include "build/build_config.h" | 17 #include "build/build_config.h" |
| 17 #include "content/public/common/content_switches.h" | 18 #include "content/public/common/content_switches.h" |
| 18 #include "content/renderer/media/media_stream_audio_processor_options.h" | 19 #include "content/renderer/media/media_stream_audio_processor_options.h" |
| 19 #include "content/renderer/media/webrtc_audio_device_impl.h" | 20 #include "content/renderer/media/webrtc_audio_device_impl.h" |
| 20 #include "media/base/audio_converter.h" | 21 #include "media/base/audio_converter.h" |
| 21 #include "media/base/audio_fifo.h" | 22 #include "media/base/audio_fifo.h" |
| 22 #include "media/base/audio_parameters.h" | 23 #include "media/base/audio_parameters.h" |
| 23 #include "media/base/channel_layout.h" | 24 #include "media/base/channel_layout.h" |
| (...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 754 DCHECK_EQ(err, 0) << "ProcessStream() error: " << err; | 755 DCHECK_EQ(err, 0) << "ProcessStream() error: " << err; |
| 755 | 756 |
| 756 if (typing_detector_) { | 757 if (typing_detector_) { |
| 757 webrtc::VoiceDetection* vad = ap->voice_detection(); | 758 webrtc::VoiceDetection* vad = ap->voice_detection(); |
| 758 DCHECK(vad->is_enabled()); | 759 DCHECK(vad->is_enabled()); |
| 759 bool detected = typing_detector_->Process(key_pressed, | 760 bool detected = typing_detector_->Process(key_pressed, |
| 760 vad->stream_has_voice()); | 761 vad->stream_has_voice()); |
| 761 base::subtle::Release_Store(&typing_detected_, detected); | 762 base::subtle::Release_Store(&typing_detected_, detected); |
| 762 } | 763 } |
| 763 | 764 |
| 764 main_thread_message_loop_->PostTask( | 765 main_thread_message_loop_->task_runner()->PostTask( |
| 765 FROM_HERE, base::Bind(&MediaStreamAudioProcessor::UpdateAecStats, this)); | 766 FROM_HERE, base::Bind(&MediaStreamAudioProcessor::UpdateAecStats, this)); |
| 766 | 767 |
| 767 // Return 0 if the volume hasn't been changed, and otherwise the new volume. | 768 // Return 0 if the volume hasn't been changed, and otherwise the new volume. |
| 768 return (agc->stream_analog_level() == volume) ? | 769 return (agc->stream_analog_level() == volume) ? |
| 769 0 : agc->stream_analog_level(); | 770 0 : agc->stream_analog_level(); |
| 770 } | 771 } |
| 771 | 772 |
| 772 void MediaStreamAudioProcessor::UpdateAecStats() { | 773 void MediaStreamAudioProcessor::UpdateAecStats() { |
| 773 DCHECK(main_thread_checker_.CalledOnValidThread()); | 774 DCHECK(main_thread_checker_.CalledOnValidThread()); |
| 774 if (echo_information_) | 775 if (echo_information_) |
| 775 echo_information_->UpdateAecStats(audio_processing_->echo_cancellation()); | 776 echo_information_->UpdateAecStats(audio_processing_->echo_cancellation()); |
| 776 } | 777 } |
| 777 | 778 |
| 778 } // namespace content | 779 } // namespace content |
| OLD | NEW |