1
0
mirror of https://github.com/mpv-player/mpv synced 2025-01-25 00:53:22 +00:00
mpv/filters
Philip Langdale 7d7ef05f10 autoconvert: destroy sub filter immediately if reconfiguration is needed
I'm currently not convinced that the way the output_chain is handled as
part of reconfiguration is correct. If there is an event requiring
reconfiguration, such as toggling the use of hwdec, we currently do not
ensure that the filter chain is fully drained first. This creates a
situation where the filter chain is invalidated while the autoconvert's
sub filter (that does the real work) still has a frame to process and
pass on.

As the autoconvert code calls mp_subfilter_drain_destroy(), it returns
early to allow for draining before destroying the subfilter, but that
means the subfilter is still present in its original configuration, and
no actually draining is done before the existing filters reinitialise
themselves.

This leads to a situation where, if a hardware scaling filter is being
used by autoconvert, that filter is still present and responds when
told to reinitialise. But it cannot successfully reinitialise if the
triggering event is disabling hw decoding, as the input frame to the
filter will now be a software frame, so reinit fails, leading to total
failure of the filter chain, which is a fatal error, and we exit.

I think this was never noticed before, because I think it's not
possible for the hwtransfer filter to be active in a situation where
you can dynamically change the state such that the input or output
formats of the output chain are invalidated.

eg: If the autoconverter is activated because of `--vf=format=vaapi`,
it is actually not possible to toggle hwdec off, as the explicit user
filter ensure the hwdec is always present and active.

So, my solution here is to destroy the sub filter, regardless of
whether it needs draining or not. We simply have no opportunity to
drain and reconfigure in the correct order, and we must consider the
remaining frame in the filter as a casualty of the toggling process.

I'm sure there is a more substantial rework of the output_chain
reconfiguration process that could ensure draining before
reconfiguration begins, but my ambitions do not currently extend that
far.
2023-08-26 10:07:55 -07:00
..
f_async_queue.c f_async_queue: add various helper functions 2020-08-28 20:08:32 +02:00
f_async_queue.h f_async_queue: add various helper functions 2020-08-28 20:08:32 +02:00
f_auto_filters.c hwdec_vulkan: use bwdif_vulkan as deinterlacing auto filter 2023-05-28 15:46:05 -07:00
f_auto_filters.h filters/auto_filters: switch from scaletempo to scaletempo2 2021-02-15 00:13:03 +02:00
f_autoconvert.c autoconvert: destroy sub filter immediately if reconfiguration is needed 2023-08-26 10:07:55 -07:00
f_autoconvert.h vf_format: add gross mechanism for forcing scaler for testing 2020-04-13 15:56:27 +02:00
f_decoder_wrapper.c m_option: change m_option_type_aspect to double 2023-08-09 13:51:28 +00:00
f_decoder_wrapper.h player/video: check for forced eof 2023-07-22 17:42:25 +00:00
f_demux_in.c f_demux_in: log EOF "recovery" 2020-08-27 18:40:57 +02:00
f_demux_in.h video: make decoder wrapper a filter 2018-01-30 03:10:27 -08:00
f_hwtransfer.c hwtransfer: implement support for hw->hw format conversion 2023-08-26 10:07:55 -07:00
f_hwtransfer.h hwtransfer: implement support for hw->hw format conversion 2023-08-26 10:07:55 -07:00
f_lavfi.c options: transition options from OPT_FLAG to OPT_BOOL 2023-02-21 17:15:17 +00:00
f_lavfi.h filters: lavfi: allow hwdec_interop selection for filters 2022-09-21 09:39:34 -07:00
f_output_chain.c output_chain: don't reset autoconvert on changes to unrelated filters 2023-08-26 10:07:55 -07:00
f_output_chain.h audio: redo video-sync=display-adrop 2020-05-23 04:04:46 +02:00
f_swresample.c options: transition options from OPT_FLAG to OPT_BOOL 2023-02-21 17:15:17 +00:00
f_swresample.h options: transition options from OPT_FLAG to OPT_BOOL 2023-02-21 17:15:17 +00:00
f_swscale.c f_swscale: do not reset color levels to default 2023-03-02 09:37:06 -05:00
f_swscale.h vf_format: add gross mechanism for forcing scaler for testing 2020-04-13 15:56:27 +02:00
f_utils.c osdep: rename MP_UNREACHABLE 2021-11-03 15:15:20 +01:00
f_utils.h various: fix typos 2022-04-25 09:07:18 -04:00
filter_internal.h various: fix typos 2023-03-28 19:29:44 +00:00
filter.c options: transition commands from OPT_FLAG to OPT_BOOL 2023-02-21 17:15:17 +00:00
filter.h vf_vapoursynth: save display resolution as a variable 2023-08-13 19:58:20 +00:00
frame.c Implement backwards playback 2019-09-19 20:37:04 +02:00
frame.h Implement backwards playback 2019-09-19 20:37:04 +02:00
user_filters.c filters: lavfi: allow hwdec_interop selection for filters 2022-09-21 09:39:34 -07:00
user_filters.h audio: add scaletempo2 filter based on chromium 2020-07-27 00:57:22 +02:00