Commit graph

21 commits

Author SHA1 Message Date
Thibault Saunier
e17c7a0b7f playbin3: Fix deadlock while selecting streams going to playing
In the following backtrace for the deadlock, we can see that:

- In T8 `uridecodebin3` is exposing a new pad, in `pad_added_cb`,
  `playbin3` is trying to get `GST_PLAY_BIN3_LOCK` in the callback. This
  threads holds its `SELECTION_LOCK` in F17 `reconfigure_output_stream`,
  which is looks right `decodebin3` is handling its selection state
  in that code path

- In T7 `playbin3` holds the `GST_PLAY_BIN3_LOCK` when calling
  `gst_element_post_message` in `gst_play_bin3_send_event` which is
  not necessary in that section of the code.

``` bt
Thread 8 (Thread 0x7f0b78ee36c0 (LWP 2952467) "multiqueue0:src"):
 #0  futex_wait (private=0, expected=2, futex_word=0x1fa6d60) at ../sysdeps/nptl/futex-internal.h:146
 #1  __GI___lll_lock_wait (futex=futex@entry=0x1fa6d60, private=0) at lowlevellock.c:49
 #2  0x00007f0b858cd46a in lll_mutex_lock_optimized (mutex=0x1fa6d60) at pthread_mutex_lock.c:48
 #3  ___pthread_mutex_lock (mutex=0x1fa6d60) at pthread_mutex_lock.c:128
 #4  0x00007f0b7e665720 in pad_added_cb (uridecodebin=0x1fb4050, pad=0x7f0b54022060, playbin=0x1fb00e0) at ../subprojects/gst-plugins-base/gst/playback/gstplaybin3.c:2463
 #5  0x00007f0b85c00060 in g_closure_invoke (closure=0x1fa9eb0, return_value=0x0, n_param_values=2, param_values=0x7f0b78ee1dd0, invocation_hint=0x7f0b78ee1d50) at ../gobject/gclosure.c:832
 #6  0x00007f0b85c2cf66 in signal_emit_unlocked_R.isra.0 (node=node@entry=0x1c5bf30, detail=detail@entry=0, instance=instance@entry=0x1fb4050, emission_return=emission_return@entry=0x0, instance_and_params=instance_and_params@entry=0x7f0b78ee1dd0) at ../gobject/gsignal.c:3796
 #7  0x00007f0b85c1d4da in g_signal_emit_valist (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>, var_args=var_args@entry=0x7f0b78ee1f90) at ../gobject/gsignal.c:3549
 #8  0x00007f0b85c1d6f3 in g_signal_emit (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>) at ../gobject/gsignal.c:3606
 #9  0x00007f0b85e20c3e in gst_element_add_pad (element=0x1fb4050, pad=0x7f0b54022060) at ../subprojects/gstreamer/gst/gstelement.c:802
 #10 0x00007f0b7e632620 in add_output_pad (dec=0x1fb4050, target_pad=0x7f0b6400fda0) at ../subprojects/gst-plugins-base/gst/playback/gsturidecodebin3.c:717
 #11 0x00007f0b7e632788 in db_pad_added_cb (element=0x1fb8020, pad=0x7f0b6400fda0, dec=0x1fb4050) at ../subprojects/gst-plugins-base/gst/playback/gsturidecodebin3.c:736
 #12 0x00007f0b85c00060 in g_closure_invoke (closure=0x1fb7fc0, return_value=0x0, n_param_values=2, param_values=0x7f0b78ee2300, invocation_hint=0x7f0b78ee2280) at ../gobject/gclosure.c:832
 #13 0x00007f0b85c2cf66 in signal_emit_unlocked_R.isra.0 (node=node@entry=0x1c5bf30, detail=detail@entry=0, instance=instance@entry=0x1fb8020, emission_return=emission_return@entry=0x0, instance_and_params=instance_and_params@entry=0x7f0b78ee2300) at ../gobject/gsignal.c:3796
 #14 0x00007f0b85c1d4da in g_signal_emit_valist (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>, var_args=var_args@entry=0x7f0b78ee24c0) at ../gobject/gsignal.c:3549
 #15 0x00007f0b85c1d6f3 in g_signal_emit (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>) at ../gobject/gsignal.c:3606
 #16 0x00007f0b85e20c3e in gst_element_add_pad (element=0x1fb8020, pad=0x7f0b6400fda0) at ../subprojects/gstreamer/gst/gstelement.c:802
 #17 0x00007f0b7e6260b4 in reconfigure_output_stream (output=0x7f0b5400def0, slot=0x7f0b64013dd0, msg=0x7f0b78ee26b8) at ../subprojects/gst-plugins-base/gst/playback/gstdecodebin3.c:3086
 #18 0x00007f0b7e623700 in check_slot_reconfiguration (dbin=0x1fb8020, slot=0x7f0b64013dd0) at ../subprojects/gst-plugins-base/gst/playback/gstdecodebin3.c:2455
 #19 0x00007f0b7e623e62 in multiqueue_src_probe (pad=0x7f0b6001e600, info=0x7f0b78ee2930, slot=0x7f0b64013dd0) at ../subprojects/gst-plugins-base/gst/playback/gstdecodebin3.c:2544
 #20 0x00007f0b85e53aaa in probe_hook_marshal (hook=0x7f0b74040500, data=0x7f0b78ee28c0) at ../subprojects/gstreamer/gst/gstpad.c:3669
 #21 0x00007f0b85c88a3e in g_hook_list_marshal (hook_list=0x7f0b6001e698, may_recurse=1, marshaller=0x7f0b85e53786 <probe_hook_marshal>, data=0x7f0b78ee28c0) at ../glib/ghook.c:674
 #22 0x00007f0b85e541be in do_probe_callbacks (pad=0x7f0b6001e600, info=0x7f0b78ee2930, defaultval=GST_FLOW_OK) at ../subprojects/gstreamer/gst/gstpad.c:3853
 #23 0x00007f0b85e5ac9c in gst_pad_push_event_unchecked (pad=0x7f0b6001e600, event=0x7f0b64002120, type=GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM) at ../subprojects/gstreamer/gst/gstpad.c:5538
 #24 0x00007f0b85e54bc2 in push_sticky (pad=0x7f0b6001e600, ev=0x7f0b78ee2a60, user_data=0x7f0b78ee2ac0) at ../subprojects/gstreamer/gst/gstpad.c:4057
 #25 0x00007f0b85e4a13c in events_foreach (pad=0x7f0b6001e600, func=0x7f0b85e54a8e <push_sticky>, user_data=0x7f0b78ee2ac0) at ../subprojects/gstreamer/gst/gstpad.c:613
 #26 0x00007f0b85e54f91 in check_sticky (pad=0x7f0b6001e600, event=0x7f0b64002120) at ../subprojects/gstreamer/gst/gstpad.c:4116
 #27 0x00007f0b85e5b65e in gst_pad_push_event (pad=0x7f0b6001e600, event=0x7f0b64002120) at ../subprojects/gstreamer/gst/gstpad.c:5706
 #28 0x00007f0b7e5888e7 in gst_single_queue_push_one (mq=0x1fbb000, sq=0x7f0b64013b70, object=0x7f0b64002120, allow_drop=0x7f0b78ee2c3c) at ../subprojects/gstreamer/plugins/elements/gstmultiqueue.c:2068
 #29 0x00007f0b7e58a1bc in gst_multi_queue_loop (pad=0x7f0b6001e600) at ../subprojects/gstreamer/plugins/elements/gstmultiqueue.c:2347
 #30 0x00007f0b85e96a36 in gst_task_func (task=0x7f0b64016050) at ../subprojects/gstreamer/gst/gsttask.c:399
 #31 0x00007f0b85e97e41 in default_func (tdata=0x7f0b640138d0, pool=0x1fbe9c0) at ../subprojects/gstreamer/gst/gsttaskpool.c:70
 #32 0x00007f0b85cd1ab2 in g_thread_pool_thread_proxy (data=<optimized out>) at ../glib/gthreadpool.c:352
 #33 0x00007f0b85ccc982 in g_thread_proxy (data=0x7f0b6006f640) at ../glib/gthread.c:831
 #34 0x00007f0b858ca12d in start_thread (arg=<optimized out>) at pthread_create.c:442
 #35 0x00007f0b8594bbc0 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

Thread 7 (Thread 0x7f0b7a7646c0 (LWP 2952434) "multiqueue3:src"):
 #0  syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
 #1  0x00007f0b85cf470c in g_mutex_lock_slowpath (mutex=0x1fb81d0) at ../glib/gthread-posix.c:1494
 #2  0x00007f0b7e6281a2 in gst_decodebin3_send_event (element=0x1fb8020, event=0x7f0b6800a650) at ../subprojects/gst-plugins-base/gst/playback/gstdecodebin3.c:3561
 #3  0x00007f0b85e23ca3 in gst_element_send_event (element=0x1fb8020, event=0x7f0b6800a650) at ../subprojects/gstreamer/gst/gstelement.c:1994
 #4  0x00007f0b7e63806b in gst_uri_decodebin3_send_event (element=0x1fb4050, event=0x7f0b6800a650) at ../subprojects/gst-plugins-base/gst/playback/gsturidecodebin3.c:2227
 #5  0x00007f0b85e23ca3 in gst_element_send_event (element=0x1fb4050, event=0x7f0b6800a650) at ../subprojects/gstreamer/gst/gstelement.c:1994
 #6  0x00007f0b7e66375a in gst_play_bin3_send_event (element=0x1fb00e0, event=0x7f0b6800a650) at ../subprojects/gst-plugins-base/gst/playback/gstplaybin3.c:1863
 #7  0x00007f0b85e23ca3 in gst_element_send_event (element=0x1fb00e0, event=0x7f0b6800a650) at ../subprojects/gstreamer/gst/gstelement.c:1994
 #8  0x00007f0b85f61b5b in stream_selection_cb (bus=0x1dc2d80, message=0x7f0b68008b00, d=0x1d7de30) at ../subprojects/gst-devtools/validate/gst/validate/gst-validate-scenario.c:2235
 #9  0x00007f0b85c00060 in g_closure_invoke (closure=0x1d2a5b0, return_value=0x0, n_param_values=2, param_values=0x7f0b7a7627b0, invocation_hint=0x7f0b7a762730) at ../gobject/gclosure.c:832
 #10 0x00007f0b85c2cf66 in signal_emit_unlocked_R.isra.0 (node=node@entry=0x1c5e5f0, detail=detail@entry=235, instance=instance@entry=0x1dc2d80, emission_return=emission_return@entry=0x0, instance_and_params=instance_and_params@entry=0x7f0b7a7627b0) at ../gobject/gsignal.c:3796
 #11 0x00007f0b85c1d4da in g_signal_emit_valist (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>, var_args=var_args@entry=0x7f0b7a762970) at ../gobject/gsignal.c:3549
 #12 0x00007f0b85c1d6f3 in g_signal_emit (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>) at ../gobject/gsignal.c:3606
 #13 0x00007f0b85e05be9 in gst_bus_sync_signal_handler (bus=0x1dc2d80, message=0x7f0b68008b00, data=0x0) at ../subprojects/gstreamer/gst/gstbus.c:1307
 #14 0x00007f0b85e03834 in gst_bus_post (bus=0x1dc2d80, message=0x7f0b68008b00) at ../subprojects/gstreamer/gst/gstbus.c:364
 #15 0x00007f0b85e2436c in gst_element_post_message_default (element=0x1fb00e0, message=0x7f0b68008b00) at ../subprojects/gstreamer/gst/gstelement.c:2127
 #16 0x00007f0b85df42b1 in gst_bin_post_message (element=0x1fb00e0, msg=0x7f0b68008b00) at ../subprojects/gstreamer/gst/gstbin.c:2789
 #17 0x00007f0b85e24627 in gst_element_post_message (element=0x1fb00e0, message=0x7f0b68008b00) at ../subprojects/gstreamer/gst/gstelement.c:2170
 #18 0x00007f0b85df7c12 in gst_bin_handle_message_func (bin=0x1fb00e0, message=0x7f0b68008b00) at ../subprojects/gstreamer/gst/gstbin.c:4041
 #19 0x00007f0b85e61bd3 in gst_pipeline_handle_message (bin=0x1fb00e0, message=0x7f0b68008b00) at ../subprojects/gstreamer/gst/gstpipeline.c:669
 #20 0x00007f0b7e663fa4 in gst_play_bin3_handle_message (bin=0x1fb00e0, msg=0x7f0b68008b00) at ../subprojects/gst-plugins-base/gst/playback/gstplaybin3.c:2030
 #21 0x00007f0b85df5a98 in bin_bus_handler (bus=0x1dc2cc0, message=0x7f0b68008b00, bin=0x1fb00e0) at ../subprojects/gstreamer/gst/gstbin.c:3263
 #22 0x00007f0b85e037f1 in gst_bus_post (bus=0x1dc2cc0, message=0x7f0b68008b00) at ../subprojects/gstreamer/gst/gstbus.c:357
 #23 0x00007f0b85e2436c in gst_element_post_message_default (element=0x1fb4050, message=0x7f0b68008b00) at ../subprojects/gstreamer/gst/gstelement.c:2127
 #24 0x00007f0b85df42b1 in gst_bin_post_message (element=0x1fb4050, msg=0x7f0b68008b00) at ../subprojects/gstreamer/gst/gstbin.c:2789
 #25 0x00007f0b85e24627 in gst_element_post_message (element=0x1fb4050, message=0x7f0b68008b00) at ../subprojects/gstreamer/gst/gstelement.c:2170
 #26 0x00007f0b85df7c12 in gst_bin_handle_message_func (bin=0x1fb4050, message=0x7f0b68008b00) at ../subprojects/gstreamer/gst/gstbin.c:4041
 #27 0x00007f0b7e638005 in gst_uri_decode_bin3_handle_message (bin=0x1fb4050, msg=0x7f0b68008b00) at ../subprojects/gst-plugins-base/gst/playback/gsturidecodebin3.c:2218
 #28 0x00007f0b85df5a98 in bin_bus_handler (bus=0x1dc2e40, message=0x7f0b68008b00, bin=0x1fb4050) at ../subprojects/gstreamer/gst/gstbin.c:3263
 #29 0x00007f0b85e037f1 in gst_bus_post (bus=0x1dc2e40, message=0x7f0b68008b00) at ../subprojects/gstreamer/gst/gstbus.c:357
 #30 0x00007f0b85e2436c in gst_element_post_message_default (element=0x1fb8020, message=0x7f0b68008b00) at ../subprojects/gstreamer/gst/gstelement.c:2127
 #31 0x00007f0b85df42b1 in gst_bin_post_message (element=0x1fb8020, msg=0x7f0b68008b00) at ../subprojects/gstreamer/gst/gstbin.c:2789
 #32 0x00007f0b85e24627 in gst_element_post_message (element=0x1fb8020, message=0x7f0b68008b00) at ../subprojects/gstreamer/gst/gstelement.c:2170
 #33 0x00007f0b7e61ee43 in sink_event_function (sinkpad=0x7f0b6400f8c0, dbin=0x1fb8020, event=0x7f0b6c097870) at ../subprojects/gst-plugins-base/gst/playback/gstdecodebin3.c:1450
 #34 0x00007f0b85f51122 in gst_validate_pad_monitor_downstream_event_check (pad_monitor=0x7f0b6c094a80, parent=0x1fb8020, event=0x7f0b6c097870, handler=0x7f0b7e61e797 <sink_event_function>) at ../subprojects/gst-devtools/validate/gst/validate/gst-validate-pad-monitor.c:2101
 #35 0x00007f0b85f535bf in gst_validate_pad_monitor_sink_event_full_func (pad=0x7f0b6400f8c0, parent=0x1fb8020, event=0x7f0b6c097870) at ../subprojects/gst-devtools/validate/gst/validate/gst-validate-pad-monitor.c:2406
 #36 0x00007f0b85f537fa in gst_validate_pad_monitor_sink_event_func (pad=0x7f0b6400f8c0, parent=0x1fb8020, event=0x7f0b6c097870) at ../subprojects/gst-devtools/validate/gst/validate/gst-validate-pad-monitor.c:2418
 #37 0x00007f0b85e5c523 in gst_pad_send_event_unchecked (pad=0x7f0b6400f8c0, event=0x7f0b6c097870, type=GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM) at ../subprojects/gstreamer/gst/gstpad.c:5940
 #38 0x00007f0b85e5ae65 in gst_pad_push_event_unchecked (pad=0x7f0b6400f650, event=0x7f0b6c097870, type=GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM) at ../subprojects/gstreamer/gst/gstpad.c:5573
 #39 0x00007f0b85e54bc2 in push_sticky (pad=0x7f0b6400f650, ev=0x7f0b7a763620, user_data=0x7f0b7a763680) at ../subprojects/gstreamer/gst/gstpad.c:4057
 #40 0x00007f0b85e4a13c in events_foreach (pad=0x7f0b6400f650, func=0x7f0b85e54a8e <push_sticky>, user_data=0x7f0b7a763680) at ../subprojects/gstreamer/gst/gstpad.c:613
 #41 0x00007f0b85e54f91 in check_sticky (pad=0x7f0b6400f650, event=0x7f0b6c097870) at ../subprojects/gstreamer/gst/gstpad.c:4116
 #42 0x00007f0b85e5b65e in gst_pad_push_event (pad=0x7f0b6400f650, event=0x7f0b6c097870) at ../subprojects/gstreamer/gst/gstpad.c:5706
 #43 0x00007f0b85e523e7 in event_forward_func (pad=0x7f0b6400f650, data=0x7f0b7a763820) at ../subprojects/gstreamer/gst/gstpad.c:3130
 #44 0x00007f0b85e521e3 in gst_pad_forward (pad=0x7f0b6004f180, forward=0x7f0b85e522bd <event_forward_func>, user_data=0x7f0b7a763820) at ../subprojects/gstreamer/gst/gstpad.c:3084
 #45 0x00007f0b85e525ab in gst_pad_event_default (pad=0x7f0b6004f180, parent=0x7f0b6400f650, event=0x7f0b6c097870) at ../subprojects/gstreamer/gst/gstpad.c:3181
 #46 0x00007f0b85e5c523 in gst_pad_send_event_unchecked (pad=0x7f0b6004f180, event=0x7f0b6c097870, type=GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM) at ../subprojects/gstreamer/gst/gstpad.c:5940
 #47 0x00007f0b85e5ae65 in gst_pad_push_event_unchecked (pad=0x7f0b64008360, event=0x7f0b6c097870, type=GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM) at ../subprojects/gstreamer/gst/gstpad.c:5573
 #48 0x00007f0b85e54bc2 in push_sticky (pad=0x7f0b64008360, ev=0x7f0b7a763a60, user_data=0x7f0b7a763ac0) at ../subprojects/gstreamer/gst/gstpad.c:4057
 #49 0x00007f0b85e4a13c in events_foreach (pad=0x7f0b64008360, func=0x7f0b85e54a8e <push_sticky>, user_data=0x7f0b7a763ac0) at ../subprojects/gstreamer/gst/gstpad.c:613
 #50 0x00007f0b85e54f91 in check_sticky (pad=0x7f0b64008360, event=0x7f0b6c097870) at ../subprojects/gstreamer/gst/gstpad.c:4116
 #51 0x00007f0b85e5b65e in gst_pad_push_event (pad=0x7f0b64008360, event=0x7f0b6c097870) at ../subprojects/gstreamer/gst/gstpad.c:5706
 #52 0x00007f0b7e5888e7 in gst_single_queue_push_one (mq=0x7f0b60076540, sq=0x7f0b6c093300, object=0x7f0b6c097870, allow_drop=0x7f0b7a763c3c) at ../subprojects/gstreamer/plugins/elements/gstmultiqueue.c:2068
 #53 0x00007f0b7e58a1bc in gst_multi_queue_loop (pad=0x7f0b64008360) at ../subprojects/gstreamer/plugins/elements/gstmultiqueue.c:2347
 #54 0x00007f0b85e96a36 in gst_task_func (task=0x7f0b6c072050) at ../subprojects/gstreamer/gst/gsttask.c:399
 #55 0x00007f0b85e97e41 in default_func (tdata=0x7f0b6c093ef0, pool=0x1fbe9c0) at ../subprojects/gstreamer/gst/gsttaskpool.c:70
 #56 0x00007f0b85cd1ab2 in g_thread_pool_thread_proxy (data=<optimized out>) at ../glib/gthreadpool.c:352
 #57 0x00007f0b85ccc982 in g_thread_proxy (data=0x7f0b70033800) at ../glib/gthread.c:831
 #58 0x00007f0b858ca12d in start_thread (arg=<optimized out>) at pthread_create.c:442
 #59 0x00007f0b8594bbc0 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
```

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5982>
2024-01-29 19:46:45 +00:00
Edward Hervey
133c4b2ff9 uridecodebin3: Handle redirection errors
This is done by doing an immediate switch to the redirection URI if compatible.

