GNOME Bugzilla – Bug 793836
gstvaapidecode: Playback of succession of I-frames fails with AMD card
Last modified: 2018-03-21 12:13:50 UTC
This simple file fails to play on master when using vaapi with amdgpu drivers in GStreamer master: $ gst-launch-1.0 videotestsrc pattern=blink num-buffers=3 \ ! video/x-raw, framerate=3/1 \ ! x264enc key-int-max=1 \ ! mp4mux faststart=true movie-timescale=30 trak-timescale=3 \ ! filesink location=i-frames-non-frag.mp4 $ gst-play-1.0 i-frames-non-frag.mp4 Press 'k' to see a list of keyboard shortcuts. Now playing /home/ntrrgc/Dropbox/igalia/mp4-edts-testcases/i-frames-non-frag.mp4 0:00:00.163746350 53076 0x7fabbc007000 ERROR vaapidecode gstvaapidecode.c:755:gst_vaapidecode_handle_frame: decode error -1 0:00:00.164154644 53076 0x7fabbc007000 ERROR vaapidecode gstvaapidecode.c:755:gst_vaapidecode_handle_frame: decode error -1 0:00:00.164425618 53076 0x7fabbc007000 ERROR vaapidecode gstvaapidecode.c:755:gst_vaapidecode_handle_frame: decode error -1 ERROR No valid frames decoded before end of stream for file:///home/ntrrgc/Dropbox/igalia/mp4-edts-testcases/i-frames-non-frag.mp4 ERROR debug information: ../subprojects/gst-plugins-base/gst-libs/gst/video/gstvideodecoder.c(1160): gst_video_decoder_sink_event_default (): /GstPlayBin:playbin/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0/GstVaapiDecodeBin:vaapidecodebin0/GstVaapiDecode:vaapidecode0: no valid frames found Reached end of play list. Works fine in GStreamer 1.12.4 from Fedora.
(In reply to Alicia Boya García from comment #0) > > Works fine in GStreamer 1.12.4 from Fedora. Sorry, gstreamer1-vaapi was not installed. Actually it does not work in 1.12.4 either. It fails to play too, just showing fewer errors: $ gst-play-1.0 i-frames-non-frag.mp4 Press 'k' to see a list of keyboard shortcuts. Now playing /home/ntrrgc/Dropbox/igalia/mp4-edts-testcases/i-frames-non-frag.mp4 ERROR No valid frames decoded before end of stream for file:///home/ntrrgc/Dropbox/igalia/mp4-edts-testcases/i-frames-non-frag.mp4 ERROR debug information: gstvideodecoder.c(1156): gst_video_decoder_sink_event_default (): /GstPlayBin:playbin/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0/GstVaapiDecodeBin:vaapidecodebin0/GstVaapiDecode:vaapidecode0: no valid frames found Reached end of play list.
Thanks @Alicia, Can you upload the debug output with GST_DEBUG=vaapi*:5?
also, 1. can you upload the test sample? 2. which version of mesa libraries are you using? As I cannot replicate this issue with the intel driver, there's a chance this will boil down to Gallium driver.
Hi Alicia, is it Fedora 27 ? and what is the exact version of Mesa ? (The package that contains the va driver is mesa-dri-drivers and the lib is /usr/lib64/dri/radeonsi_drv_video.so) Can you compare result with Fedora 26 to spot any regression ? Can you also attach output of "dmesg | grep drm" ?
I can confirm this issue here on Debian testing with Mesa 17.3.3-1.
Created attachment 368993 [details] dmsg|grep drm
(In reply to Philippe Normand from comment #6) > Created attachment 368993 [details] > dmsg|grep drm Thx Philippe, I was about to suggest to compare with the radeon driver by setting amdgpu.cik_support=0 amdgpu.si_support=0 radeon.cik_support=1 radeon.si_support=1 (in /etc/default/grub::GRUB_CMDLINE_LINUX_DEFAULT) but your POLARIS card is too recent so only supported by the amdgpu driver.
Created attachment 369012 [details] Test vector
Created attachment 369013 [details] GST_DEBUG=error,vaapi*:5 gst-play-1.0 i-frames-non-frag.mp4
(In reply to Julien Isorce from comment #4) > Hi Alicia, is it Fedora 27 ? and what is the exact version of Mesa ? (The > package that contains the va driver is mesa-dri-drivers and the lib is > /usr/lib64/dri/radeonsi_drv_video.so) This is Fedora 27. Name : mesa-dri-drivers Version : 17.2.4 Release : 3.fc27 Arch : x86_64 > Can you also attach output of "dmesg | grep drm" ? Nothing is written there while playing. Note other videos (with more complex GOPs) seem to play fine in practice.
(In reply to Alicia Boya García from comment #9) > Created attachment 369013 [details] > GST_DEBUG=error,vaapi*:5 gst-play-1.0 i-frames-non-frag.mp4 GST_DEBUG=*vaapi*:6,2 ?
(In reply to Alicia Boya García from comment #10) > (In reply to Julien Isorce from comment #4) > > Hi Alicia, is it Fedora 27 ? and what is the exact version of Mesa ? (The > > package that contains the va driver is mesa-dri-drivers and the lib is > > /usr/lib64/dri/radeonsi_drv_video.so) > > This is Fedora 27. > > Name : mesa-dri-drivers > Version : 17.2.4 > Release : 3.fc27 > Arch : x86_64 > > > Can you also attach output of "dmesg | grep drm" ? > > Nothing is written there while playing. Thx for the infos, can you attach "dmesg | grep drm" just after a fresh boot ? (not when playing a video)
Created attachment 369018 [details] GST_DEBUG=*vaapi*:6,2 gst-play-1.0 i-frames-non-frag.mp4
Created attachment 369019 [details] dmesg | grep drm
Just to confirm, does it happen only on the attached i-frames-non-frag.mp4 or there are mp4/h264 that succeed ? It could fail here https://cgit.freedesktop.org/mesa/mesa/tree/src/gallium/state_trackers/va/picture.c#n149 max_references is set here https://cgit.freedesktop.org/mesa/mesa/tree/src/gallium/state_trackers/va/picture_h264.c#n114 so is gstreamer-vaapi setting libva::va.h::VAPictureParameterBufferH264::num_ref_frames correctly ?
(In reply to Julien Isorce from comment #15) > Just to confirm, does it happen only on the attached i-frames-non-frag.mp4 > or there are mp4/h264 that succeed ? There are mp4/h264 files that play correctly, there are files that don't (like i-frames-non-frag.mp4) and there are files that crash (https://bugzilla.gnome.org/show_bug.cgi?id=793890). At least so far the results have been consistent when playing the same file.
Created attachment 369583 [details] [review] libs: decoder: h264: ensure num_ref_frames is greater than 0 Hi Alicia, could you try the attached patch ? Thx!
It works, thank you very much! :)
Hi Victor, Hi Sreerenj, what do you think of the fix ?
Comment on attachment 369583 [details] [review] libs: decoder: h264: ensure num_ref_frames is greater than 0 I haven't tested it, but it looks correct. Please push it, Julien.
Attachment 369583 [details] pushed as bfa2fbd - libs: decoder: h264: ensure num_ref_frames is greater than 0
reminder: this patch needs to be merged into branch 1.12 too (but right now I'm in a hurry)
Pushed in branch 1.12 * 9a130035 libs: decoder: h264: ensure num_ref_frames is greater than 0