0

I am trying to compile gstreamer 1.14.4 to take advantage of the webrtc module. I was able to successfully compile it using cerbero on my raspberry pi but I have an issue where when testing my webrtc application I get a segfault after I send an offer and the pipeline has started playing:

Thread 2 "gst-pc-ops" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x75595470 (LWP 19541)]
__GI___libc_free (mem=0xe59ff000) at malloc.c:2966
2966    malloc.c: No such file or directory.
(gdb) bt
#0  __GI___libc_free (mem=0xe59ff000) at malloc.c:2966
#1  0x7608867c in g_callable_info_free_closure (callable_info=<optimized out>, 
    closure=0x76ff0008) at girepository/girffi.c:426
#2  0x760db72c in ?? ()
   from /usr/lib/python3/dist-packages/gi/_gi.cpython-36m-arm-linux-gnueabihf.so
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

I cant seem to get a full backtrace on my pi.

in valgrind I get the following when it segfaults:

==20539== Thread 2 gst-pc-ops:
==20539== Invalid read of size 8
==20539==    at 0x4865DD0: ??? (in /usr/lib/arm-linux-gnueabihf/libarmmem.so)
==20539==  Address 0x55ffab4 is 4 bytes inside a block of size 11 alloc'd
==20539==    at 0x4847568: malloc (vg_replace_malloc.c:299)
==20539==    by 0x63B4AEB: g_malloc (gmem.c:94)
==20539==    by 0x63CF46B: g_strdup (gstrfuncs.c:363)
==20539==    by 0x63341DF: g_signal_newv (gsignal.c:1644)
==20539==    by 0x633534B: g_signal_new_valist (gsignal.c:1902)
==20539==    by 0x63353C3: g_signal_new (gsignal.c:1437)
==20539==    by 0xCE1B427: gst_srtp_enc_class_init (gstsrtpenc.c:330)
==20539==    by 0xCE1B427: gst_srtp_enc_class_intern_init (gstsrtpenc.c:198)
==20539==    by 0x633FF03: type_class_init_Wm (gtype.c:2232)
==20539==    by 0x633FF03: g_type_class_ref (gtype.c:2947)
==20539==    by 0x6324EBF: g_object_new_with_properties (gobject.c:1935)
==20539==    by 0x63256DF: g_object_new (gobject.c:1637)
==20539==    by 0x6CA134B: gst_element_factory_create (gstelementfactory.c:372)
==20539==    by 0x6CA154F: gst_element_factory_make (gstelementfactory.c:445)

SNIP....

==20539== Invalid free() / delete / delete[] / realloc()
==20539==    at 0x4848B8C: free (vg_replace_malloc.c:530)
==20539==    by 0x62E467B: g_callable_info_free_closure (girffi.c:426)
==20539==    by 0x629A72B: ??? (in /usr/lib/python3/dist-packages/gi/_gi.cpython-36m-arm-linux-gnueabihf.so)
==20539==  Address 0xe59ff000 is not stack'd, malloc'd or (recently) free'd
==20539== 
==20539== 
==20539== Process terminating with default action of signal 6 (SIGABRT)
==20539==    at 0x498E45C: raise (raise.c:51)
==20539==    by 0x498F823: abort (abort.c:89)
==20539==    by 0x64B31DF: ffi_closure_free (in /usr/lib/arm-linux-gnueabihf/libffi.so.6.0.4)
==20539== 
==20539== HEAP SUMMARY:
==20539==     in use at exit: 12,292,940 bytes in 41,975 blocks
==20539==   total heap usage: 102,319 allocs, 60,345 frees, 45,174,025 bytes allocated
==20539== 
==20539== LEAK SUMMARY:
==20539==    definitely lost: 1,368 bytes in 26 blocks
==20539==    indirectly lost: 607 bytes in 15 blocks
==20539==      possibly lost: 3,243,651 bytes in 137 blocks
==20539==    still reachable: 8,839,230 bytes in 40,653 blocks
==20539==                       of which reachable via heuristic:
==20539==                         newarray           : 1,332 bytes in 41 blocks
==20539==         suppressed: 0 bytes in 0 blocks
==20539== Rerun with --leak-check=full to see details of leaked memory
==20539== 
==20539== For counts of detected and suppressed errors, rerun with: -v
==20539== Use --track-origins=yes to see where uninitialised values come from
==20539== ERROR SUMMARY: 3027 errors from 213 contexts (suppressed: 147 from 16)
Aborted

I compiled it using cerbero on my ubuntu x64 bit machine and it compiled fine and I was able to run the application with out issue. I am not sure how I should proceed?

I set my ~/.cerbero/cerbero.cbc to:

# For Linux
prefix='/opt/gstreamer'
recipes_commits = {
#  'ffmpeg' : '3.4.5',
#  'ffmpeg-static' : '3.4.5',
  'gstreamer-1.0' : '1.14.4',
  'gstreamer-1.0-static' : '1.14.4',
  'gst-plugins-base-1.0' : '1.14.4',
  'gst-plugins-base-1.0-static' : '1.14.4',
  'gst-plugins-good-1.0' : '1.14.4',
  'gst-plugins-good-1.0-static' : '1.14.4',
  'gst-plugins-bad-1.0' : '1.14.4',
  'gst-plugins-bad-1.0-static' : '1.14.4',
  'gst-plugins-ugly-1.0' : '1.14.4',
  'gst-plugins-ugly-1.0-static' : '1.14.4',
  'gst-libav-1.0' : '1.14.4',
  'gst-libav-1.0-static' : '1.14.4',
  'gst-rtsp-server-1.0' : '1.14.4',
  'gst-rtsp-server-1.0-static' : '1.14.4',
}

and I pulled the cerbero 1.14 branch using:

git clone https://github.com/GStreamer/cerbero
cd cerbero
git checkout 1.14
cerbero bootstrap
cerbero package gstreamer-1.0

I have set my path variables in .bashrc:

alias cerbero='~/cerbero/cerbero-uninstalled'
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/gstreamer/lib
export PATH=/opt/gstreamer/bin:$PATH
export GST_PLUGIN_PATH=/opt/gstreamer/lib/gstreamer-1.0/
export GI_TYPELIB_PATH=/opt/gstreamer/lib/girepository-1.0/
export PYTHONPATH=$PYTHONPATH:/usr/lib/python3/dist-packages/
export PYTHONPATH=$PYTHONPATH:/opt/gstreamer/lib/

I have also enabled introspection in plugins-bad by adding:

--enable-introspection

to the recipe file in cerbero Here is what I am trying to run: https://github.com/centricular/gstwebrtc-demos

Has anyone been able to compile and use the webrtc module on a raspberry pi? How can I further debug?

I am on a raspberry pi 3 b+ running raspbian and python 3.6

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.