Fixes #1562

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4242>
2023-03-22 11:28:47 +00:00
Tim-Philipp Müller
165fdac5c6 playback: drop use of GSlice
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3695>
2023-01-24 15:25:06 +00:00
Edward Hervey
4c1d01ff57 playback: New playback elements are no longer experimental
The API is not expected to change and it has been used extensively since 1.18.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3761>
2023-01-21 12:28:21 +00:00
Edward Hervey
6bffbe283a playbin3: Move gapless to uridecodebin3
This was the intention from the start, just took me a few years *cough* to
actually implement it properly.

Gapless is handled by re-using as much as possible the same decoders and sinks
if present, and only pre-rolling switching at the sources level (with buffering
if/when needed).

In order to enable "gapless" playback, the "next" uri should be set at any time
between the moment the `about-to-finish` signal is emitted and the moment the
current play item is done. Previously this could only be done with the signal
emission.

This new implementation also allows "Instantaneous URI switching". This allows a
much faster way of switching playback entries while re-using as many elements as
possible. To enable this set `instant-uri` property to TRUE, the default being
FALSE.

API: instant-uri properties
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2784>
2022-11-16 14:01:47 +00:00
Edward Hervey
1f2d98028b playbin3: Remove unused code
This was never used, and if ever it's needed at some point for reference it's
available in gstplaybin.c

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2784>
2022-11-16 14:01:47 +00:00
Sanchayan Maity
673d13f176 playbin3: Fix missing pad unref
GST_TRACERS="leaks" GST_DEBUG="GST_TRACER:7,leaks:6" gst-play-1.0 --use-playbin3 test.mkv

