[bisected] pw_stream_destroy() hangs forever when process callback keeps passing buffers of size 0
I am not sure if this is intended behaviour or not, but since commit 96286fb8 Pipewire hangs forever on pw_stream_destroy()
, if the node is not drained and if the process
callback of the stream keeps passing buffers of size 0.
From the commit message it looks like that behaviour is intended, but maybe there could be functionality in Pipewire that disables the support for buffers of size 0
in impl_node_process()
when we are currently in pw_stream_destroy()
(thus waiting for the node to be drained, which now never happens).
The following patch fixes the problem from Pipewire's side, but obviously also removes support for buffers of size 0:
diff --git a/spa/plugins/audioconvert/resample.c b/spa/plugins/audioconvert/resample.c
index c7ad28955..d6c942907 100644
--- a/spa/plugins/audioconvert/resample.c
+++ b/spa/plugins/audioconvert/resample.c
@@ -1039,7 +1039,7 @@ static int impl_node_process(void *object)
outport->offset = maxsize;
size = sb->datas[0].chunk->size;
- if (size == (uint32_t)-1) {
+ if (size == (uint32_t)-1 || size == 0) {
size = sb->datas[0].maxsize;
memset(sb->datas[0].data, 0, size);
for (i = 0; i < sb->n_datas; i++)
I unfortunately lack the knowledge of the codebase to fix this properly, so if you could lead me in the right direction, that would be great. But again, I am not sure if this is intended behaviour or not.
This problem was encountered in the native Pipewire backend of Mumble, which now hangs forever when quitting Mumble: https://github.com/mumble-voip/mumble/pull/5648