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

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

Issue 1227213002: Update audio code to use size_t more correctly, webrtc/modules/audio_processing/ (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 5 years, 5 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 virtual int ProcessStream(AudioFrame* frame) = 0; 288 virtual int ProcessStream(AudioFrame* frame) = 0;
289 289
290 // Accepts deinterleaved float audio with the range [-1, 1]. Each element 290 // Accepts deinterleaved float audio with the range [-1, 1]. Each element
291 // of |src| points to a channel buffer, arranged according to 291 // of |src| points to a channel buffer, arranged according to
292 // |input_layout|. At output, the channels will be arranged according to 292 // |input_layout|. At output, the channels will be arranged according to
293 // |output_layout| at |output_sample_rate_hz| in |dest|. 293 // |output_layout| at |output_sample_rate_hz| in |dest|.
294 // 294 //
295 // The output layout may only remove channels, not add. |src| and |dest| 295 // The output layout may only remove channels, not add. |src| and |dest|
296 // may use the same memory, if desired. 296 // may use the same memory, if desired.
297 virtual int ProcessStream(const float* const* src, 297 virtual int ProcessStream(const float* const* src,
298 int samples_per_channel, 298 size_t samples_per_channel,
299 int input_sample_rate_hz, 299 int input_sample_rate_hz,
300 ChannelLayout input_layout, 300 ChannelLayout input_layout,
301 int output_sample_rate_hz, 301 int output_sample_rate_hz,
302 ChannelLayout output_layout, 302 ChannelLayout output_layout,
303 float* const* dest) = 0; 303 float* const* dest) = 0;
304 304
305 // Analyzes a 10 ms |frame| of the reverse direction audio stream. The frame 305 // Analyzes a 10 ms |frame| of the reverse direction audio stream. The frame
306 // will not be modified. On the client-side, this is the far-end (or to be 306 // will not be modified. On the client-side, this is the far-end (or to be
307 // rendered) audio. 307 // rendered) audio.
308 // 308 //
309 // It is only necessary to provide this if echo processing is enabled, as the 309 // It is only necessary to provide this if echo processing is enabled, as the
310 // reverse stream forms the echo reference signal. It is recommended, but not 310 // reverse stream forms the echo reference signal. It is recommended, but not
311 // necessary, to provide if gain control is enabled. On the server-side this 311 // necessary, to provide if gain control is enabled. On the server-side this
312 // typically will not be used. If you're not sure what to pass in here, 312 // typically will not be used. If you're not sure what to pass in here,
313 // chances are you don't need to use it. 313 // chances are you don't need to use it.
314 // 314 //
315 // The |sample_rate_hz_|, |num_channels_|, and |samples_per_channel_| 315 // The |sample_rate_hz_|, |num_channels_|, and |samples_per_channel_|
316 // members of |frame| must be valid. |sample_rate_hz_| must correspond to 316 // members of |frame| must be valid. |sample_rate_hz_| must correspond to
317 // |input_sample_rate_hz()| 317 // |input_sample_rate_hz()|
318 // 318 //
319 // TODO(ajm): add const to input; requires an implementation fix. 319 // TODO(ajm): add const to input; requires an implementation fix.
320 virtual int AnalyzeReverseStream(AudioFrame* frame) = 0; 320 virtual int AnalyzeReverseStream(AudioFrame* frame) = 0;
321 321
322 // Accepts deinterleaved float audio with the range [-1, 1]. Each element 322 // Accepts deinterleaved float audio with the range [-1, 1]. Each element
323 // of |data| points to a channel buffer, arranged according to |layout|. 323 // of |data| points to a channel buffer, arranged according to |layout|.
324 virtual int AnalyzeReverseStream(const float* const* data, 324 virtual int AnalyzeReverseStream(const float* const* data,
325 int samples_per_channel, 325 size_t samples_per_channel,
326 int sample_rate_hz, 326 int sample_rate_hz,
327 ChannelLayout layout) = 0; 327 ChannelLayout layout) = 0;
328 328
329 // This must be called if and only if echo processing is enabled. 329 // This must be called if and only if echo processing is enabled.
330 // 330 //
331 // Sets the |delay| in ms between AnalyzeReverseStream() receiving a far-end 331 // Sets the |delay| in ms between AnalyzeReverseStream() receiving a far-end
332 // frame and ProcessStream() receiving a near-end frame containing the 332 // frame and ProcessStream() receiving a near-end frame containing the
333 // corresponding echo. On the client-side this can be expressed as 333 // corresponding echo. On the client-side this can be expressed as
334 // delay = (t_render - t_analyze) + (t_process - t_capture) 334 // delay = (t_render - t_analyze) + (t_process - t_capture)
335 // where, 335 // where,
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 // This does not impact the size of frames passed to |ProcessStream()|. 787 // This does not impact the size of frames passed to |ProcessStream()|.
788 virtual int set_frame_size_ms(int size) = 0; 788 virtual int set_frame_size_ms(int size) = 0;
789 virtual int frame_size_ms() const = 0; 789 virtual int frame_size_ms() const = 0;
790 790
791 protected: 791 protected:
792 virtual ~VoiceDetection() {} 792 virtual ~VoiceDetection() {}
793 }; 793 };
794 } // namespace webrtc 794 } // namespace webrtc
795 795
796 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_ 796 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698