From 513495eaaa325b918541ea043b710b3fa3f255e6 Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Mon, 4 Dec 2023 20:40:22 +0200 Subject: [PATCH] bluez5: drop queued data on node stop Clear queued buffers when stopping consuming, to ensure that all buffers are usable when we start again. Do for A2DP as we already do for SCO. --- spa/plugins/bluez5/media-sink.c | 3 +++ spa/plugins/bluez5/sco-sink.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/spa/plugins/bluez5/media-sink.c b/spa/plugins/bluez5/media-sink.c index 63d9cd760..1bbbc4875 100644 --- a/spa/plugins/bluez5/media-sink.c +++ b/spa/plugins/bluez5/media-sink.c @@ -1331,6 +1331,9 @@ static int do_remove_transport_source(struct spa_loop *loop, if (this->transport->iso_io) spa_bt_iso_io_set_cb(this->transport->iso_io, NULL, NULL); + /* Drop queued data */ + drop_frames(this, UINT32_MAX); + return 0; } diff --git a/spa/plugins/bluez5/sco-sink.c b/spa/plugins/bluez5/sco-sink.c index 21f98fa1f..860b46042 100644 --- a/spa/plugins/bluez5/sco-sink.c +++ b/spa/plugins/bluez5/sco-sink.c @@ -802,7 +802,7 @@ static int do_remove_transport_source(struct spa_loop *loop, spa_loop_remove_source(this->data_loop, &this->flush_timer_source); enable_flush_timer(this, false); - /* Drop buffered data in the ready queue. Ideally there shouldn't be any. */ + /* Drop queued data */ drop_port_output(this); return 0;