gstreamer/gst/playback
Michael Olbrich 5bfb78aa28 decodebin3: improve decoder selection
Currently the decoder selection is very naive: The type with the highest
rank that matches the current caps is used. This works well for software
decoders. The exact supported caps are always known and the static caps are
defined accordingly.
With hardware decoders, e.g. vaapi, the situation is different. The decoder
may reject the caps later during a caps query. At that point, a new decoder
is created. However, the same type is chosen an after several tries,
decodebin fails.

To avoid this, do the caps query while adding the decoder and try again
with other decoder types if the query fails:

1. create the decoder from the next matching type
2. add and link the decoder
3. change the decoder state to READY
4. do the caps query
   if it fails then remove the decoder again and go back to 1.
5. expose the source pad
6. sync the decoder state with the parent.

This way, the decoder is already part of the pipeline when the state change
to READY happens. So context handling should work as before.

Exposing the source pad after the query was successful is important:
Otherwise the thread from the decoder source pad may block in a blocked pad
downstream in the playsink waiting for other pads to be ready.
The thread now blocks trying to set the state back to NULL while holding
the SELECTION_LOCK. Other streams may block on the SELECTION_LOCK and the
playsink never unblocks the pad. The result is a deadlock.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1201>
2021-07-19 08:56:35 +00:00
..
gstdecodebin2.c Use gst_element_request_pad_simple... 2021-05-05 11:55:54 +03:00
gstdecodebin3-parse.c decodebin3: Release selection lock when pushing EOS 2020-12-11 18:36:30 +00:00
gstdecodebin3.c decodebin3: improve decoder selection 2021-07-19 08:56:35 +00:00
gstparsebin.c playback: Don't special-case G_SIGNAL_RUN_CLEANUP stage in signal accumulators 2021-03-26 09:31:30 +00:00
gstplay-enum.c gst: don't use volatile to mean atomic 2021-03-19 04:20:19 +00:00
gstplay-enum.h playback: add GST_PLAY_FLAG_FORCE_SW_DECODERS enum 2020-01-09 12:28:32 +00:00
gstplaybackelement.c playback: element_init returns void 2021-03-16 17:59:00 +00:00
gstplaybackelements.h playback: element_init returns void 2021-03-16 17:59:00 +00:00
gstplaybackplugin.c playback: remove useless ret test 2021-03-10 20:06:20 +01:00
gstplaybackutils.c playback-utils: Fix caps leak on failure 2018-01-17 12:18:41 +00:00
gstplaybackutils.h playback: Mark internal functions as G_GNUC_INTERNAL 2016-09-01 13:07:07 +03:00
gstplaybin2.c Use gst_element_request_pad_simple... 2021-05-05 11:55:54 +03:00
gstplaybin3.c Use gst_element_request_pad_simple... 2021-05-05 11:55:54 +03:00
gstplaysink.c Use gst_element_request_pad_simple... 2021-05-05 11:55:54 +03:00
gstplaysink.h playback: allow per feature registration 2020-12-10 13:01:57 +00:00
gstplaysinkaudioconvert.c Fix FSF address 2012-11-03 23:05:09 +00:00
gstplaysinkaudioconvert.h Fix FSF address 2012-11-03 23:05:09 +00:00
gstplaysinkconvertbin.c base: use new gst_element_class_add_static_pad_template() 2016-03-24 14:25:41 +02:00
gstplaysinkconvertbin.h playsinkconvertbin: Remove obsolete segment tracking 2013-07-23 13:36:09 +02:00
gstplaysinkvideoconvert.c Fix FSF address 2012-11-03 23:05:09 +00:00
gstplaysinkvideoconvert.h Fix FSF address 2012-11-03 23:05:09 +00:00
gstrawcaps.h playback: Add support for CEA 608/708 CC overlay elements 2018-04-09 15:15:24 +02:00
gststreamsynchronizer.c playback: remove useless ret test 2021-03-10 20:06:20 +01:00
gststreamsynchronizer.h playback: allow per feature registration 2020-12-10 13:01:57 +00:00
gstsubtitleoverlay.c playback: remove useless ret test 2021-03-10 20:06:20 +01:00
gstsubtitleoverlay.h playback: allow per feature registration 2020-12-10 13:01:57 +00:00
gsturidecodebin.c uridecodebin: Don't force floating reference for future reusable decodebin 2021-04-21 02:40:06 +09:00
gsturidecodebin3.c Use gst_element_request_pad_simple... 2021-05-05 11:55:54 +03:00
gsturisourcebin.c playback: Handle sources with dynamic pads and pads already present 2021-05-13 11:58:12 +00:00
meson.build playback: allow per feature registration 2020-12-10 13:01:57 +00:00