mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
loop: don't recursively flush
If we are already in the loop thread and flushing, this means we added a new invoke item on the list from a callback. Place the item on the queue and let the flush code take care of it after the callback completes. Required to fix some issues with draining in pulse where a stream is destroyed from the drained callback which then invokes a pause.
This commit is contained in:
parent
e9fd38512e
commit
a9c0435317
1 changed files with 5 additions and 1 deletions
|
|
@ -80,6 +80,8 @@ struct impl {
|
|||
|
||||
struct spa_ringbuffer buffer;
|
||||
uint8_t buffer_data[DATAS_SIZE];
|
||||
|
||||
unsigned int flushing:1;
|
||||
};
|
||||
|
||||
struct source_impl {
|
||||
|
|
@ -126,6 +128,7 @@ static void flush_items(struct impl *impl, bool async)
|
|||
uint32_t index;
|
||||
int res;
|
||||
|
||||
impl->flushing = true;
|
||||
while (spa_ringbuffer_get_read_index(&impl->buffer, &index) > 0) {
|
||||
struct invoke_item *item;
|
||||
bool block;
|
||||
|
|
@ -145,6 +148,7 @@ static void flush_items(struct impl *impl, bool async)
|
|||
impl, spa_strerror(res));
|
||||
}
|
||||
}
|
||||
impl->flushing = false;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -161,7 +165,7 @@ loop_invoke(void *object,
|
|||
struct invoke_item *item;
|
||||
int res;
|
||||
|
||||
if (in_thread) {
|
||||
if (in_thread && !impl->flushing) {
|
||||
flush_items(impl, false);
|
||||
res = func ? func(&impl->loop, false, seq, data, size, user_data) : 0;
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue