MT#55283 convert struct mix_buffer_ssrc_source to typedef

Change-Id: I0743b2f5304d6a661e64ce2cd57488e16310b3b9
pull/1776/head
Richard Fuchs 2 years ago
parent 656de5ba42
commit f41989ede6

@ -16,11 +16,11 @@ struct mix_buffer_impl {
mix_in_fn_t *mix_in; mix_in_fn_t *mix_in;
}; };
struct mix_buffer_ssrc_source { typedef struct {
struct ssrc_entry h; // must be first struct ssrc_entry h; // must be first
unsigned int write_pos; unsigned int write_pos;
unsigned int loops; unsigned int loops;
}; } mix_buffer_ssrc_source;
@ -139,7 +139,7 @@ void mix_buffer_read_slow(struct mix_buffer *mb, void *outbuf, unsigned int samp
} }
static void mix_ssrc_put(struct mix_buffer_ssrc_source **s) { static void mix_ssrc_put(mix_buffer_ssrc_source **s) {
if (*s) if (*s)
obj_put(&(*s)->h); obj_put(&(*s)->h);
} }
@ -147,7 +147,7 @@ static void mix_ssrc_put(struct mix_buffer_ssrc_source **s) {
// write at the write-head, direct copy without mixing // write at the write-head, direct copy without mixing
// must be locked already // must be locked already
static bool mix_buffer_write_fast(struct mix_buffer *mb, struct mix_buffer_ssrc_source *src, static bool mix_buffer_write_fast(struct mix_buffer *mb, mix_buffer_ssrc_source *src,
const void *buf, unsigned int samples) const void *buf, unsigned int samples)
{ {
// check for buffer overflow // check for buffer overflow
@ -182,7 +182,7 @@ static bool mix_buffer_write_fast(struct mix_buffer *mb, struct mix_buffer_ssrc_
// write before the write-head with mixing-in // write before the write-head with mixing-in
// must be locked already // must be locked already
static bool mix_buffer_write_slow(struct mix_buffer *mb, struct mix_buffer_ssrc_source *src, static bool mix_buffer_write_slow(struct mix_buffer *mb, mix_buffer_ssrc_source *src,
const void *buf, unsigned int samples) const void *buf, unsigned int samples)
{ {
// mix-in up to the current write-head, or end of buffer in case of wrap-around // mix-in up to the current write-head, or end of buffer in case of wrap-around
@ -220,7 +220,7 @@ static bool mix_buffer_write_slow(struct mix_buffer *mb, struct mix_buffer_ssrc_
} }
static void mix_buffer_src_add_delay(struct mix_buffer *mb, struct mix_buffer_ssrc_source *src, static void mix_buffer_src_add_delay(struct mix_buffer *mb, mix_buffer_ssrc_source *src,
unsigned int samples) unsigned int samples)
{ {
if (!samples) if (!samples)
@ -239,7 +239,7 @@ static void mix_buffer_src_add_delay(struct mix_buffer *mb, struct mix_buffer_ss
} }
static void mix_buffer_src_init_pos(struct mix_buffer *mb, struct mix_buffer_ssrc_source *src) { static void mix_buffer_src_init_pos(struct mix_buffer *mb, mix_buffer_ssrc_source *src) {
src->write_pos = mb->read_pos; src->write_pos = mb->read_pos;
src->loops = mb->loops; src->loops = mb->loops;
if (mb->head_write_pos < src->write_pos) if (mb->head_write_pos < src->write_pos)
@ -248,7 +248,7 @@ static void mix_buffer_src_init_pos(struct mix_buffer *mb, struct mix_buffer_ssr
} }
static void mix_buff_src_shift_delay(struct mix_buffer *mb, struct mix_buffer_ssrc_source *src, static void mix_buff_src_shift_delay(struct mix_buffer *mb, mix_buffer_ssrc_source *src,
const struct timeval *last, const struct timeval *now) const struct timeval *last, const struct timeval *now)
{ {
if (!last || !now) if (!last || !now)
@ -269,7 +269,7 @@ bool mix_buffer_write_delay(struct mix_buffer *mb, uint32_t ssrc, const void *bu
LOCK(&mb->lock); LOCK(&mb->lock);
bool created; bool created;
AUTO_CLEANUP(struct mix_buffer_ssrc_source *src, mix_ssrc_put) AUTO_CLEANUP(mix_buffer_ssrc_source *src, mix_ssrc_put)
= get_ssrc_full(ssrc, mb->ssrc_hash, &created); = get_ssrc_full(ssrc, mb->ssrc_hash, &created);
if (!src) if (!src)
return false; return false;
@ -310,7 +310,7 @@ bool mix_buffer_write_delay(struct mix_buffer *mb, uint32_t ssrc, const void *bu
static struct ssrc_entry *mix_buffer_ssrc_new(void *p) { static struct ssrc_entry *mix_buffer_ssrc_new(void *p) {
struct mix_buffer *mb = p; struct mix_buffer *mb = p;
struct mix_buffer_ssrc_source *src = obj_alloc0("mix_buffer_ssrc", sizeof(*src), NULL); mix_buffer_ssrc_source *src = obj_alloc0("mix_buffer_ssrc", sizeof(*src), NULL);
mix_buffer_src_init_pos(mb, src); mix_buffer_src_init_pos(mb, src);
return &src->h; return &src->h;
} }

Loading…
Cancel
Save