blob: 21bc588198ba3541d3fc7d3beea6e01468d08f0e [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
andrew@webrtc.org6f9f8172012-03-06 19:03:39 +00002 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:25 +00003 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
pbos@webrtc.org788acd12014-12-15 09:41:24 +000011#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_PROCESSING_IMPL_H_
12#define WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_PROCESSING_IMPL_H_
niklase@google.com470e71d2011-07-07 08:21:25 +000013
14#include <list>
kwiberg88788ad2016-02-19 07:04:49 -080015#include <memory>
ajm@google.com808e0e02011-08-03 21:08:51 +000016#include <string>
Michael Graczyk86c6d332015-07-23 11:41:39 -070017#include <vector>
niklase@google.com470e71d2011-07-07 08:21:25 +000018
peahdf3efa82015-11-28 12:35:15 -080019#include "webrtc/base/criticalsection.h"
peahc19f3122016-10-07 14:54:10 -070020#include "webrtc/base/gtest_prod_util.h"
kwiberg77eab702016-09-28 17:42:01 -070021#include "webrtc/base/ignore_wundef.h"
pbos@webrtc.org788acd12014-12-15 09:41:24 +000022#include "webrtc/base/thread_annotations.h"
peahdf3efa82015-11-28 12:35:15 -080023#include "webrtc/modules/audio_processing/audio_buffer.h"
Michael Graczykdfa36052015-03-25 16:37:27 -070024#include "webrtc/modules/audio_processing/include/audio_processing.h"
peahdf3efa82015-11-28 12:35:15 -080025#include "webrtc/system_wrappers/include/file_wrapper.h"
26
27#ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP
28// Files generated at build-time by the protobuf compiler.
kwiberg77eab702016-09-28 17:42:01 -070029RTC_PUSH_IGNORING_WUNDEF()
peahdf3efa82015-11-28 12:35:15 -080030#ifdef WEBRTC_ANDROID_PLATFORM_BUILD
31#include "external/webrtc/webrtc/modules/audio_processing/debug.pb.h"
32#else
kjellander78ddd732016-02-09 08:13:06 -080033#include "webrtc/modules/audio_processing/debug.pb.h"
peahdf3efa82015-11-28 12:35:15 -080034#endif
kwiberg77eab702016-09-28 17:42:01 -070035RTC_POP_IGNORING_WUNDEF()
peahdf3efa82015-11-28 12:35:15 -080036#endif // WEBRTC_AUDIOPROC_DEBUG_DUMP
niklase@google.com470e71d2011-07-07 08:21:25 +000037
38namespace webrtc {
andrew@webrtc.orgddbb8a22014-04-22 21:00:04 +000039
pbos@webrtc.org788acd12014-12-15 09:41:24 +000040class AgcManagerDirect;
ekmeyerson60d9b332015-08-14 10:35:55 -070041class AudioConverter;
Michael Graczykdfa36052015-03-25 16:37:27 -070042
Alejandro Luebsf4022ff2016-07-01 17:19:09 -070043class NonlinearBeamformer;
Michael Graczykdfa36052015-03-25 16:37:27 -070044
niklase@google.com470e71d2011-07-07 08:21:25 +000045class AudioProcessingImpl : public AudioProcessing {
46 public:
peahdf3efa82015-11-28 12:35:15 -080047 // Methods forcing APM to run in a single-threaded manner.
48 // Acquires both the render and capture locks.
peah88ac8532016-09-12 16:47:25 -070049 explicit AudioProcessingImpl(const webrtc::Config& config);
Michael Graczykdfa36052015-03-25 16:37:27 -070050 // AudioProcessingImpl takes ownership of beamformer.
peah88ac8532016-09-12 16:47:25 -070051 AudioProcessingImpl(const webrtc::Config& config,
52 NonlinearBeamformer* beamformer);
kwiberg83ffe452016-08-29 14:46:07 -070053 ~AudioProcessingImpl() override;
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000054 int Initialize() override;
peahde65ddc2016-09-16 15:02:15 -070055 int Initialize(int capture_input_sample_rate_hz,
56 int capture_output_sample_rate_hz,
57 int render_sample_rate_hz,
58 ChannelLayout capture_input_layout,
59 ChannelLayout capture_output_layout,
60 ChannelLayout render_input_layout) override;
Michael Graczyk86c6d332015-07-23 11:41:39 -070061 int Initialize(const ProcessingConfig& processing_config) override;
peah88ac8532016-09-12 16:47:25 -070062 void ApplyConfig(const AudioProcessing::Config& config) override;
63 void SetExtraOptions(const webrtc::Config& config) override;
peahdf3efa82015-11-28 12:35:15 -080064 void UpdateHistogramsOnCallEnd() override;
ivocd66b44d2016-01-15 03:06:36 -080065 int StartDebugRecording(const char filename[kMaxFilenameSize],
66 int64_t max_log_size_bytes) override;
67 int StartDebugRecording(FILE* handle, int64_t max_log_size_bytes) override;
peah73a28ee2016-10-12 03:01:49 -070068 int StartDebugRecording(FILE* handle) override;
peahdf3efa82015-11-28 12:35:15 -080069 int StartDebugRecordingForPlatformFile(rtc::PlatformFile handle) override;
70 int StopDebugRecording() override;
71
72 // Capture-side exclusive methods possibly running APM in a
73 // multi-threaded manner. Acquire the capture lock.
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000074 int ProcessStream(AudioFrame* frame) override;
75 int ProcessStream(const float* const* src,
Peter Kastingdce40cf2015-08-24 14:52:23 -070076 size_t samples_per_channel,
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000077 int input_sample_rate_hz,
78 ChannelLayout input_layout,
79 int output_sample_rate_hz,
80 ChannelLayout output_layout,
81 float* const* dest) override;
Michael Graczyk86c6d332015-07-23 11:41:39 -070082 int ProcessStream(const float* const* src,
83 const StreamConfig& input_config,
84 const StreamConfig& output_config,
85 float* const* dest) override;
peahdf3efa82015-11-28 12:35:15 -080086 void set_output_will_be_muted(bool muted) override;
87 int set_stream_delay_ms(int delay) override;
88 void set_delay_offset_ms(int offset) override;
89 int delay_offset_ms() const override;
90 void set_stream_key_pressed(bool key_pressed) override;
91
92 // Render-side exclusive methods possibly running APM in a
93 // multi-threaded manner. Acquire the render lock.
ekmeyerson60d9b332015-08-14 10:35:55 -070094 int ProcessReverseStream(AudioFrame* frame) override;
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000095 int AnalyzeReverseStream(const float* const* data,
Peter Kastingdce40cf2015-08-24 14:52:23 -070096 size_t samples_per_channel,
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000097 int sample_rate_hz,
98 ChannelLayout layout) override;
ekmeyerson60d9b332015-08-14 10:35:55 -070099 int ProcessReverseStream(const float* const* src,
peahde65ddc2016-09-16 15:02:15 -0700100 const StreamConfig& input_config,
101 const StreamConfig& output_config,
ekmeyerson60d9b332015-08-14 10:35:55 -0700102 float* const* dest) override;
peahdf3efa82015-11-28 12:35:15 -0800103
104 // Methods only accessed from APM submodules or
105 // from AudioProcessing tests in a single-threaded manner.
106 // Hence there is no need for locks in these.
107 int proc_sample_rate_hz() const override;
108 int proc_split_sample_rate_hz() const override;
Peter Kasting69558702016-01-12 16:26:35 -0800109 size_t num_input_channels() const override;
110 size_t num_proc_channels() const override;
111 size_t num_output_channels() const override;
112 size_t num_reverse_channels() const override;
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +0000113 int stream_delay_ms() const override;
peahdf3efa82015-11-28 12:35:15 -0800114 bool was_stream_delay_set() const override
115 EXCLUSIVE_LOCKS_REQUIRED(crit_capture_);
116
117 // Methods returning pointers to APM submodules.
118 // No locks are aquired in those, as those locks
119 // would offer no protection (the submodules are
120 // created only once in a single-treaded manner
121 // during APM creation).
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +0000122 EchoCancellation* echo_cancellation() const override;
123 EchoControlMobile* echo_control_mobile() const override;
124 GainControl* gain_control() const override;
125 HighPassFilter* high_pass_filter() const override;
126 LevelEstimator* level_estimator() const override;
127 NoiseSuppression* noise_suppression() const override;
128 VoiceDetection* voice_detection() const override;
niklase@google.com470e71d2011-07-07 08:21:25 +0000129
andrew@webrtc.org60730cf2014-01-07 17:45:09 +0000130 protected:
andrew@webrtc.orga8b97372014-03-10 22:26:12 +0000131 // Overridden in a mock.
peahdf3efa82015-11-28 12:35:15 -0800132 virtual int InitializeLocked()
133 EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_);
andrew@webrtc.org60730cf2014-01-07 17:45:09 +0000134
niklase@google.com470e71d2011-07-07 08:21:25 +0000135 private:
peahc19f3122016-10-07 14:54:10 -0700136 // TODO(peah): These friend classes should be removed as soon as the new
137 // parameter setting scheme allows.
138 FRIEND_TEST_ALL_PREFIXES(ApmConfiguration, DefaultBehavior);
139 FRIEND_TEST_ALL_PREFIXES(ApmConfiguration, ValidConfigBehavior);
140 FRIEND_TEST_ALL_PREFIXES(ApmConfiguration, InValidConfigBehavior);
peahdf3efa82015-11-28 12:35:15 -0800141 struct ApmPublicSubmodules;
142 struct ApmPrivateSubmodules;
143
peah2ace3f92016-09-10 04:42:27 -0700144 class ApmSubmoduleStates {
145 public:
146 ApmSubmoduleStates();
147 // Updates the submodule state and returns true if it has changed.
148 bool Update(bool high_pass_filter_enabled,
149 bool echo_canceller_enabled,
150 bool mobile_echo_controller_enabled,
151 bool noise_suppressor_enabled,
152 bool intelligibility_enhancer_enabled,
153 bool beamformer_enabled,
154 bool adaptive_gain_controller_enabled,
155 bool level_controller_enabled,
156 bool voice_activity_detector_enabled,
157 bool level_estimator_enabled,
158 bool transient_suppressor_enabled);
159 bool CaptureMultiBandSubModulesActive() const;
160 bool CaptureMultiBandProcessingActive() const;
161 bool RenderMultiBandSubModulesActive() const;
162 bool RenderMultiBandProcessingActive() const;
163
164 private:
165 bool high_pass_filter_enabled_ = false;
166 bool echo_canceller_enabled_ = false;
167 bool mobile_echo_controller_enabled_ = false;
168 bool noise_suppressor_enabled_ = false;
169 bool intelligibility_enhancer_enabled_ = false;
170 bool beamformer_enabled_ = false;
171 bool adaptive_gain_controller_enabled_ = false;
172 bool level_controller_enabled_ = false;
173 bool level_estimator_enabled_ = false;
174 bool voice_activity_detector_enabled_ = false;
175 bool transient_suppressor_enabled_ = false;
176 bool first_update_ = true;
177 };
178
peahdf3efa82015-11-28 12:35:15 -0800179#ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP
180 // State for the debug dump.
181 struct ApmDebugDumpThreadState {
kwiberg83ffe452016-08-29 14:46:07 -0700182 ApmDebugDumpThreadState();
183 ~ApmDebugDumpThreadState();
kwiberg88788ad2016-02-19 07:04:49 -0800184 std::unique_ptr<audioproc::Event> event_msg; // Protobuf message.
peahdf3efa82015-11-28 12:35:15 -0800185 std::string event_str; // Memory for protobuf serialization.
186
187 // Serialized string of last saved APM configuration.
188 std::string last_serialized_config;
189 };
190
191 struct ApmDebugDumpState {
kwiberg83ffe452016-08-29 14:46:07 -0700192 ApmDebugDumpState();
193 ~ApmDebugDumpState();
ivocd66b44d2016-01-15 03:06:36 -0800194 // Number of bytes that can still be written to the log before the maximum
195 // size is reached. A value of <= 0 indicates that no limit is used.
196 int64_t num_bytes_left_for_log_ = -1;
kwiberg88788ad2016-02-19 07:04:49 -0800197 std::unique_ptr<FileWrapper> debug_file;
peahdf3efa82015-11-28 12:35:15 -0800198 ApmDebugDumpThreadState render;
199 ApmDebugDumpThreadState capture;
200 };
201#endif
202
203 // Method for modifying the formats struct that are called from both
204 // the render and capture threads. The check for whether modifications
205 // are needed is done while holding the render lock only, thereby avoiding
206 // that the capture thread blocks the render thread.
207 // The struct is modified in a single-threaded manner by holding both the
208 // render and capture locks.
peah2ace3f92016-09-10 04:42:27 -0700209 int MaybeInitialize(const ProcessingConfig& config, bool force_initialization)
peahdf3efa82015-11-28 12:35:15 -0800210 EXCLUSIVE_LOCKS_REQUIRED(crit_render_);
211
212 int MaybeInitializeRender(const ProcessingConfig& processing_config)
213 EXCLUSIVE_LOCKS_REQUIRED(crit_render_);
214
peah2ace3f92016-09-10 04:42:27 -0700215 int MaybeInitializeCapture(const ProcessingConfig& processing_config,
216 bool force_initialization)
peahdf3efa82015-11-28 12:35:15 -0800217 EXCLUSIVE_LOCKS_REQUIRED(crit_render_);
218
peah2ace3f92016-09-10 04:42:27 -0700219 // Method for updating the state keeping track of the active submodules.
220 // Returns a bool indicating whether the state has changed.
221 bool UpdateActiveSubmoduleStates() EXCLUSIVE_LOCKS_REQUIRED(crit_capture_);
peahdf3efa82015-11-28 12:35:15 -0800222
223 // Methods requiring APM running in a single-threaded manner.
224 // Are called with both the render and capture locks already
225 // acquired.
peahdf3efa82015-11-28 12:35:15 -0800226 void InitializeTransient()
227 EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_);
228 void InitializeBeamformer()
229 EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_);
230 void InitializeIntelligibility()
231 EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_);
Michael Graczyk86c6d332015-07-23 11:41:39 -0700232 int InitializeLocked(const ProcessingConfig& config)
peahdf3efa82015-11-28 12:35:15 -0800233 EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_);
peahca4cac72016-06-29 15:26:12 -0700234 void InitializeLevelController() EXCLUSIVE_LOCKS_REQUIRED(crit_capture_);
peahdf3efa82015-11-28 12:35:15 -0800235
236 // Capture-side exclusive methods possibly running APM in a multi-threaded
237 // manner that are called with the render lock already acquired.
peahde65ddc2016-09-16 15:02:15 -0700238 int ProcessCaptureStreamLocked() EXCLUSIVE_LOCKS_REQUIRED(crit_capture_);
peahdf3efa82015-11-28 12:35:15 -0800239 void MaybeUpdateHistograms() EXCLUSIVE_LOCKS_REQUIRED(crit_capture_);
240
241 // Render-side exclusive methods possibly running APM in a multi-threaded
242 // manner that are called with the render lock already acquired.
ekmeyerson60d9b332015-08-14 10:35:55 -0700243 // TODO(ekm): Remove once all clients updated to new interface.
peahdf3efa82015-11-28 12:35:15 -0800244 int AnalyzeReverseStreamLocked(const float* const* src,
245 const StreamConfig& input_config,
246 const StreamConfig& output_config)
247 EXCLUSIVE_LOCKS_REQUIRED(crit_render_);
peahde65ddc2016-09-16 15:02:15 -0700248 int ProcessRenderStreamLocked() EXCLUSIVE_LOCKS_REQUIRED(crit_render_);
andrew@webrtc.org17e40642014-03-04 20:58:13 +0000249
peahdf3efa82015-11-28 12:35:15 -0800250// Debug dump methods that are internal and called without locks.
251// TODO(peah): Make thread safe.
andrew@webrtc.org7bf26462011-12-03 00:03:31 +0000252#ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP
253 // TODO(andrew): make this more graceful. Ideally we would split this stuff
254 // out into a separate class with an "enabled" and "disabled" implementation.
peahdf3efa82015-11-28 12:35:15 -0800255 static int WriteMessageToDebugFile(FileWrapper* debug_file,
ivocd66b44d2016-01-15 03:06:36 -0800256 int64_t* filesize_limit_bytes,
peahdf3efa82015-11-28 12:35:15 -0800257 rtc::CriticalSection* crit_debug,
258 ApmDebugDumpThreadState* debug_state);
259 int WriteInitMessage() EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_);
Minyue13b96ba2015-10-03 00:39:14 +0200260
261 // Writes Config message. If not |forced|, only writes the current config if
262 // it is different from the last saved one; if |forced|, writes the config
263 // regardless of the last saved.
peahdf3efa82015-11-28 12:35:15 -0800264 int WriteConfigMessage(bool forced) EXCLUSIVE_LOCKS_REQUIRED(crit_capture_)
265 EXCLUSIVE_LOCKS_REQUIRED(crit_capture_);
Minyue13b96ba2015-10-03 00:39:14 +0200266
peahdf3efa82015-11-28 12:35:15 -0800267 // Critical section.
pbos5ad935c2016-01-25 03:52:44 -0800268 rtc::CriticalSection crit_debug_;
Minyue13b96ba2015-10-03 00:39:14 +0200269
peahdf3efa82015-11-28 12:35:15 -0800270 // Debug dump state.
271 ApmDebugDumpState debug_dump_;
andrew@webrtc.org7bf26462011-12-03 00:03:31 +0000272#endif
niklase@google.com470e71d2011-07-07 08:21:25 +0000273
peahdf3efa82015-11-28 12:35:15 -0800274 // Critical sections.
pbos5ad935c2016-01-25 03:52:44 -0800275 rtc::CriticalSection crit_render_ ACQUIRED_BEFORE(crit_capture_);
276 rtc::CriticalSection crit_capture_;
peahdf3efa82015-11-28 12:35:15 -0800277
peahc19f3122016-10-07 14:54:10 -0700278 // Struct containing the Config specifying the behavior of APM.
279 AudioProcessing::Config config_;
280
peah2ace3f92016-09-10 04:42:27 -0700281 // Class containing information about what submodules are active.
282 ApmSubmoduleStates submodule_states_;
283
peahdf3efa82015-11-28 12:35:15 -0800284 // Structs containing the pointers to the submodules.
kwiberg88788ad2016-02-19 07:04:49 -0800285 std::unique_ptr<ApmPublicSubmodules> public_submodules_;
286 std::unique_ptr<ApmPrivateSubmodules> private_submodules_
peahdf3efa82015-11-28 12:35:15 -0800287 GUARDED_BY(crit_capture_);
288
peah192164e2015-11-17 02:16:45 -0800289 // State that is written to while holding both the render and capture locks
peahdf3efa82015-11-28 12:35:15 -0800290 // but can be read without any lock being held.
291 // As this is only accessed internally of APM, and all internal methods in APM
292 // either are holding the render or capture locks, this construct is safe as
293 // it is not possible to read the variables while writing them.
294 struct ApmFormatState {
295 ApmFormatState()
peah192164e2015-11-17 02:16:45 -0800296 : // Format of processing streams at input/output call sites.
peahdf3efa82015-11-28 12:35:15 -0800297 api_format({{{kSampleRate16kHz, 1, false},
298 {kSampleRate16kHz, 1, false},
299 {kSampleRate16kHz, 1, false},
300 {kSampleRate16kHz, 1, false}}}),
peahde65ddc2016-09-16 15:02:15 -0700301 render_processing_format(kSampleRate16kHz, 1) {}
peahdf3efa82015-11-28 12:35:15 -0800302 ProcessingConfig api_format;
peahde65ddc2016-09-16 15:02:15 -0700303 StreamConfig render_processing_format;
peahdf3efa82015-11-28 12:35:15 -0800304 } formats_;
Michael Graczyk86c6d332015-07-23 11:41:39 -0700305
peahdf3efa82015-11-28 12:35:15 -0800306 // APM constants.
307 const struct ApmConstants {
Alejandro Luebsc9b0c262016-05-16 15:32:38 -0700308 ApmConstants(int agc_startup_min_volume, bool use_experimental_agc)
peahdf3efa82015-11-28 12:35:15 -0800309 : // Format of processing streams at input/output call sites.
310 agc_startup_min_volume(agc_startup_min_volume),
Alejandro Luebsc9b0c262016-05-16 15:32:38 -0700311 use_experimental_agc(use_experimental_agc) {}
peahdf3efa82015-11-28 12:35:15 -0800312 int agc_startup_min_volume;
peahbe615622016-02-13 16:40:47 -0800313 bool use_experimental_agc;
peahdf3efa82015-11-28 12:35:15 -0800314 } constants_;
andrew@webrtc.orgddbb8a22014-04-22 21:00:04 +0000315
peahdf3efa82015-11-28 12:35:15 -0800316 struct ApmCaptureState {
aluebs2a346882016-01-11 18:04:30 -0800317 ApmCaptureState(bool transient_suppressor_enabled,
aluebs2a346882016-01-11 18:04:30 -0800318 const std::vector<Point>& array_geometry,
kwiberg83ffe452016-08-29 14:46:07 -0700319 SphericalPointf target_direction);
320 ~ApmCaptureState();
peahdf3efa82015-11-28 12:35:15 -0800321 int aec_system_delay_jumps;
322 int delay_offset_ms;
323 bool was_stream_delay_set;
324 int last_stream_delay_ms;
325 int last_aec_system_delay_ms;
326 int stream_delay_jumps;
327 bool output_will_be_muted;
328 bool key_pressed;
329 bool transient_suppressor_enabled;
aluebs2a346882016-01-11 18:04:30 -0800330 std::vector<Point> array_geometry;
331 SphericalPointf target_direction;
kwiberg88788ad2016-02-19 07:04:49 -0800332 std::unique_ptr<AudioBuffer> capture_audio;
peahde65ddc2016-09-16 15:02:15 -0700333 // Only the rate and samples fields of capture_processing_format_ are used
334 // because the capture processing number of channels is mutable and is
335 // tracked by the capture_audio_.
336 StreamConfig capture_processing_format;
peahdf3efa82015-11-28 12:35:15 -0800337 int split_rate;
338 } capture_ GUARDED_BY(crit_capture_);
niklase@google.com470e71d2011-07-07 08:21:25 +0000339
peahdf3efa82015-11-28 12:35:15 -0800340 struct ApmCaptureNonLockedState {
Alejandro Luebsc9b0c262016-05-16 15:32:38 -0700341 ApmCaptureNonLockedState(bool beamformer_enabled,
peah88ac8532016-09-12 16:47:25 -0700342 bool intelligibility_enabled)
peahde65ddc2016-09-16 15:02:15 -0700343 : capture_processing_format(kSampleRate16kHz),
peahdf3efa82015-11-28 12:35:15 -0800344 split_rate(kSampleRate16kHz),
aluebsb2328d12016-01-11 20:32:29 -0800345 stream_delay_ms(0),
Alejandro Luebsc9b0c262016-05-16 15:32:38 -0700346 beamformer_enabled(beamformer_enabled),
peah88ac8532016-09-12 16:47:25 -0700347 intelligibility_enabled(intelligibility_enabled) {}
peahde65ddc2016-09-16 15:02:15 -0700348 // Only the rate and samples fields of capture_processing_format_ are used
349 // because the forward processing number of channels is mutable and is
350 // tracked by the capture_audio_.
351 StreamConfig capture_processing_format;
peahdf3efa82015-11-28 12:35:15 -0800352 int split_rate;
353 int stream_delay_ms;
aluebsb2328d12016-01-11 20:32:29 -0800354 bool beamformer_enabled;
Alejandro Luebsc9b0c262016-05-16 15:32:38 -0700355 bool intelligibility_enabled;
peah88ac8532016-09-12 16:47:25 -0700356 bool level_controller_enabled = false;
peahdf3efa82015-11-28 12:35:15 -0800357 } capture_nonlocked_;
andrew@webrtc.org75dd2882014-02-11 20:52:30 +0000358
peahdf3efa82015-11-28 12:35:15 -0800359 struct ApmRenderState {
kwiberg83ffe452016-08-29 14:46:07 -0700360 ApmRenderState();
361 ~ApmRenderState();
kwiberg88788ad2016-02-19 07:04:49 -0800362 std::unique_ptr<AudioConverter> render_converter;
363 std::unique_ptr<AudioBuffer> render_audio;
peahdf3efa82015-11-28 12:35:15 -0800364 } render_ GUARDED_BY(crit_render_);
niklase@google.com470e71d2011-07-07 08:21:25 +0000365};
andrew@webrtc.orgddbb8a22014-04-22 21:00:04 +0000366
niklase@google.com470e71d2011-07-07 08:21:25 +0000367} // namespace webrtc
368
pbos@webrtc.org788acd12014-12-15 09:41:24 +0000369#endif // WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_PROCESSING_IMPL_H_