Add support for non period aligned buffers to the buffer free/avail calculation.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- src/include/reef/audio/buffer.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/include/reef/audio/buffer.h b/src/include/reef/audio/buffer.h index 54978a8..83fcd57 100644 --- a/src/include/reef/audio/buffer.h +++ b/src/include/reef/audio/buffer.h @@ -93,7 +93,7 @@ static inline void comp_update_buffer_produce(struct comp_buffer *buffer,
/* check for pointer wrap */ if (buffer->w_ptr >= buffer->end_addr) - buffer->w_ptr = buffer->addr; + buffer->w_ptr = buffer->addr + (buffer->w_ptr - buffer->end_addr);
/* calculate available bytes */ if (buffer->r_ptr < buffer->w_ptr) @@ -127,7 +127,7 @@ static inline void comp_update_buffer_consume(struct comp_buffer *buffer,
/* check for pointer wrap */ if (buffer->r_ptr >= buffer->end_addr) - buffer->r_ptr = buffer->addr; + buffer->r_ptr = buffer->addr + (buffer->r_ptr - buffer->end_addr);
/* calculate available bytes */ if (buffer->r_ptr < buffer->w_ptr)