When running a pipeline like above, leaks are observed.

0:00:56.882419132 240637 0x5562c528ccc0 TRACE             GST_TRACER :0:: object-alive, type-name=(string)GstConcatPad, address=(gpointer)0x7efd7c0d20a0, description=(string)<'':sink_0>, ref-count=(uint)1, trace=(string);
0:00:56.882429131 240637 0x5562c528ccc0 TRACE             GST_TRACER :0:: object-alive, type-name=(string)GstConcatPad, address=(gpointer)0x7efd7c0d2be0, description=(string)<'':sink_0>, ref-count=(uint)1, trace=(string);
0:00:56.882437056 240637 0x5562c528ccc0 TRACE             GST_TRACER :0:: object-alive, type-name=(string)GstConcatPad, address=(gpointer)0x7efd7c0d3720, description=(string)<'':sink_0>, ref-count=(uint)1, trace=(string);

gst_element_release_request_pad does not unref the pad. It needs to
be followed by gst_object_unref. Doing that fixes the above leaks.

Use g_ptr_array_new_with_free_func with gst_object_unref as the free
function to unref the pad after release.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3177>
2022-10-28 10:15:42 +05:30
Seungha Yang
b91093a2e6 playbin3: Configure combiner on pad-added if needed
When collection is updated, decodebin3 exposes pad first and then
streams-selected message is posted.
The condition can cause a situation where playbin3 links non-existing
combiner/playsink pads (since streams-selected is not posted yet) with
new decodebin output pad. This commit will re-check selected/active
streams condition on pad-added and reconfigure output if needed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2482>
2022-05-25 13:50:17 +00:00
Edward Hervey
53bb864244 playbin3: Cleanup and refactor combiner sourcecombine
* Remove fields no longer used, or that can be replaced by smaller code
* Rename "channels" to a more meaningful "input pads"
* Directly handle/use combiner pads in the combiners instead of on the playbin3
  main structure

