From 35d932bc8b6944113dd00835701d9ba8bdc48c12 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 1 Aug 2023 15:04:31 +0200 Subject: [PATCH] audioconvert: only dequeue a buffer when queued Add an extra check to only dequeue a buffer when it's queued. This should always be the case but let's check again to be safe. See #3384 --- spa/plugins/audioconvert/audioconvert.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spa/plugins/audioconvert/audioconvert.c b/spa/plugins/audioconvert/audioconvert.c index 7739e1b93..e2fa93ba2 100644 --- a/spa/plugins/audioconvert/audioconvert.c +++ b/spa/plugins/audioconvert/audioconvert.c @@ -2331,10 +2331,12 @@ static inline struct buffer *peek_buffer(struct impl *this, struct port *port) static inline void dequeue_buffer(struct impl *this, struct port *port, struct buffer *b) { - spa_list_remove(&b->link); - SPA_FLAG_CLEAR(b->flags, BUFFER_FLAG_QUEUED); spa_log_trace_fp(this->log, "%p: dequeue buffer %d on port %d %u", this, b->id, port->id, b->flags); + if (!SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_QUEUED)) + return; + spa_list_remove(&b->link); + SPA_FLAG_CLEAR(b->flags, BUFFER_FLAG_QUEUED); } static int