Opened 7 years ago

Last modified 7 years ago

#7112 new enhancement

FFmpeg should support hwaccel to handle device lost issue

Reported by: haviet Owned by:
Priority: wish Component: avcodec
Version: git-master Keywords: hwaccel
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

I often face "device lost" problem when use hardware-based decoders and I believe others using hardware-based encoders/filters face the same problem.

For example, when the device lost, h264_nvdec (CUDA) decoder would give errors like this:

[h264 @ AVCodecContext] Error decoding a picture with NVDEC: 700
[h264 @ AVCodecContext] hardware accelerator failed to decode picture

There are many reasons may cause GPU device lost during its working such as

  • The graphics driver is upgraded.
  • The system changes from a power-saving graphics adapter to a performance graphics adapter.
  • The graphics device stops responding and is reset.
  • User manually disable or enable device.
  • A graphics adapter is physically attached or removed.
  • Remote access to the PC which could change display resolution.
  • Unplugging or plugging the monitor cable to the VGA adapter.
  • Etc.


Of course, not all reasons cause "device lost" always, some may happen to some kind of PCs but may not happen to others.

I would FFmpeg to provide a callback mechanism giving the API user a chance to reset or recreate
the hardware acceleration resources, or even switch to software decoder/encoder/filter if the device
can not be recovered.

Change History (1)

comment:1 by Carl Eugen Hoyos, 7 years ago

Keywords: hwaccel added; device lost removed
Priority: normalwish
Version: 3.4git-master
Note: See TracTickets for help on using tickets.