Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(532)

Side by Side Diff: content/renderer/media/media_stream_audio_processor.h

Issue 2801853005: Create a private API for controlling WebRTC's AEC3 (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 base::Optional<bool> override_aec3_;
Henrik Grunell 2017/04/10 08:13:28 Add comment how the different values (true, false,
hlundin-chromium 2017/04/10 10:10:16 Done.
194 198
195 // FIFO to provide 10 ms capture chunks. 199 // FIFO to provide 10 ms capture chunks.
196 std::unique_ptr<MediaStreamAudioFifo> capture_fifo_; 200 std::unique_ptr<MediaStreamAudioFifo> capture_fifo_;
197 // Receives processing output. 201 // Receives processing output.
198 std::unique_ptr<MediaStreamAudioBus> output_bus_; 202 std::unique_ptr<MediaStreamAudioBus> output_bus_;
199 203
200 // FIFO to provide 10 ms render chunks when the AEC is enabled. 204 // FIFO to provide 10 ms render chunks when the AEC is enabled.
201 std::unique_ptr<MediaStreamAudioFifo> render_fifo_; 205 std::unique_ptr<MediaStreamAudioFifo> render_fifo_;
202 206
203 // These are mutated on the main render thread in OnCaptureFormatChanged(). 207 // These are mutated on the main render thread in OnCaptureFormatChanged().
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 // Object for logging UMA stats for echo information when the AEC is enabled. 242 // Object for logging UMA stats for echo information when the AEC is enabled.
239 // Accessed on the main render thread. 243 // Accessed on the main render thread.
240 std::unique_ptr<EchoInformation> echo_information_; 244 std::unique_ptr<EchoInformation> echo_information_;
241 245
242 DISALLOW_COPY_AND_ASSIGN(MediaStreamAudioProcessor); 246 DISALLOW_COPY_AND_ASSIGN(MediaStreamAudioProcessor);
243 }; 247 };
244 248
245 } // namespace content 249 } // namespace content
246 250
247 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_PROCESSOR_H_ 251 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_PROCESSOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698