GNOME Bugzilla – Bug 769268
nvenc segfault after setting wrong width or height
Last modified: 2018-11-03 13:54:05 UTC
After setting odd width or height nvenc will crash. e.g. set caps width: 1855, height 1060 set pipline to GST_STATE_PLAYING nvenc will crash change width to even value (e.g. 1854) and nvenv will work.
Can you provide a backtrace of all threads during the crash, a debug log and the exact versions of GStreamer, the hardware and drivers?
Created attachment 332334 [details] GST_DEBUG=*:5 (nvenc segfault) WARN nvenc gstnvh264enc.c:571:gst_nv_h264_enc_initialize_encoder:<nvh264enc0>[00m error: Failed to init encoder: 8 ERROR nvenc gstnvbaseenc.c:919:gst_nv_base_enc_set_format:<nvh264enc0>[00m Subclass failed to reconfigure encoder
PC spec: Intel® Core™ i7-4790K GeForce GTX 750 Ti/PCIe/SSE2 7,7 GiB SSD 256 drivers: nvidia 361.42 gstreamer 1.8.2 from default Ubuntu 16.04 repo nvenc builded from git://anongit.freedesktop.org/gstreamer/gst-plugins-bad (tag 1.8.2) nvidia_video_sdk_6.0.1 nvidia cuda 7.5.18-0ubuntu1 from default Ubuntu 16.04 repo Linux wk 4.4.0-31-generic #50-Ubuntu SMP Wed Jul 13 00:07:12 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
Please also provide a backtrace of all threads when it crashed, and a debug log with level 6
Created attachment 332337 [details] GST_DEBUG=*:6 (nvenc segfault)
Created attachment 332338 [details] gdb thread apply all backtrace
Can you get another backtrace after installing debug symbols for glib, gstreamer, gst-plugins-base, etc?
Created attachment 332339 [details] gdb thread apply all backtrace with dbg installed symbols: libglib2.0-0-dbg gstreamer1.0-plugins-*-dbg
The debug symbols of GStreamer are still missing. On Debian based systems the package is called libgstreamer1.0-0-dbg
Created attachment 332340 [details] gdb thread apply all backtrace with libgstreamer1.0-0-dbg
Try installing all the libgst*1.0.0-dbg packages, there might be more.
x264 will also fail with non-even width so we can just say it's not supported.
Pipeline like this will crash: gst-launch-1.0 -e videotestsrc ! video/x-raw,width=1919,height=1080,framerate=30/1 ! videoconvert ! videoscale ! nvh264enc ! h264parse ! queue ! mpegtsmux name=mux ! filesink location=test.ts Setting pipeline to PAUSED ... Pipeline is PREROLLING ... Got context from element 'nvh264enc0': gst.gl.GLDisplay=context, gst.gl.GLDisplay=(GstGLDisplay)"\(GstGLDisplayX11\)\ gldisplayx11-0"; Caught SIGSEGV Spinning. Please run 'gdb gst-launch-1.0 2882' to continue debugging, Ctrl-C to quit, or Ctrl-\ to dump core. x264 returns error: gst-launch-1.0 -e videotestsrc ! video/x-raw,width=1919,height=1080,framerate=30/1 ! videoconvert ! videoscale ! x264enc ! h264parse ! queue ! mpegtsmux name=mux ! filesink location=test.ts Setting pipeline to PAUSED ... Pipeline is PREROLLING ... ERROR: from element /GstPipeline:pipeline0/GstX264Enc:x264enc0: Can not initialize x264 encoder. Additional debug info: gstx264enc.c(1587): gst_x264_enc_init_encoder (): /GstPipeline:pipeline0/GstX264Enc:x264enc0 ERROR: pipeline doesn't want to preroll. Setting pipeline to NULL ... Freeing pipeline ...
Created attachment 350062 [details] [review] nvenc: only accept widths and height that are a multiple of 2 Can't reproduce the crash, but we could do something like this as a quick fix. Not sure if that's better or worse than erroring out though. It has the advantage that it's more correct, and theoretically elements before the encoder could automatically crop/scale as required. In practice I can't find any elements which actually support this yet though.
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/414.