Page 1 of 1

Switch to software decoding after packet loss

Posted: 07 Jan 2022 11:40
by md
With the latest 3.0.16 release, VLC plays 4K HEVC content on iMAC using hardware decoding on the GPU with CPU usage around 17%.

main debug: selecting program id=2
main debug: looking for packetizer module matching "any": 25 candidates
main debug: using packetizer module "hevc"
main debug: looking for video decoder module matching "any": 16 candidates
videotoolbox info: Using Video Toolbox to decode 'hevc'
main debug: using video decoder module "videotoolbox"


However, after a small packet loss in the incoming RTP/UDP stream, hardware decoder exits with an error and VLC does not attempt to restart it - instead it switches to software decoding, with CPU usage around 221 %.

rtp warning: 2 packet(s) lost
ts warning: discontinuity received 0x3 instead of 0x5 (pid=101)
videotoolbox warning: vt session error: 'kVTVideoDecoderBadDataErr'
videotoolbox error: decoder failure, Abort.
main warning: Reloading the decoder module
main debug: removing module "videotoolbox"
main debug: looking for video decoder module matching "any": 16 candidates
avcodec debug: using ffmpeg Lavc58.6.103
avcodec debug: CPU flags: 0x000fd3db
avcodec debug: allowing 7 thread(s) for decoding
avcodec debug: codec (hevc) started
avcodec debug: using frame thread mode with 7 threads
main debug: using video decoder module "avcodec"

Packet loss is unavoidable when streams are delivered over RTP/UDP, so VLC needs to be prepared to handle such events without falling back to software decoding.

Re: Switch to software decoding after packet loss

Posted: 07 Jan 2022 17:30
by md
The described problem was created by this commit:

https://code.videolan.org/videolan/vlc/ ... a844bc5c38

Re: Switch to software decoding after packet loss

Posted: 07 Jan 2022 18:06
by fkuehne
Can you dump the stream and provide it as a sample file for offline debugging?

Re: Switch to software decoding after packet loss

Posted: 08 Jan 2022 08:45
by md
Sure, I've uploaded file hevc3.ts to streams.videolan.org