OMX encoder should not be exposed by gst-libav
Software/hardware information:
Module: avenc_h264_omx Gstreamer version: 1.18.3 OS: Linux raspberrypi 5.10.11-v7l+ #1399 SMP Thu Jan 28 12:09:48 GMT 2021 armv7l GNU/Linux Platform: Raspberry Pi 4b
Steps to reproduce:
gst-launch-1.0 v4l2src device=/dev/video0 ! image/jpeg,width=1920,height=1080,framerate=3000/100 ! jpegdec ! avenc_h264_omx ! fakesink
or
gst-launch-1.0 videotestsrc pattern=3 ! video/x-raw,width=1920,height=1080,framerate=3000/100,format=I420 ! avenc_h264_omx ! fakesink
(frame rate and resolution don't matter)
Description:
When terminating the pipeline with CTRL-C (SIGINT), a SIGSEGV happens:
pi@raspberrypi:~$ gst-launch-1.0 v4l2src device=/dev/video0 ! image/jpeg,width=1920,height=1080,framerate=3000/100 ! jpegdec ! avenc_h264_omx ! fakesink
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
^Chandling interrupt.
Interrupt: Stopping pipeline ...
Execution ended after 0:00:06.814207550
Setting pipeline to NULL ...
Caught SIGSEGV
#0 0xb6c9838c in __waitpid (options=0, stat_loc=0xbe8b8778, pid=11455)
#1 0xb6c9838c in __waitpid (pid=11455, stat_loc=0xbe8b8778, options=0)
#2 0xb6d290e0 in g_on_error_stack_trace ()
#3 0x00014184 in fault_spin () at ../tools/gst-launch.c:121
#4 0x00014184 in fault_handler_sighandler (signum=<optimized out>)
#5 0xb6b65120 in <signal handler called> ()
#6 0xb5ee830c in gst_ffmpegvidenc_receive_packet
#7 0xb5ee8dd4 in gst_ffmpegvidenc_flush_buffers (send=0, ffmpegenc=0x1b36120)
#8 0xb5ee8dd4 in gst_ffmpegvidenc_flush_buffers (ffmpegenc=0x1b36120, send=0)
#9 0xb5ee8e2c in gst_ffmpegvidenc_stop (encoder=0x1b36120)
#10 0xb63f2b80 in gst_video_encoder_change_state
#11 0xb6e805f4 in gst_element_change_state
#12 0xb6e80dec in gst_element_set_state_func
#13 0xb6e58c60 in gst_bin_element_set_state
#14 0xb6e58c60 in gst_bin_change_state_func (element=0x1b380a0, transition=0)
#15 0xb6eb23e8 in gst_pipeline_change_state
#16 0xb6e805f4 in gst_element_change_state
#17 0xb6e811f8 in gst_element_continue_state
#18 0xb6e80870 in gst_element_change_state
#19 0xb6e80dec in gst_element_set_state_func
#20 0x00012f64 in main (argc=<optimized out>, argv=<optimized out>)
Spinning. Please run 'gdb gst-launch-1.0 11357' to continue debugging, Ctrl-C to quit, or Ctrl-\ to dump core.
Further debugging in GDB returns this backtrace:
pi@raspberrypi:~$ gdb gst-launch-1.0 11357
GNU gdb (Raspbian 8.2.1-2) 8.2.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from gst-launch-1.0...done.
Attaching to program: /usr/local/bin/gst-launch-1.0, process 11357
[New LWP 11358]
[New LWP 11359]
[New LWP 11376]
[New LWP 11377]
[New LWP 11378]
[New LWP 11379]
[New LWP 11380]
[New LWP 11381]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
__GI___nanosleep (remaining=0xbe8b879c, requested_time=0xbe8b8794) at ../sysdeps/unix/sysv/linux/nanosleep.c:28
28 ../sysdeps/unix/sysv/linux/nanosleep.c: No such file or directory.
(gdb) bt
#0 0xb6c97b2c in __GI___nanosleep (remaining=0xbe8b879c, requested_time=0xbe8b8794) at ../sysdeps/unix/sysv/linux/nanosleep.c:28
#1 0xb6c97b2c in __GI___nanosleep (requested_time=0xbe8b8794, remaining=0xbe8b879c) at ../sysdeps/unix/sysv/linux/nanosleep.c:25
#2 0xb6d86300 in g_usleep () at /usr/lib/arm-linux-gnueabihf/libglib-2.0.so.0
#3 0x000141b0 in fault_spin () at ../tools/gst-launch.c:131
#4 0x000141b0 in fault_handler_sighandler (signum=<optimized out>) at ../tools/gst-launch.c:112
#5 0xb6b65120 in <signal handler called> () at ../sysdeps/unix/sysv/linux/arm/sigrestorer.S
#6 0xb5ee830c in gst_ffmpegvidenc_receive_packet (ffmpegenc=ffmpegenc@entry=0x1b36120, got_packet=got_packet@entry=0xbe8b8ba4, send=send@entry=0) at ../ext/libav/gstavutils.h:84
#7 0xb5ee8dd4 in gst_ffmpegvidenc_flush_buffers (send=0, ffmpegenc=0x1b36120) at ../ext/libav/gstavvidenc.c:802
#8 0xb5ee8dd4 in gst_ffmpegvidenc_flush_buffers (ffmpegenc=0x1b36120, send=0) at ../ext/libav/gstavvidenc.c:785
#9 0xb5ee8e2c in gst_ffmpegvidenc_stop (encoder=0x1b36120) at ../ext/libav/gstavvidenc.c:915
#10 0xb63f2b80 in gst_video_encoder_change_state (element=0x1b36120, transition=<optimized out>) at ../gst-libs/gst/video/gstvideoencoder.c:1749
#11 0xb6e805f4 in gst_element_change_state (element=element@entry=0x1b36120, transition=transition@entry=GST_STATE_CHANGE_PAUSED_TO_READY) at ../gst/gstelement.c:3046
#12 0xb6e80dec in gst_element_set_state_func (element=0x1b36120, state=<optimized out>) at ../gst/gstelement.c:3000
#13 0xb6e58c60 in gst_bin_element_set_state (next=<optimized out>, current=<optimized out>, start_time=13183355523266772994, base_time=122457698423508256, element=0x1b36120, bin=<optimized out>) at ../gst/gstbin.c:2630
#14 0xb6e58c60 in gst_bin_change_state_func (element=0x1b380a0, transition=0) at ../gst/gstbin.c:2972
#15 0xb6eb23e8 in gst_pipeline_change_state (element=0x1b380a0, transition=GST_STATE_CHANGE_PAUSED_TO_READY) at ../gst/gstpipeline.c:525
#16 0xb6e805f4 in gst_element_change_state (element=element@entry=0x1b380a0, transition=GST_STATE_CHANGE_PAUSED_TO_READY) at ../gst/gstelement.c:3046
#17 0xb6e811f8 in gst_element_continue_state (element=element@entry=0x1b380a0, ret=ret@entry=GST_STATE_CHANGE_NO_PREROLL) at ../gst/gstelement.c:2754
#18 0xb6e80870 in gst_element_change_state (element=element@entry=0x1b380a0, transition=transition@entry=GST_STATE_CHANGE_PLAYING_TO_PAUSED) at ../gst/gstelement.c:3092
#19 0xb6e80dec in gst_element_set_state_func (element=0x1b380a0, state=<optimized out>) at ../gst/gstelement.c:3000
#20 0x00012f64 in main (argc=<optimized out>, argv=<optimized out>) at ../tools/gst-launch.c:1278
This is 100% reproducible. The "send=0" on line 8 of GDB could be the issue but I have no deep knowledge of GST to confirm. I'm happy to provide more info if needed.