From a592eb60a872dab436656fb07c867cb008574073 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 4 Dec 2020 11:59:40 +0100 Subject: [PATCH] bluez5: fix buffer filled check Just check if the encode buffer is full. The max number of frames has been obtained before. --- spa/plugins/bluez5/a2dp-sink.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/spa/plugins/bluez5/a2dp-sink.c b/spa/plugins/bluez5/a2dp-sink.c index 72cf35947..3f0520034 100644 --- a/spa/plugins/bluez5/a2dp-sink.c +++ b/spa/plugins/bluez5/a2dp-sink.c @@ -61,7 +61,6 @@ struct props { }; #define FILL_FRAMES 2 -#define MAX_FRAME_COUNT 16 #define MAX_BUFFERS 32 struct buffer { @@ -362,11 +361,11 @@ static int encode_buffer(struct impl *this, const void *data, int size) const void *from_data = data; int from_size = size; - spa_log_trace(this->log, NAME " %p: encode %d used %d, %d %d %d/%d", + spa_log_trace(this->log, NAME " %p: encode %d used %d, %d %d %d", this, size, this->buffer_used, port->frame_size, this->block_size, - this->frame_count, MAX_FRAME_COUNT); + this->frame_count); - if (this->frame_count > MAX_FRAME_COUNT) + if (this->buffer_used >= (int)sizeof(this->buffer)) return -ENOSPC; if (size < this->block_size - this->tmp_buffer_used) {