Remove the corresponding combiner sinkpad whenever a uridecodebin3 source pad
goes away
* If used, store the corresponding combiner sink pad in the SourcePad helper
  structure

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2384>
2022-05-06 09:10:09 +02:00
Xavier Claessens
b99ecc78ca Replace gst-i18n-*.h with gi18n-lib.h
GLib guarantees libintl is always present, using proxy-libintl as
last resort. There is no need to mock gettex API any more.

This fix static build on Windows because G_INTL_STATIC_COMPILATION must
be defined before including libintl.h, and glib does it for us as part
as including glib.h.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2028>
2022-04-19 18:01:06 +00:00
hoonhee.lee
3d9f25d322 playbin3: fix missing lock when unknown stream type in pad-removed cb
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2193>
2022-04-16 01:31:18 +00:00
Sebastian Dröge
16ed0a6961 playbin/playbin3: Allow setting a NULL URI
The URI is already initialized to NULL at the beginning and GstPlayer
was assuming that it is possible to set to NULL at a later time too.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1124

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2090>
2022-04-01 10:25:23 +03:00
Vivienne Watermeier
6c2f6c3bd4 all: Use new navigation interface and API
Use and implement the new navigation interface in all relevant sink elements,
and use API functions everywhere instead of directy accessing the event structure.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1633>
2022-03-23 13:14:52 +00:00
Jan Schmidt
90426f5751 playbin3: Remove stale code
Remove now-unused get_stream_type_for_event() function.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1900>
2022-03-11 15:02:02 +01:00
Jan Schmidt
52d9614d47 playbin3: Hold playbin lock on pad-added
Take the playbin lock when accessing the combiner
to add a new pad to link to. Fixes races against
streams-selected messages triggering reconfiguration.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1900>
2022-03-11 15:02:02 +01:00
Jan Schmidt
9ebb4505db playbin3: Reconfigure on streams-selected message.
Don't reconfigure outputs when the select-streams
event is sent from the app, as the selection may
not take effect for some time. Instead, wait
for the pipeline to confirm the new set of
selected streams when it sends the message.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1900>
2022-03-11 15:02:01 +01:00
Jan Schmidt
17f11c2cda playbin3: Add lock to protect buffering messages
Fix a small race where a group can receive stream-start
and post a pending buffering message just as another
thread posts a different buffering message, causing them
to be received by the application out of order. In the
worst case, this leads the application receiving a
stale 99% buffering message and going back to buffering
right after the 100% buffering message.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1840>
2022-03-08 16:56:16 +00:00
Matthew Waters
42597181e2 playbin2/3: autoplug/caps: don't expand caps to ANY
Retrieving the pad template caps from a ghost pad returns ANY which when
merged with any other caps will return ANY.  ANY is not very specific
and may cause suboptimal code paths in e.g. decoders that assume the
lowest common denominator when presented with ANY caps.

Fixes negotiating dma-buf with vaapidecodebin between glupload in the
video sink element.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1144>
2021-10-14 17:04:26 +11:00
Jan Schmidt
e06ac494b8 playbin3: Always register 'playbin3' element.
If the USE_PLAYBIN3=1 env var is set, we want to replace
playbin with playbin3, but separate to that, we always
want to register the 'playbin3' element so that applications
which explicitly use playbin3 work regardless of the env var.

This fixes `USE_PLAYBIN3=1 gst-validate-launcher`, for example.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1102>
2021-10-10 07:28:17 +00:00
Jan Schmidt
33ad1cdc5e playbin3: Avoid group deactivation deadlock.
Change locking around group deactivation to avoid deadlocks
when shutting down exactly as a buffering message arrives.

The PLAYBIN3_LOCK now protects the active field of the
source group. Everything else is still protected by the
source-group-lock.

Also properly protect group switching operations with
the PLAYBIN3_LOCK everywhere.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1049>
2021-10-08 15:49:41 +00:00
Thibault Saunier
2fd28195ca Move files from gst-plugins-base into the "subprojects/gst-plugins-base/" subdir 2021-09-24 16:13:26 -03:00
Renamed from gst/playback/gstplaybin3.c (Browse further)