#1006121 libvlc5: VLC crash when playing some mpeg2 stream

Package:
mesa-va-drivers
Source:
mesa
Description:
Mesa VA-API video acceleration drivers
Submitter:
Francesco Muzio
Date:
2022-02-19 19:33:05 UTC
Severity:
important
Tags:
#1006121#5
Date:
2022-02-19 13:51:05 UTC
From:
To:
Dear Maintainer,

VLC crash when playing some mpeg2 stream
Here  you can found a downloadable sample recording that crash after 11
seconds: https://www.dropbox.com/s/16qgb3aua8byg6k/Sample-crash_11s.m2t?dl=0

I have experienced this bug with an application that using libvlc to decode
DVB-T streams (Kaffeine), some italian TV broadcasters streams an mpeg2 video
that cause random segmentation fault.

Also VLC crash when playing this streams, but other software like Xine, ffplay
run the entire sample without devastating errors (Xine shows some glitches
after 12 seconds)

#1006121#10
Date:
2022-02-19 13:59:51 UTC
From:
To:
Control: tags -1 moreinfo

I also see glitches, but I cannot reproduce the crash when playing that
file with vlc. Pleae provide a traceback of the crash and the
corresponding logs.

Cheers

#1006121#17
Date:
2022-02-19 17:38:32 UTC
From:
To:
gdb stack trace of the crash:

Thread 25 "vlc" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffbc7fb700 (LWP 9949)]
0x00007fffab507cb3in ??() from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
(gdb) bt
#0 0x00007fffab507cb3in  () at /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
#1 0x00007fffab4d7f09in  () at /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
#2 0x00007fffab4d6221in  () at /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
#3 0x00007fff7b5a14c5in  () at
/usr/lib/x86_64-linux-gnu/dri/r600_drv_video.so
#4 0x00007fffa0473adfin vaEndPicture() at
/usr/lib/x86_64-linux-gnu/libva.so.2
#5 0x00007fff831757c8in  () at /usr/lib/x86_64-linux-gnu/libavcodec.so.58
#6 0x00007fff83185c6ein  () at /usr/lib/x86_64-linux-gnu/libavcodec.so.58
#7 0x00007fff82f9dfcain  () at /usr/lib/x86_64-linux-gnu/libavcodec.so.58
#8 0x00007fff82f9e70din  () at /usr/lib/x86_64-linux-gnu/libavcodec.so.58
#9 0x00007fff82ca92bbin  () at /usr/lib/x86_64-linux-gnu/libavcodec.so.58
#10 0x00007fff82ca9db8in avcodec_send_packet()
    at /usr/lib/x86_64-linux-gnu/libavcodec.so.58
#11 0x00007fffbc20966cin  ()
    at /usr/lib/x86_64-linux-gnu/vlc/plugins/codec/libavcodec_plugin.so
#12 0x00007ffff7cb01c8in  () at /usr/lib/x86_64-linux-gnu/libvlccore.so.9
#13 0x00007ffff7cafdf5in  () at /usr/lib/x86_64-linux-gnu/libvlccore.so.9
#14 0x00007ffff7cb0412in  () at /usr/lib/x86_64-linux-gnu/libvlccore.so.9
#15 0x00007ffff7f44ea7in start_thread(arg=<optimized out>) at
pthread_create.c:477
#16 0x00007ffff7e6edefin clone() at
../sysdeps/unix/sysv/linux/x86_64/clone.S:95


The crash seems a curious combination between a (probably) not perfect
signal reception, libvlc and the driver/hardware video.
It not happens on another machine with same debian release, same
architecture and same radeon driver video (but different GPU)
It not happens if I disable HW decoding on VLC

with HW decoding enabled, when VLC start playing, shows me this message:
[00007f91d0c0b170] avcodec decoder: Using Mesa Gallium driver 20.3.5 for
AMD RS880 (DRM 2.50.0 / 5.10.0-11-amd64, LLVM 11.0.1) for hardware decoding

when VLC segfaults I see these messages in dmesg logs
[ 9647.012821] vlc[7168]: segfault at 30 ip 00007fe06b0ffcb3 sp
00007fe06846d738 error 4 in r600_dri.so[7fe06a6a5000+d47000]
[ 9647.012857] Code: 1f 84 00 00 00 00 00 48 8b 46 30 ff 60 10 66 0f 1f
84 00 00 00 00 00 48 8b 06 48 8b 40 30 ff 60 18 66 0f 1f 44 00 00 48 8b
06 <48> 8b 40 30 ff 60 20 66 0f 1f 44 00 00 41 57 41 56 41 55 41 54 55

so, as a workaround, I use --avcodec-hw none to VLC (or settings
VDPAU_DRIVER=none LIBVA_DRIVER_NAME=none for other software using
libvlc) to avoid the crash

#1006121#22
Date:
2022-02-19 18:35:35 UTC
From:
To:
Control: reassign -1 mesa-va-drivers 20.3.5-1

So this sounds a lot like a bug in the vaapi driver for that GPU.
Especially since playing without hardware decoding works as expected.
Reassigning accordingly.

Cheers

#1006121#33
Date:
2022-02-19 19:30:02 UTC
From:
To:
I do not agree, because Xine using hardware acceleration (if I don't
force to disable it by setting LIBVA_DRIVER_NAME,VDPAU_DRIVER ) and
playing entire sample only with a glitch.
VLC must do it with the same behaviour