After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 769268 - nvenc segfault after setting wrong width or height
nvenc segfault after setting wrong width or height
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
1.8.2
Other Linux
: Normal major
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-07-28 13:24 UTC by kapsa
Modified: 2018-11-03 13:54 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GST_DEBUG=*:5 (nvenc segfault) (373.27 KB, application/zip)
2016-07-29 07:20 UTC, kapsa
  Details
GST_DEBUG=*:6 (nvenc segfault) (422.89 KB, application/zip)
2016-07-29 09:15 UTC, kapsa
  Details
gdb thread apply all backtrace (37.07 KB, text/plain)
2016-07-29 09:15 UTC, kapsa
  Details
gdb thread apply all backtrace with dbg (40.40 KB, text/plain)
2016-07-29 09:34 UTC, kapsa
  Details
gdb thread apply all backtrace with libgstreamer1.0-0-dbg (84.05 KB, text/plain)
2016-07-29 09:41 UTC, kapsa
  Details
nvenc: only accept widths and height that are a multiple of 2 (1.36 KB, patch)
2017-04-19 12:10 UTC, Tim-Philipp Müller
none Details | Review

Description kapsa 2016-07-28 13:24:42 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.
Comment 1 Sebastian Dröge (slomo) 2016-07-28 13:33:25 UTC
Can you provide a backtrace of all threads during the crash, a debug log and the exact versions of GStreamer, the hardware and drivers?
Comment 2 kapsa 2016-07-29 07:20:50 UTC
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
Comment 3 kapsa 2016-07-29 07:36:09 UTC
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
Comment 4 Sebastian Dröge (slomo) 2016-07-29 08:03:37 UTC
Please also provide a backtrace of all threads when it crashed, and a debug log with level 6
Comment 5 kapsa 2016-07-29 09:15:00 UTC
Created attachment 332337 [details]
GST_DEBUG=*:6 (nvenc segfault)
Comment 6 kapsa 2016-07-29 09:15:46 UTC
Created attachment 332338 [details]
gdb thread apply all backtrace
Comment 7 Sebastian Dröge (slomo) 2016-07-29 09:24:29 UTC
Can you get another backtrace after installing debug symbols for glib, gstreamer, gst-plugins-base, etc?
Comment 8 kapsa 2016-07-29 09:34:30 UTC
Created attachment 332339 [details]
gdb thread apply all backtrace  with dbg

installed symbols:
libglib2.0-0-dbg
gstreamer1.0-plugins-*-dbg
Comment 9 Sebastian Dröge (slomo) 2016-07-29 09:37:45 UTC
The debug symbols of GStreamer are still missing. On Debian based systems the package is called libgstreamer1.0-0-dbg
Comment 10 kapsa 2016-07-29 09:41:41 UTC
Created attachment 332340 [details]
gdb thread apply all backtrace with libgstreamer1.0-0-dbg
Comment 11 Vincent Penquerc'h 2016-10-07 11:24:08 UTC
Try installing all the libgst*1.0.0-dbg packages, there might be more.
Comment 12 Matthew Waters (ystreet00) 2016-10-20 11:09:19 UTC
x264 will also fail with non-even width so we can just say it's not supported.
Comment 13 kapsa 2016-10-26 05:40:31 UTC
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 ...
Comment 14 Tim-Philipp Müller 2017-04-19 12:10:17 UTC
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.
Comment 15 GStreamer system administrator 2018-11-03 13:54:05 UTC
-- 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.