diff options
author | Wim Taymans <wtaymans@redhat.com> | 2020-09-02 17:04:19 +0200 |
---|---|---|
committer | Wim Taymans <wtaymans@redhat.com> | 2020-09-02 17:04:19 +0200 |
commit | d7fb382b7b799c79deac82a3f375a25f6c89fd99 (patch) | |
tree | 79db45cc82e5a1c80e9ae0d8ec61f9ffec867851 | |
parent | dd0f4c72956a41b2b82b044cb509c6f9610f671c (diff) |
a2dp: place buffer id in io when reusing
-rw-r--r-- | spa/plugins/bluez5/a2dp-sink.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/spa/plugins/bluez5/a2dp-sink.c b/spa/plugins/bluez5/a2dp-sink.c index faeb7bf9..8674e78e 100644 --- a/spa/plugins/bluez5/a2dp-sink.c +++ b/spa/plugins/bluez5/a2dp-sink.c @@ -64,7 +64,8 @@ struct props { struct buffer { uint32_t id; - unsigned int outstanding:1; +#define BUFFER_FLAG_OUT (1<<0) + uint32_t flags; struct spa_buffer *buf; struct spa_meta_header *h; struct spa_list link; @@ -592,7 +593,8 @@ static int flush_data(struct impl *this, uint64_t now_time) if (written < 0 && written != -ENOSPC) { spa_list_remove(&b->link); - b->outstanding = true; + SPA_FLAG_SET(b->flags, BUFFER_FLAG_OUT); + this->port.io->buffer_id = b->id; spa_log_trace(this->log, NAME " %p: error %s, reuse buffer %u", this, spa_strerror(written), b->id); spa_node_call_reuse_buffer(&this->callbacks, 0, b->id); @@ -607,8 +609,9 @@ static int flush_data(struct impl *this, uint64_t now_time) if (port->ready_offset >= d[0].chunk->size) { spa_list_remove(&b->link); - b->outstanding = true; + SPA_FLAG_SET(b->flags, BUFFER_FLAG_OUT); spa_log_trace(this->log, NAME " %p: reuse buffer %u", this, b->id); + this->port.io->buffer_id = b->id; spa_node_call_reuse_buffer(&this->callbacks, 0, b->id); port->ready_offset = 0; @@ -1292,7 +1295,7 @@ impl_node_port_use_buffers(void *object, b->buf = buffers[i]; b->id = i; - b->outstanding = true; + SPA_FLAG_SET(b->flags, BUFFER_FLAG_OUT); b->h = spa_buffer_find_meta_data(buffers[i], SPA_META_Header, sizeof(*b->h)); @@ -1359,7 +1362,7 @@ static int impl_node_process(void *object) if (io->status == SPA_STATUS_HAVE_DATA && io->buffer_id < port->n_buffers) { struct buffer *b = &port->buffers[io->buffer_id]; - if (!b->outstanding) { + if (!SPA_FLAG_SET(b->flags, BUFFER_FLAG_OUT)) { spa_log_warn(this->log, NAME " %p: buffer %u in use", this, io->buffer_id); io->status = -EINVAL; return -EINVAL; @@ -1368,7 +1371,7 @@ static int impl_node_process(void *object) spa_log_trace(this->log, NAME " %p: queue buffer %u", this, io->buffer_id); spa_list_append(&port->ready, &b->link); - b->outstanding = false; + SPA_FLAG_CLEAR(b->flags, BUFFER_FLAG_OUT); port->need_data = false; this->threshold = SPA_MIN(b->buf->datas[0].chunk->size / port->frame_size, |