Update to current webrtc library
This is from the upstream library commit id 3326535126e435f1ba647885ce43a8f0f3d317eb, corresponding to Chromium 88.0.4290.1.
This commit is contained in:
@ -11,8 +11,10 @@
|
||||
// A ring buffer to hold arbitrary data. Provides no thread safety. Unless
|
||||
// otherwise specified, functions return 0 on success and -1 on error.
|
||||
|
||||
#ifndef WEBRTC_COMMON_AUDIO_RING_BUFFER_H_
|
||||
#define WEBRTC_COMMON_AUDIO_RING_BUFFER_H_
|
||||
#ifndef COMMON_AUDIO_RING_BUFFER_H_
|
||||
#define COMMON_AUDIO_RING_BUFFER_H_
|
||||
|
||||
// TODO(alessiob): Used by AEC, AECm and AudioRingBuffer. Remove when possible.
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -20,21 +22,31 @@ extern "C" {
|
||||
|
||||
#include <stddef.h> // size_t
|
||||
|
||||
typedef struct RingBuffer RingBuffer;
|
||||
enum Wrap { SAME_WRAP, DIFF_WRAP };
|
||||
|
||||
// Creates and initializes the buffer. Returns NULL on failure.
|
||||
typedef struct RingBuffer {
|
||||
size_t read_pos;
|
||||
size_t write_pos;
|
||||
size_t element_count;
|
||||
size_t element_size;
|
||||
enum Wrap rw_wrap;
|
||||
char* data;
|
||||
} RingBuffer;
|
||||
|
||||
// Creates and initializes the buffer. Returns null on failure.
|
||||
RingBuffer* WebRtc_CreateBuffer(size_t element_count, size_t element_size);
|
||||
void WebRtc_InitBuffer(RingBuffer* handle);
|
||||
void WebRtc_FreeBuffer(void* handle);
|
||||
|
||||
// Reads data from the buffer. The |data_ptr| will point to the address where
|
||||
// it is located. If all |element_count| data are feasible to read without
|
||||
// buffer wrap around |data_ptr| will point to the location in the buffer.
|
||||
// Otherwise, the data will be copied to |data| (memory allocation done by the
|
||||
// user) and |data_ptr| points to the address of |data|. |data_ptr| is only
|
||||
// guaranteed to be valid until the next call to WebRtc_WriteBuffer().
|
||||
// Reads data from the buffer. Returns the number of elements that were read.
|
||||
// The |data_ptr| will point to the address where the read data is located.
|
||||
// If no data can be read, |data_ptr| is set to |NULL|. If all data can be read
|
||||
// without buffer wrap around then |data_ptr| will point to the location in the
|
||||
// buffer. Otherwise, the data will be copied to |data| (memory allocation done
|
||||
// by the user) and |data_ptr| points to the address of |data|. |data_ptr| is
|
||||
// only guaranteed to be valid until the next call to WebRtc_WriteBuffer().
|
||||
//
|
||||
// To force a copying to |data|, pass a NULL |data_ptr|.
|
||||
// To force a copying to |data|, pass a null |data_ptr|.
|
||||
//
|
||||
// Returns number of elements read.
|
||||
size_t WebRtc_ReadBuffer(RingBuffer* handle,
|
||||
@ -43,7 +55,8 @@ size_t WebRtc_ReadBuffer(RingBuffer* handle,
|
||||
size_t element_count);
|
||||
|
||||
// Writes |data| to buffer and returns the number of elements written.
|
||||
size_t WebRtc_WriteBuffer(RingBuffer* handle, const void* data,
|
||||
size_t WebRtc_WriteBuffer(RingBuffer* handle,
|
||||
const void* data,
|
||||
size_t element_count);
|
||||
|
||||
// Moves the buffer read position and returns the number of elements moved.
|
||||
@ -63,4 +76,4 @@ size_t WebRtc_available_write(const RingBuffer* handle);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // WEBRTC_COMMON_AUDIO_RING_BUFFER_H_
|
||||
#endif // COMMON_AUDIO_RING_BUFFER_H_
|
||||
|
Reference in New Issue
Block a user