vah265dec: HEVC 10bits decoding fails, but works with vaapih265dec
While testing the vah265dec element on a HEVC sample file, I obtain a reproducible crash, while the vaapih265dec element works fine.
$ vainfo
Trying display: wayland
Trying display: x11
libva info: VA-API version 1.16.0
libva info: Trying to open /usr/lib64/dri/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_1_15
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.16 (libva 2.16.0)
vainfo: Driver version: Mesa Gallium driver 22.2.3 for AMD Radeon RX 480 Graphics (polaris10, LLVM 15.0.0, DRM 3.48, 6.0.12-300.fc37.x86_64)
vainfo: Supported profile and entrypoints
VAProfileMPEG2Simple : VAEntrypointVLD
VAProfileMPEG2Main : VAEntrypointVLD
VAProfileVC1Simple : VAEntrypointVLD
VAProfileVC1Main : VAEntrypointVLD
VAProfileVC1Advanced : VAEntrypointVLD
VAProfileH264ConstrainedBaseline: VAEntrypointVLD
VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
VAProfileH264Main : VAEntrypointVLD
VAProfileH264Main : VAEntrypointEncSlice
VAProfileH264High : VAEntrypointVLD
VAProfileH264High : VAEntrypointEncSlice
VAProfileHEVCMain : VAEntrypointVLD
VAProfileHEVCMain : VAEntrypointEncSlice
VAProfileHEVCMain10 : VAEntrypointVLD
VAProfileJPEGBaseline : VAEntrypointVLD
VAProfileNone : VAEntrypointVideoProc
The simplified pipeline is:
gst-launch-1.0 -v filesrc num-buffers=10 location=~/tmp/12_HEVC_10bits_1280x720_30_000fps.mkv ! matroskademux ! h265parse ! vaapih265dec ! video/x-raw,format=P010_10LE ! glimagesink
and
gst-launch-1.0 -v filesrc num-buffers=10 location=~/tmp/12_HEVC_10bits_1280x720_30_000fps.mkv ! matroskademux ! h265parse ! vah265dec ! video/x-raw,format=P010_10LE ! glimagesink
The crash happens in function _gl_mem_create()
:
Thread 12 "gstglcontext" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffee7fe6c0 (LWP 41015)]
__memmove_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:273
273 VMOVU (%rsi), %VEC(0)
(gdb) bt
#0 __memmove_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:273
#1 0x00007fffef3b2c92 in memcpy (__len=<optimized out>, __src=<optimized out>, __dest=<optimized out>) at /usr/include/bits/string_fortified.h:29
#2 _gl_mem_create (gl_mem=0x7fffa03260a0, error=<optimized out>) at ../gst-libs/gst/gl/gstglmemorypbo.c:235
#3 0x00007fffef398bf7 in _mem_create_gl (context=<optimized out>, transfer=0x7fffa7ffd970) at ../gst-libs/gst/gl/gstglbasememory.c:104
It seems to come from the memory area pointed by gl_mem->mem.mem.data
in this function, a value that comes from wrapped_data[1]
in function gst_gl_memory_setup_buffer()
Adding a videoconvert
or a vapostproc
element prevents the segfault, but results in a green output.
[Edited: updated the pipeline examples to ensure that the same video format is used in both elements]