1
mirror of https://github.com/mpv-player/mpv synced 2024-10-30 04:46:41 +01:00
mpv/video/decode
wm4 a2eb0ab076 vd_lavc: make hardware decoding fallback less violent
Most of hardware decoding is initialized lazily. When the first packet
is parsed, libavcodec will call get_format() to check whether hw or sw
decoding is wanted. Until now, we've returned AV_PIX_FMT_NONE from
get_format() if hw decoder initialization failed. This caused the
avcodec_decode_video2() call to fail, which in turn let us trigger the
fallback. We didn't return a sw format from get_format(), because we
didn't want to continue decoding at all. (The reason being that full
reinitialization is more robust when continuing sw decoding.)

This has some disadvantages. libavcodec vomited some unwanted error
messages. Sometimes the failures are more severe, like it happened with
HEVC. In this case, the error code path simply acted up in a way that
was extremely inconvenient (and had to be fixed by myself). In general,
libavcodec is not designed to fallback this way.

Make it a bit less violent from the API usage point of view. Return a sw
format if hw decoder initialization fails. In this case, we let
get_buffer2() call avcodec_default_get_buffer2() as well. libavcodec is
allowed to perform its own sw fallback. But once the decode function
returns, we do the full reinitialization we wanted to do.

The result is that the fallback is more robust, and doesn't trigger any
decoder error codepaths or messages either. Change our own fallback
message to a warning, since there are no other messages with error
severity anymore.
2015-05-28 21:52:04 +02:00
..
dec_video.c video: cleanup some old log messages 2015-04-20 23:19:19 +02:00
dec_video.h player: change video-bitrate and audio-bitrate properties 2015-04-20 20:52:16 +02:00
dxva2.c dxva2: support HEVC 2015-05-14 17:44:48 +02:00
gpu_memcpy_sse4.h dxva2: gpu_memcpy: fix build for GCC 4.8.3 2014-10-26 13:56:41 +01:00
lavc.h vd_lavc: make hardware decoding fallback less violent 2015-05-28 21:52:04 +02:00
rpi.c RPI support 2015-03-29 16:09:56 +02:00
vaapi.c video: un-discourage "vaapi-copy" hwdec mode 2015-02-20 22:24:37 +01:00
vd_lavc.c vd_lavc: make hardware decoding fallback less violent 2015-05-28 21:52:04 +02:00
vd.h Update license headers 2015-04-13 12:10:01 +02:00
vda.c vda: add support for nv12 image formats 2015-05-13 19:57:39 +02:00
vdpau.c vdpau: fix preemption handling 2015-03-31 14:48:34 +02:00