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

Side by Side Diff: webrtc/modules/audio_processing/include/audio_processing.h

Issue 1783693005: Deprecate AudioProcessing::AnalyzeReverseStream(AudioFrame) API (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@voe
Patch Set: Rebasing Created 4 years, 9 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 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 explicit Intelligibility(bool enabled) : enabled(enabled) {} 159 explicit Intelligibility(bool enabled) : enabled(enabled) {}
160 static const ConfigOptionID identifier = ConfigOptionID::kIntelligibility; 160 static const ConfigOptionID identifier = ConfigOptionID::kIntelligibility;
161 bool enabled; 161 bool enabled;
162 }; 162 };
163 163
164 // The Audio Processing Module (APM) provides a collection of voice processing 164 // The Audio Processing Module (APM) provides a collection of voice processing
165 // components designed for real-time communications software. 165 // components designed for real-time communications software.
166 // 166 //
167 // APM operates on two audio streams on a frame-by-frame basis. Frames of the 167 // APM operates on two audio streams on a frame-by-frame basis. Frames of the
168 // primary stream, on which all processing is applied, are passed to 168 // primary stream, on which all processing is applied, are passed to
169 // |ProcessStream()|. Frames of the reverse direction stream, which are used for 169 // |ProcessStream()|. Frames of the reverse direction stream are passed to
170 // analysis by some components, are passed to |AnalyzeReverseStream()|. On the 170 // |ProcessReverseStream()|. On the client-side, this will typically be the
171 // client-side, this will typically be the near-end (capture) and far-end 171 // near-end (capture) and far-end (render) streams, respectively. APM should be
172 // (render) streams, respectively. APM should be placed in the signal chain as 172 // placed in the signal chain as close to the audio hardware abstraction layer
173 // close to the audio hardware abstraction layer (HAL) as possible. 173 // (HAL) as possible.
174 // 174 //
175 // On the server-side, the reverse stream will normally not be used, with 175 // On the server-side, the reverse stream will normally not be used, with
176 // processing occurring on each incoming stream. 176 // processing occurring on each incoming stream.
177 // 177 //
178 // Component interfaces follow a similar pattern and are accessed through 178 // Component interfaces follow a similar pattern and are accessed through
179 // corresponding getters in APM. All components are disabled at create-time, 179 // corresponding getters in APM. All components are disabled at create-time,
180 // with default settings that are recommended for most situations. New settings 180 // with default settings that are recommended for most situations. New settings
181 // can be applied without enabling a component. Enabling a component triggers 181 // can be applied without enabling a component. Enabling a component triggers
182 // memory allocation and initialization to allow it to start processing the 182 // memory allocation and initialization to allow it to start processing the
183 // streams. 183 // streams.
(...skipping 23 matching lines...) Expand all
207 // 207 //
208 // apm->gain_control()->set_analog_level_limits(0, 255); 208 // apm->gain_control()->set_analog_level_limits(0, 255);
209 // apm->gain_control()->set_mode(kAdaptiveAnalog); 209 // apm->gain_control()->set_mode(kAdaptiveAnalog);
210 // apm->gain_control()->Enable(true); 210 // apm->gain_control()->Enable(true);
211 // 211 //
212 // apm->voice_detection()->Enable(true); 212 // apm->voice_detection()->Enable(true);
213 // 213 //
214 // // Start a voice call... 214 // // Start a voice call...
215 // 215 //
216 // // ... Render frame arrives bound for the audio HAL ... 216 // // ... Render frame arrives bound for the audio HAL ...
217 // apm->AnalyzeReverseStream(render_frame); 217 // apm->ProcessReverseStream(render_frame);
218 // 218 //
219 // // ... Capture frame arrives from the audio HAL ... 219 // // ... Capture frame arrives from the audio HAL ...
220 // // Call required set_stream_ functions. 220 // // Call required set_stream_ functions.
221 // apm->set_stream_delay_ms(delay_ms); 221 // apm->set_stream_delay_ms(delay_ms);
222 // apm->gain_control()->set_stream_analog_level(analog_level); 222 // apm->gain_control()->set_stream_analog_level(analog_level);
223 // 223 //
224 // apm->ProcessStream(capture_frame); 224 // apm->ProcessStream(capture_frame);
225 // 225 //
226 // // Call required stream_ functions. 226 // // Call required stream_ functions.
227 // analog_level = apm->gain_control()->stream_analog_level(); 227 // analog_level = apm->gain_control()->stream_analog_level();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 Beamformer<float>* beamformer); 260 Beamformer<float>* beamformer);
261 virtual ~AudioProcessing() {} 261 virtual ~AudioProcessing() {}
262 262
263 // Initializes internal states, while retaining all user settings. This 263 // Initializes internal states, while retaining all user settings. This
264 // should be called before beginning to process a new audio stream. However, 264 // should be called before beginning to process a new audio stream. However,
265 // it is not necessary to call before processing the first stream after 265 // it is not necessary to call before processing the first stream after
266 // creation. 266 // creation.
267 // 267 //
268 // It is also not necessary to call if the audio parameters (sample 268 // It is also not necessary to call if the audio parameters (sample
269 // rate and number of channels) have changed. Passing updated parameters 269 // rate and number of channels) have changed. Passing updated parameters
270 // directly to |ProcessStream()| and |AnalyzeReverseStream()| is permissible. 270 // directly to |ProcessStream()| and |ProcessReverseStream()| is permissible.
271 // If the parameters are known at init-time though, they may be provided. 271 // If the parameters are known at init-time though, they may be provided.
272 virtual int Initialize() = 0; 272 virtual int Initialize() = 0;
273 273
274 // The int16 interfaces require: 274 // The int16 interfaces require:
275 // - only |NativeRate|s be used 275 // - only |NativeRate|s be used
276 // - that the input, output and reverse rates must match 276 // - that the input, output and reverse rates must match
277 // - that |processing_config.output_stream()| matches 277 // - that |processing_config.output_stream()| matches
278 // |processing_config.input_stream()|. 278 // |processing_config.input_stream()|.
279 // 279 //
280 // The float interfaces accept arbitrary rates and support differing input and 280 // The float interfaces accept arbitrary rates and support differing input and
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 // output, the channels will be arranged according to |output_stream| in 345 // output, the channels will be arranged according to |output_stream| in
346 // |dest|. 346 // |dest|.
347 // 347 //
348 // The output must have one channel or as many channels as the input. |src| 348 // The output must have one channel or as many channels as the input. |src|
349 // and |dest| may use the same memory, if desired. 349 // and |dest| may use the same memory, if desired.
350 virtual int ProcessStream(const float* const* src, 350 virtual int ProcessStream(const float* const* src,
351 const StreamConfig& input_config, 351 const StreamConfig& input_config,
352 const StreamConfig& output_config, 352 const StreamConfig& output_config,
353 float* const* dest) = 0; 353 float* const* dest) = 0;
354 354
355 // Analyzes a 10 ms |frame| of the reverse direction audio stream. The frame 355 // Processes a 10 ms |frame| of the reverse direction audio stream. The frame
356 // will not be modified. On the client-side, this is the far-end (or to be 356 // may be modified. On the client-side, this is the far-end (or to be
357 // rendered) audio. 357 // rendered) audio.
358 // 358 //
359 // It is only necessary to provide this if echo processing is enabled, as the 359 // It is necessary to provide this if echo processing is enabled, as the
360 // reverse stream forms the echo reference signal. It is recommended, but not 360 // reverse stream forms the echo reference signal. It is recommended, but not
361 // necessary, to provide if gain control is enabled. On the server-side this 361 // necessary, to provide if gain control is enabled. On the server-side this
362 // typically will not be used. If you're not sure what to pass in here, 362 // typically will not be used. If you're not sure what to pass in here,
363 // chances are you don't need to use it. 363 // chances are you don't need to use it.
364 // 364 //
365 // The |sample_rate_hz_|, |num_channels_|, and |samples_per_channel_| 365 // The |sample_rate_hz_|, |num_channels_|, and |samples_per_channel_|
366 // members of |frame| must be valid. 366 // members of |frame| must be valid.
367 //
368 // TODO(ajm): add const to input; requires an implementation fix.
369 // DEPRECATED: Use |ProcessReverseStream| instead.
370 // TODO(ekm): Remove once all users have updated to |ProcessReverseStream|.
371 virtual int AnalyzeReverseStream(AudioFrame* frame) = 0;
372
373 // Same as |AnalyzeReverseStream|, but may modify |frame| if intelligibility
374 // is enabled.
375 virtual int ProcessReverseStream(AudioFrame* frame) = 0; 367 virtual int ProcessReverseStream(AudioFrame* frame) = 0;
376 368
377 // Accepts deinterleaved float audio with the range [-1, 1]. Each element 369 // Accepts deinterleaved float audio with the range [-1, 1]. Each element
378 // of |data| points to a channel buffer, arranged according to |layout|. 370 // of |data| points to a channel buffer, arranged according to |layout|.
379 // TODO(mgraczyk): Remove once clients are updated to use the new interface. 371 // TODO(mgraczyk): Remove once clients are updated to use the new interface.
380 virtual int AnalyzeReverseStream(const float* const* data, 372 virtual int AnalyzeReverseStream(const float* const* data,
381 size_t samples_per_channel, 373 size_t samples_per_channel,
382 int rev_sample_rate_hz, 374 int rev_sample_rate_hz,
383 ChannelLayout layout) = 0; 375 ChannelLayout layout) = 0;
384 376
385 // Accepts deinterleaved float audio with the range [-1, 1]. Each element of 377 // Accepts deinterleaved float audio with the range [-1, 1]. Each element of
386 // |data| points to a channel buffer, arranged according to |reverse_config|. 378 // |data| points to a channel buffer, arranged according to |reverse_config|.
387 virtual int ProcessReverseStream(const float* const* src, 379 virtual int ProcessReverseStream(const float* const* src,
388 const StreamConfig& reverse_input_config, 380 const StreamConfig& reverse_input_config,
389 const StreamConfig& reverse_output_config, 381 const StreamConfig& reverse_output_config,
390 float* const* dest) = 0; 382 float* const* dest) = 0;
391 383
392 // This must be called if and only if echo processing is enabled. 384 // This must be called if and only if echo processing is enabled.
393 // 385 //
394 // Sets the |delay| in ms between AnalyzeReverseStream() receiving a far-end 386 // Sets the |delay| in ms between ProcessReverseStream() receiving a far-end
395 // frame and ProcessStream() receiving a near-end frame containing the 387 // frame and ProcessStream() receiving a near-end frame containing the
396 // corresponding echo. On the client-side this can be expressed as 388 // corresponding echo. On the client-side this can be expressed as
397 // delay = (t_render - t_analyze) + (t_process - t_capture) 389 // delay = (t_render - t_analyze) + (t_process - t_capture)
398 // where, 390 // where,
399 // - t_analyze is the time a frame is passed to AnalyzeReverseStream() and 391 // - t_analyze is the time a frame is passed to ProcessReverseStream() and
400 // t_render is the time the first sample of the same frame is rendered by 392 // t_render is the time the first sample of the same frame is rendered by
401 // the audio hardware. 393 // the audio hardware.
402 // - t_capture is the time the first sample of a frame is captured by the 394 // - t_capture is the time the first sample of a frame is captured by the
403 // audio hardware and t_pull is the time the same frame is passed to 395 // audio hardware and t_pull is the time the same frame is passed to
404 // ProcessStream(). 396 // ProcessStream().
405 virtual int set_stream_delay_ms(int delay) = 0; 397 virtual int set_stream_delay_ms(int delay) = 0;
406 virtual int stream_delay_ms() const = 0; 398 virtual int stream_delay_ms() const = 0;
407 virtual bool was_stream_delay_set() const = 0; 399 virtual bool was_stream_delay_set() const = 0;
408 400
409 // Call to signal that a key press occurred (true) or did not occur (false) 401 // Call to signal that a key press occurred (true) or did not occur (false)
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 // This does not impact the size of frames passed to |ProcessStream()|. 964 // This does not impact the size of frames passed to |ProcessStream()|.
973 virtual int set_frame_size_ms(int size) = 0; 965 virtual int set_frame_size_ms(int size) = 0;
974 virtual int frame_size_ms() const = 0; 966 virtual int frame_size_ms() const = 0;
975 967
976 protected: 968 protected:
977 virtual ~VoiceDetection() {} 969 virtual ~VoiceDetection() {}
978 }; 970 };
979 } // namespace webrtc 971 } // namespace webrtc
980 972
981 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_ 973 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698