gst-va: deadlock when playing 2 videos at once
Describe your issue
In Identity I have a GstPipeline where I add one separate playbin3 for every opened video. When using VA-API decoding with gst-va, adding a second video causes a deadlock. To make matters worse, it's a main loop deadlock, so it freezes the entire app.
Expected Behavior
Multiple videos work fine.
Observed Behavior
Deadlock.
Setup
- Operating System: Fedora 40 Silverblue
- Device: Computer
- GStreamer Version: 1.24.6-1.fc40
- Command line: N/A
Steps to reproduce the bug
I guess it will be easily reproducible once I update the Identity repository, then it will require building Identity and opening 2 videos in it.
How reproducible is the bug?
Always
Screenshots if relevant
Solutions you have tried
Related non-duplicate issues
Additional Information
#0 syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
#1 0x00007ff3acaf12b2 in g_mutex_lock_slowpath (mutex=0x563f651e2b48) at ../glib/gthread-posix.c:1465
#2 0x00007ff3acaf12e7 in g_mutex_lock (mutex=mutex@entry=0x563f651e2b48) at ../glib/gthread-posix.c:1494
#3 0x00007ff3ac92b640 in gst_object_get_parent (object=object@entry=0x563f651e2b30) at ../gst/gstobject.c:761
#4 0x00007ff3ac92bdab in gst_object_get_path_string (object=0x563f651e2b30) at ../gst/gstobject.c:1008
#5 0x00007ff3ac959f81 in gst_element_message_full_with_details (element=0x7ff21c00c1a0, type=GST_MESSAGE_WARNING, domain=5297, code=4, text=<optimized out>, debug=0x0, file=0x7ff3a094a05c "../sys/va/gstvabasedec.c", function=0x7ff3a09553a0 <__func__.7.lto_priv.1> "gst_va_base_dec_set_context", line=661, structure=0x0) at ../gst/gstelement.c:2270
#6 0x00007ff3ac95a229 in gst_element_message_full (element=element@entry=0x7ff21c00c1a0, type=type@entry=GST_MESSAGE_WARNING, domain=<optimized out>, code=code@entry=4, text=text@entry=0x563f65520570 "Can't replace VA display while operating", debug=debug@entry=0x0, file=0x7ff3a094a05c "../sys/va/gstvabasedec.c", function=0x7ff3a09553a0 <__func__.7.lto_priv.1> "gst_va_base_dec_set_context", line=661) at ../gst/gstelement.c:2345
#7 0x00007ff3a08ffa76 in gst_va_base_dec_set_context (element=0x7ff21c00c1a0, context=0x7ff2941d55d0) at ../sys/va/gstvabasedec.c:661
#8 0x00007ff3ac965cee in foreach_fold_func (item=<optimized out>, unused=<optimized out>, data=<optimized out>) at ../gst/gstiterator.c:647
#9 0x00007ff3ac9692d5 in gst_iterator_fold (it=0x563f66479b70, func=func@entry=0x7ff3ac965ce0 <foreach_fold_func>, ret=ret@entry=0x0, user_data=user_data@entry=0x7fffc56c0ca0) at ../gst/gstiterator.c:618
#10 0x00007ff3ac969345 in gst_iterator_foreach (it=<optimized out>, func=<optimized out>, user_data=<optimized out>) at ../gst/gstiterator.c:674
#11 0x00007ff3ac938f9b in gst_bin_set_context (element=<optimized out>, context=0x7ff2941d55d0) at ../gst/gstbin.c:4356
#12 gst_bin_set_context (element=<optimized out>, context=0x7ff2941d55d0) at ../gst/gstbin.c:4343
#13 0x00007ff3ac965cee in foreach_fold_func (item=<optimized out>, unused=<optimized out>, data=<optimized out>) at ../gst/gstiterator.c:647
#14 0x00007ff3ac9692d5 in gst_iterator_fold (it=0x563f66554de0, func=func@entry=0x7ff3ac965ce0 <foreach_fold_func>, ret=ret@entry=0x0, user_data=user_data@entry=0x7fffc56c0d80) at ../gst/gstiterator.c:618
#15 0x00007ff3ac969345 in gst_iterator_foreach (it=<optimized out>, func=<optimized out>, user_data=<optimized out>) at ../gst/gstiterator.c:674
#16 0x00007ff3ac938f9b in gst_bin_set_context (element=<optimized out>, context=0x7ff2941d55d0) at ../gst/gstbin.c:4356
#17 gst_bin_set_context (element=<optimized out>, context=0x7ff2941d55d0) at ../gst/gstbin.c:4343
#18 0x00007ff3ac965cee in foreach_fold_func (item=<optimized out>, unused=<optimized out>, data=<optimized out>) at ../gst/gstiterator.c:647
#19 0x00007ff3ac9692d5 in gst_iterator_fold (it=0x563f66450420, func=func@entry=0x7ff3ac965ce0 <foreach_fold_func>, ret=ret@entry=0x0, user_data=user_data@entry=0x7fffc56c0e60) at ../gst/gstiterator.c:618
#20 0x00007ff3ac969345 in gst_iterator_foreach (it=<optimized out>, func=<optimized out>, user_data=<optimized out>) at ../gst/gstiterator.c:674
#21 0x00007ff3ac938f9b in gst_bin_set_context (element=<optimized out>, context=0x7ff2941d55d0) at ../gst/gstbin.c:4356
#22 gst_bin_set_context (element=<optimized out>, context=0x7ff2941d55d0) at ../gst/gstbin.c:4343
#23 0x00007ff3ac93563c in gst_bin_add_func (bin=0x563f651e2b30, element=0x563f664a6f40) at ../gst/gstbin.c:1238
#24 0x00007ff3ac92fedf in gst_bin_add (bin=0x563f651e2b30, element=0x563f664a6f40) at ../gst/gstbin.c:1530
#25 0x0000563f3d301fe5 in gstreamer::auto::bin::GstBinExt::add<gstreamer::auto::pipeline::Pipeline, gstreamer::auto::element::Element> (self=0x563f6514f840, element=0x7fffc56c1148) at build/cargo-home/registry/src/index.crates.io-6f17d22bba15001f/gstreamer-0.23.0/src/auto/bin.rs:40
#26 identity::player::imp::Player::attach_source (self=0x563f6514f840, source=0x7fffc56c1148) at src/player.rs:299
#27 0x0000563f3d37a815 in identity::player::Player::attach_source (source=0x7fffc56c1148, self=<optimized out>) at src/player.rs:529
#28 identity::window::imp::{impl#31}::on_page_attached::{closure#5} (page=0x7fffc56c1178) at src/window.rs:827
#29 identity::page::imp::{impl#8}::connect_is_loading_notify::{closure#0}<identity::window::imp::{impl#31}::on_page_attached::{closure_env#5}> (this=0x7fffc56c1178) at src/page.rs:60
#30 glib::object::{impl#32}::connect_notify_local::{closure#0}<identity::page::Page, identity::page::imp::{impl#8}::connect_is_loading_notify::{closure_env#0}<identity::window::imp::{impl#31}::on_page_attached::{closure_env#5}>> (s=0x7fffc56c1178, pspec=<optimized out>) at build/cargo-home/registry/src/index.crates.io-6f17d22bba15001f/glib-0.20.0/src/object.rs:3040
#31 glib::object::{impl#32}::connect_notify_unsafe::notify_trampoline<identity::page::Page, glib::object::{impl#32}::connect_notify_local::{closure_env#0}<identity::page::Page, identity::page::imp::{impl#8}::connect_is_loading_notify::{closure_env#0}<identity::window::imp::{impl#31}::on_page_attached::{closure_env#5}>>> (this=<optimized out>, param_spec=<optimized out>, f=<optimized out>) at build/cargo-home/registry/src/index.crates.io-6f17d22bba15001f/glib-0.20.0/src/object.rs:3058
#32 0x00007ff3acb9f64a in g_closure_invoke (closure=0x563f662ef310, return_value=0x0, n_param_values=2, param_values=0x7fffc56c1390, invocation_hint=0x7fffc56c12e0) at ../gobject/gclosure.c:834
#33 0x00007ff3acbcf5f3 in signal_emit_unlocked_R.isra.0 (node=node@entry=0x7fffc56c1490, detail=detail@entry=4085, instance=instance@entry=0x563f665f4b40, emission_return=emission_return@entry=0x0, instance_and_params=instance_and_params@entry=0x7fffc56c1390) at ../gobject/gsignal.c:3888
#34 0x00007ff3acbc0104 in signal_emit_valist_unlocked (instance=instance@entry=0x563f665f4b40, signal_id=signal_id@entry=1, detail=detail@entry=4085, var_args=var_args@entry=0x7fffc56c1600) at ../gobject/gsignal.c:3520
#35 0x00007ff3acbc0361 in g_signal_emit_valist (instance=0x563f665f4b40, signal_id=1, detail=4085, var_args=var_args@entry=0x7fffc56c1600) at ../gobject/gsignal.c:3263
#36 0x00007ff3acbc0423 in g_signal_emit (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>) at ../gobject/gsignal.c:3583
#37 0x00007ff3acbab7b4 in g_object_dispatch_properties_changed (object=0x563f665f4b40, n_pspecs=<optimized out>, pspecs=<optimized out>) at ../gobject/gobject.c:1819
#38 0x00007ff3acb9ff1f in g_object_notify_queue_thaw (object=0x563f665f4b40, nqueue=<optimized out>, take_ref=1) at ../gobject/gobject.c:755
#39 0x0000563f3d2cff90 in glib::object::{impl#31}::drop (self=<optimized out>) at build/cargo-home/registry/src/index.crates.io-6f17d22bba15001f/glib-0.20.0/src/object.rs:1646
#40 core::ptr::drop_in_place<glib::object::PropertyNotificationFreezeGuard> () at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/core/src/ptr/mod.rs:542
#41 0x0000563f3d2db0d5 in identity::page::imp::Page::on_bus_message (self=<optimized out>, msg=<optimized out>) at src/page.rs:515
#42 0x0000563f3d3bbb47 in identity::page::imp::{impl#20}::prepare_playbin::{closure#5} (msg=0x7fffc56c19e0) at src/page.rs:426
#43 gstreamer::bus::trampoline_watch_local<identity::page::imp::{impl#20}::prepare_playbin::{closure_env#5}> (bus=<optimized out>, msg=0x7ff1e000aca0, func=<optimized out>) at build/cargo-home/registry/src/index.crates.io-6f17d22bba15001f/gstreamer-0.23.0/src/bus.rs:53
#44 0x00007ff3ac942c07 in gst_bus_source_dispatch (source=0x563f665e77f0, callback=0x563f3d3bbaf0 <gstreamer::bus::trampoline_watch_local<identity::page::imp::{impl#20}::prepare_playbin::{closure_env#5}>>, user_data=0x563f66367740) at ../gst/gstbus.c:834
#45 0x00007ff3aca9ce8c in g_main_dispatch (context=0x563f6507b4d0) at ../glib/gmain.c:3344
#46 g_main_context_dispatch_unlocked (context=0x563f6507b4d0) at ../glib/gmain.c:4152
#47 0x00007ff3acafec98 in g_main_context_iterate_unlocked.isra.0 (context=context@entry=0x563f6507b4d0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:4217
#48 0x00007ff3aca9e383 in g_main_context_iteration (context=context@entry=0x563f6507b4d0, may_block=may_block@entry=1) at ../glib/gmain.c:4282
#49 0x00007ff3ab9290fd in g_application_run (application=0x563f650710f0, argc=<optimized out>, argv=0x563f6507b430) at ../gio/gapplication.c:2712
#50 0x0000563f3d379fd0 in gio::application::ApplicationExtManual::run_with_args<identity::application::Application, alloc::string::String> (args=..., self=<optimized out>) at build/cargo-home/registry/src/index.crates.io-6f17d22bba15001f/gio-0.20.0/src/application.rs:29
#51 gio::application::ApplicationExtManual::run<identity::application::Application> (self=<optimized out>) at build/cargo-home/registry/src/index.crates.io-6f17d22bba15001f/gio-0.20.0/src/application.rs:22
#52 0x0000563f3d301016 in identity::main () at src/main.rs:109