FFmpeg should support hwaccel to handle device lost issue
|Reported by:||haviet||Owned by:|
|Blocking:||Reproduced by developer:||no|
|Analyzed by developer:||no|
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.
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.