buffer: don't use ringbuffer in chunk

We can't use a ringbuffer on the chunk because it implies the
consumer would write to it to update the read position, which we
can't do because the chunk is read-only and might even be shared.
Go back to offset/size pairs, which can sortof do the same thing
if we want later when we keep a non-shared read pointer in the
consumer.
Keep alsa timestamp around and filled state for future.
mmap the input port meta/data/chunk as read-only.
Only do clock update requests when asked.
This commit is contained in:
Wim Taymans 2017-11-21 12:30:15 +01:00
parent 2ad722b579
commit 4288a634f4
25 changed files with 165 additions and 126 deletions

View file

@ -299,7 +299,6 @@ static int make_buffer(struct impl *this)
int n_bytes, n_samples;
uint32_t maxsize;
void *data;
struct spa_ringbuffer *rb;
struct spa_data *d;
int32_t filled, avail;
uint32_t index, offset, l0, l1;
@ -329,9 +328,8 @@ static int make_buffer(struct impl *this)
spa_log_trace(this->log, NAME " %p: dequeue buffer %d %d %d", this, b->outbuf->id,
maxsize, n_bytes);
rb = &d[0].chunk->area;
filled = spa_ringbuffer_get_write_index(rb, &index);
filled = 0;
index = 0;
avail = maxsize - filled;
n_bytes = SPA_MIN(avail, n_bytes);
@ -346,7 +344,9 @@ static int make_buffer(struct impl *this)
if (l1 > 0)
this->render_func(this, data, l1);
spa_ringbuffer_write_update(rb, index + n_bytes);
d[0].chunk->offset = index;
d[0].chunk->size = n_bytes;
d[0].chunk->stride = this->bpf;
if (b->h) {
b->h->seq = this->sample_count;