| 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 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_PROCESSOR_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_PROCESSOR_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_PROCESSOR_H_ | 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_PROCESSOR_H_ |
| 7 | 7 |
| 8 #include "base/atomicops.h" | 8 #include "base/atomicops.h" |
| 9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/optional.h" |
| 13 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
| 14 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
| 15 #include "base/threading/thread_checker.h" | 16 #include "base/threading/thread_checker.h" |
| 16 #include "base/time/time.h" | 17 #include "base/time/time.h" |
| 17 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
| 18 #include "content/public/common/media_stream_request.h" | 19 #include "content/public/common/media_stream_request.h" |
| 19 #include "content/renderer/media/aec_dump_message_filter.h" | 20 #include "content/renderer/media/aec_dump_message_filter.h" |
| 20 #include "content/renderer/media/audio_repetition_detector.h" | 21 #include "content/renderer/media/audio_repetition_detector.h" |
| 21 #include "content/renderer/media/webrtc_audio_device_impl.h" | 22 #include "content/renderer/media/webrtc_audio_device_impl.h" |
| 22 #include "media/base/audio_converter.h" | 23 #include "media/base/audio_converter.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 const media::AudioParameters& InputFormat() const; | 115 const media::AudioParameters& InputFormat() const; |
| 115 const media::AudioParameters& OutputFormat() const; | 116 const media::AudioParameters& OutputFormat() const; |
| 116 | 117 |
| 117 // Accessor to check if the audio processing is enabled or not. | 118 // Accessor to check if the audio processing is enabled or not. |
| 118 bool has_audio_processing() const { return audio_processing_ != NULL; } | 119 bool has_audio_processing() const { return audio_processing_ != NULL; } |
| 119 | 120 |
| 120 // AecDumpMessageFilter::AecDumpDelegate implementation. | 121 // AecDumpMessageFilter::AecDumpDelegate implementation. |
| 121 // Called on the main render thread. | 122 // Called on the main render thread. |
| 122 void OnAecDumpFile(const IPC::PlatformFileForTransit& file_handle) override; | 123 void OnAecDumpFile(const IPC::PlatformFileForTransit& file_handle) override; |
| 123 void OnDisableAecDump() override; | 124 void OnDisableAecDump() override; |
| 125 void OnAec3Enable(bool enable) override; |
| 124 void OnIpcClosing() override; | 126 void OnIpcClosing() override; |
| 125 | 127 |
| 126 // Returns true if MediaStreamAudioProcessor would modify the audio signal, | 128 // Returns true if MediaStreamAudioProcessor would modify the audio signal, |
| 127 // based on the |constraints| and |effects_flags| parsed from a user media | 129 // based on the |constraints| and |effects_flags| parsed from a user media |
| 128 // request. If the audio signal would not be modified, there is no need to | 130 // request. If the audio signal would not be modified, there is no need to |
| 129 // instantiate a MediaStreamAudioProcessor and feed audio through it. Doing so | 131 // instantiate a MediaStreamAudioProcessor and feed audio through it. Doing so |
| 130 // would waste a non-trivial amount of memory and CPU resources. | 132 // would waste a non-trivial amount of memory and CPU resources. |
| 131 // | 133 // |
| 132 // See media::AudioParameters::PlatformEffectsMask for interpretation of | 134 // See media::AudioParameters::PlatformEffectsMask for interpretation of |
| 133 // |effects_flags|. | 135 // |effects_flags|. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 // both the capture audio thread and the render audio thread. | 186 // both the capture audio thread and the render audio thread. |
| 185 base::subtle::Atomic32 render_delay_ms_; | 187 base::subtle::Atomic32 render_delay_ms_; |
| 186 | 188 |
| 187 #if ENABLE_AUDIO_REPETITION_DETECTOR | 189 #if ENABLE_AUDIO_REPETITION_DETECTOR |
| 188 // Module to detect and report (to UMA) bit exact audio repetition. | 190 // Module to detect and report (to UMA) bit exact audio repetition. |
| 189 std::unique_ptr<AudioRepetitionDetector> audio_repetition_detector_; | 191 std::unique_ptr<AudioRepetitionDetector> audio_repetition_detector_; |
| 190 #endif // ENABLE_AUDIO_REPETITION_DETECTOR | 192 #endif // ENABLE_AUDIO_REPETITION_DETECTOR |
| 191 | 193 |
| 192 // Module to handle processing and format conversion. | 194 // Module to handle processing and format conversion. |
| 193 std::unique_ptr<webrtc::AudioProcessing> audio_processing_; | 195 std::unique_ptr<webrtc::AudioProcessing> audio_processing_; |
| 196 bool has_echo_cancellation_; |
| 197 // When this variable is not set, the use of AEC3 is governed by the Finch |
| 198 // experiment and/or WebRTC's own default. When set to true/false, Finch and |
| 199 // WebRTC defaults will be overridden, and AEC3/AEC2 (respectively) will be |
| 200 // used. |
| 201 base::Optional<bool> override_aec3_; |
| 194 | 202 |
| 195 // FIFO to provide 10 ms capture chunks. | 203 // FIFO to provide 10 ms capture chunks. |
| 196 std::unique_ptr<MediaStreamAudioFifo> capture_fifo_; | 204 std::unique_ptr<MediaStreamAudioFifo> capture_fifo_; |
| 197 // Receives processing output. | 205 // Receives processing output. |
| 198 std::unique_ptr<MediaStreamAudioBus> output_bus_; | 206 std::unique_ptr<MediaStreamAudioBus> output_bus_; |
| 199 | 207 |
| 200 // FIFO to provide 10 ms render chunks when the AEC is enabled. | 208 // FIFO to provide 10 ms render chunks when the AEC is enabled. |
| 201 std::unique_ptr<MediaStreamAudioFifo> render_fifo_; | 209 std::unique_ptr<MediaStreamAudioFifo> render_fifo_; |
| 202 | 210 |
| 203 // These are mutated on the main render thread in OnCaptureFormatChanged(). | 211 // These are mutated on the main render thread in OnCaptureFormatChanged(). |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 // Object for logging UMA stats for echo information when the AEC is enabled. | 246 // Object for logging UMA stats for echo information when the AEC is enabled. |
| 239 // Accessed on the main render thread. | 247 // Accessed on the main render thread. |
| 240 std::unique_ptr<EchoInformation> echo_information_; | 248 std::unique_ptr<EchoInformation> echo_information_; |
| 241 | 249 |
| 242 DISALLOW_COPY_AND_ASSIGN(MediaStreamAudioProcessor); | 250 DISALLOW_COPY_AND_ASSIGN(MediaStreamAudioProcessor); |
| 243 }; | 251 }; |
| 244 | 252 |
| 245 } // namespace content | 253 } // namespace content |
| 246 | 254 |
| 247 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_PROCESSOR_H_ | 255 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_PROCESSOR_H_ |
| OLD | NEW |