gstreamer pipewiresrc hangs/blocks with `free_priv_data: object finalizing but still has 1 parents` in `gst_mini_object_remove_parent`
Version, Distribution, Desktop Environment:
> pipewire --version
pipewire
Compiled with libpipewire 0.3.24
Linked with libpipewire 0.3.24
on Arch Linux KDE with Wayland.
Description of Problem:
Using org.freedesktop.portal.ScreenCast
and the pipewire gstreamer plugin to further process the captured video via gstreamers appsink leads to a dead lock inside gst_mini_object_remove_parent
after unrefing the appsink. GStreamer prints the warning free_priv_data: object finalizing but still has 1 parents
.
I have extracted a somewhat minimal example from the project I am working on, that triggers this behavior.
To reproduce it is sufficient to run the linked sample code and select any window/desktop, in my experments the program is guaranteed to hang.
The backtrace I get after interrupting the process:
(gdb) bt
#0 0x00007ffff7e1f429 in gst_mini_object_remove_parent () at /usr/lib/libgstreamer-1.0.so.0
#1 0x00007ffff7e4eec2 in () at /usr/lib/libgstreamer-1.0.so.0
#2 0x00007ffff7f6e5b6 in () at /usr/lib/libgstapp-1.0.so.0
#3 0x00007ffff7d63785 in g_object_unref () at /usr/lib/libgobject-2.0.so.0
#4 0x000055555565a4d2 in glib::object::{{impl}}::drop (self=0x7fffffffd458)
at /home/hmh/.cargo/registry/src/github.com-1ecc6299db9ec823/glib-0.10.3/src/object.rs:421
#5 0x000055555565a34f in core::ptr::drop_in_place<glib::object::ObjectRef> ()
at /home/hmh/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:179
#6 0x000055555565045f in core::ptr::drop_in_place<gstreamer_app::auto::app_sink::AppSink> ()
at /home/hmh/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:179
#7 0x00005555555ac7d0 in core::ptr::drop_in_place<pw_test::pipewire::PipeWireRecorder> ()
at /home/hmh/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:179
#8 0x00005555555a9f7f in pw_test::main () at /home/hmh/test/pw-rs/src/main.rs:29
If always-copy
is set to true
on the pipewiresrc this does not happen.