mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-17 08:56:49 -05:00
module-combine-stream: fix race when destroying streams
Use separate flag for indicating if pw_stream_destroy is needed. Don't set s->stream = NULL to indicate that, it will race with data loop. Setting to null separately is not needed, removing from the stream list is enough.
This commit is contained in:
parent
12b6adb10c
commit
2a0f1597ab
1 changed files with 8 additions and 4 deletions
|
|
@ -613,13 +613,13 @@ static int do_remove_stream(struct spa_loop *loop, bool async, uint32_t seq,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void destroy_stream(struct stream *s)
|
static void remove_stream(struct stream *s, bool destroy)
|
||||||
{
|
{
|
||||||
pw_log_debug("destroy stream %d", s->id);
|
pw_log_debug("destroy stream %d", s->id);
|
||||||
|
|
||||||
pw_data_loop_invoke(s->impl->data_loop, do_remove_stream, 0, NULL, 0, true, s);
|
pw_data_loop_invoke(s->impl->data_loop, do_remove_stream, 0, NULL, 0, true, s);
|
||||||
|
|
||||||
if (s->stream) {
|
if (destroy && s->stream) {
|
||||||
spa_hook_remove(&s->stream_listener);
|
spa_hook_remove(&s->stream_listener);
|
||||||
pw_stream_destroy(s->stream);
|
pw_stream_destroy(s->stream);
|
||||||
}
|
}
|
||||||
|
|
@ -628,12 +628,16 @@ static void destroy_stream(struct stream *s)
|
||||||
free(s);
|
free(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void destroy_stream(struct stream *s)
|
||||||
|
{
|
||||||
|
remove_stream(s, true);
|
||||||
|
}
|
||||||
|
|
||||||
static void stream_destroy(void *d)
|
static void stream_destroy(void *d)
|
||||||
{
|
{
|
||||||
struct stream *s = d;
|
struct stream *s = d;
|
||||||
spa_hook_remove(&s->stream_listener);
|
spa_hook_remove(&s->stream_listener);
|
||||||
s->stream = NULL;
|
remove_stream(s, false);
|
||||||
destroy_stream(s);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void stream_input_process(void *d)
|
static void stream_input_process(void *d)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue