stream: move from dequeued to queued for capture stream flush

When flushing a capture stream we move all dequeued buffers to the
queued queue for recycling. The dequeued queue is filled again when
captured buffers become available. Otherwise we might never recycle
some dequeued buffers.
This commit is contained in:
Wim Taymans 2023-05-02 13:41:00 +02:00
parent b1a80a8f46
commit dd36352a5c

View file

@ -2374,12 +2374,21 @@ do_flush(struct spa_loop *loop,
{
struct stream *impl = user_data;
struct buffer *b;
struct queue *from, *to;
pw_log_trace_fp("%p: flush", impl);
if (impl->direction == SPA_DIRECTION_OUTPUT) {
from = &impl->queued;
to = &impl->dequeued;
} else {
from = &impl->dequeued;
to = &impl->queued;
}
do {
b = queue_pop(impl, &impl->queued);
b = queue_pop(impl, from);
if (b != NULL)
queue_push(impl, &impl->dequeued, b);
queue_push(impl, to, b);
}
while (b);