[FFmpeg-trac] #4258(avcodec:new): HEVC Decoder Hang in Multi-threaded Slice Type Decoding
FFmpeg
trac at avcodec.org
Thu Sep 10 22:15:20 CEST 2015
#4258: HEVC Decoder Hang in Multi-threaded Slice Type Decoding
---------------------------------------+-----------------------------------
Reporter: jlsantiago0 | Owner:
Type: defect | Status: new
Priority: important | Component: avcodec
Version: git-master | Resolution:
Keywords: hevc deadlock | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
---------------------------------------+-----------------------------------
Comment (by jlsantiago0):
This issue is still happening. Minor bitstream corruption can cause the
HEVC Decoder running Multi-Threaded slice type to deadlock. Observed on
Linux using Pthreads.
The decoder deadlocks inside the call to avcodec_decode_video2() which
never returns. All of the decoder threads are blocked in
ff_thread_await_progress2().
It has been very hard to catch, but I have a mechanism to reproduce it now
every time. On my system is will deadlock anywhere within 20 minutes to 5
or 6 hours. To reproduce the issue stream the TS file located at
http://162.97.176.4/ffmpeg-issue-4258-test-case.ts (NOTE file is approx
300MB) via FFMPEG to UDP localhost and decode the stream in a second
instance of FFMPEG. For instance:
{{{
$ while true ; do \
ffmpeg -re -i ./ffmpeg-issue-4258-test-case.ts \
-codec copy -f mpegts udp://127.0.0.1:12345 \
done
}}}
Then decode the stream via:
{{{
$ ffmpeg_g -vcodec hevc -threads 12 -thread_type slice \
-i udp://:12345 -f null /dev/null
}}}
Here is a recent run where it deadlocked after almost 2 hours:
{{{
ffmpeg version 2.8.git-VF Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 5.2.0 (GCC)
configuration: --extra-version=VF
--prefix=/mnt/centshare/ffmpeg/trunk/build/build-linux/stage --extra-
cflags='-I/mnt/centshare/ffmpeg/trunk/build/../src/libavformat
-I/mnt/centshare/ffmpeg/trunk/build/../src/libavcodec -I/usr/include/SDL
-D_GNU_SOURCE=1 -D_REENTRANT -ggdb' --extra-
ldflags='-L/mnt/centshare/ffmpeg/trunk/build/build-linux/stage/lib
-Wl,-rpath -Wl,/mnt/centshare/ffmpeg/trunk/build/build-linux/stage/lib
-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -L/usr/lib -lSDL
-lpthread' --enable-static --enable-avfilter --enable-pthreads --enable-
zlib --enable-bzlib --enable-runtime-cpudetect --enable-hardcoded-tables
libavutil 55. 1.100 / 55. 1.100
libavcodec 57. 1.100 / 57. 1.100
libavformat 57. 0.100 / 57. 0.100
libavdevice 57. 0.100 / 57. 0.100
libavfilter 6. 1.100 / 6. 1.100
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.100 / 2. 0.100
Input #0, mpegts, from 'udp://:12345':
Duration: N/A, start: 1.400000, bitrate: N/A
Program 1
Metadata:
service_name : Service01
service_provider: FFmpeg
Stream #0:0[0x100]: Video: hevc (Main) ([36][0][0][0] / 0x0024),
yuv420p(tv), 960x1080 [SAR 2:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn,
29.97 tbc
Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000
Hz, stereo, fltp, 123 kb/s
Output #0, null, to '/dev/null':
Metadata:
encoder : Lavf57.0.100
Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 960x1080
[SAR 2:1 DAR 16:9], q=2-31, 200 kb/s, 29.97 fps, 29.97 tbn, 29.97 tbc
Metadata:
encoder : Lavc57.1.100 rawvideo
Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Metadata:
encoder : Lavc57.1.100 pcm_s16le
Stream mapping:
Stream #0:0 -> #0:0 (hevc (native) -> rawvideo (native))
Stream #0:1 -> #0:1 (aac (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
frame= 107 fps=0.0 q=-0.0 size=N/A time=00:00:03.87 bitrate=N/A
frame= 180 fps=178 q=-0.0 size=N/A time=00:00:06.30 bitrate=N/A
frame= 195 fps=128 q=-0.0 size=N/A time=00:00:06.80 bitrate=N/A
frame= 213 fps=103 q=-0.0 size=N/A time=00:00:07.40 bitrate=N/A
frame= 229 fps= 88 q=-0.0 size=N/A time=00:00:07.94 bitrate=N/A
...
<SNIP>
...
frame=193019 fps= 30 q=-0.0 size=N/A time=01:47:22.26 bitrate=N/A
frame=193034 fps= 30 q=-0.0 size=N/A time=01:47:22.76 bitrate=N/A
frame=193053 fps= 30 q=-0.0 size=N/A time=01:47:23.40 bitrate=N/A
frame=193068 fps= 30 q=-0.0 size=N/A time=01:47:23.90 bitrate=N/A
[udp @ 0x37d2de0] Circular buffer overrun. To avoid, increase fifo_size
URL option. To survive in such case, use overrun_nonfatal option
--
Ticket URL: <https://trac.ffmpeg.org/ticket/4258#comment:7>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list