PJSUA running on Raspberry Pi 3 hit Segmentation fault when stopping video stream.

ZC
Zhe Cui
Sat, Feb 10, 2018 1:24 AM

Hello PJSIP developers/users,

I've been building PJSIP 2.7.1 on Raspberry Pi 3 Model B with OS Raspbian
Stretch Lite. Video is needed so V4L2, SDL2, and OpenH264 are all built and
installed. When I ran PJSUA on RPi calling another softphone with video
enabled, everything went well, both audio and video were working. Every
time when hangup it gave Segmentation fault though.

The RPi was used without a UI, I was ssh-ing to it for all the builds/runs.
Camera is a Raspberry Pi Camera Module v2.

Here is a snippet of info from "gdb" when stopping the video call and the
segfault came up. I also tried sample "vid_streamuntil" and it gave
segfault as well when quitting. The same setup on Raspian Jessie Lite gave
no difference.

Anyone have a clue what the problem could be? Could it be something with
SDL, since segfault happened when stopping the SDL video stream? Struggling
with this for days, any comments are appreciated.

"

--end msg--

21:53:22.897    pjsua_app.c  ......Call 0 is DISCONNECTED [reason=200
(Normal call clearing)]

21:53:22.898 pjsua_app_comm  ......

[DISCONNCTD] To: sip:100@10.0.1.16;tag=nSgBRrGkco4MC2Y00HkhCS0M1xWbDNpH

Call time: 00h:00m:08s, 1st res in 1349 ms, conn in 2083ms

#0 audio PCMU @8kHz, sendrecv, peer=10.0.1.16:16438

   SRTP status: Not active Crypto-suite:

   RX pt=0, last update:00h:00m:04.400s ago

      total 201pkt 32.1KB (40.2KB +IP hdr) @avg=27.6Kbps/34.5Kbps

      pkt loss=0 (0.0%), discrd=0 (0.0%), dup=0 (0.0%), reord=0 (0.0%)

            (msec)    min     avg     max     last    dev

      loss period:   0.000   0.000   0.000   0.000   0.000

      jitter     :   0.500  14.151  20.000  14.750   4.127

   TX pt=0, ptime=20, last update:00h:00m:04.301s ago

      total 33pkt 5.2KB (6.6KB +IP hdr) @avg=4.5Kbps/5.6Kbps

      pkt loss=0 (0.0%), dup=0 (0.0%), reorder=0 (0.0%)

            (msec)    min     avg     max     last    dev

      loss period:   0.000   0.000   0.000   0.000   0.000

      jitter     :   8.875   8.875   8.875   8.875   0.000

   RTT msec      :   3.143   3.143   3.143   3.143   0.000

#1 video H264, sendrecv, peer=10.0.1.16:11078

   SRTP status: Not active Crypto-suite:

   RX pt=97, size=352x288, fps=15.00, last update:00h:00m:03.933s ago

      total 151pkt 126.7KB (132.7KB +IP hdr) @avg=109.2Kbps/114.4Kbps

      pkt loss=0 (0.0%), discrd=0 (0.0%), dup=0 (0.0%), reord=0 (0.0%)

            (msec)    min     avg     max     last    dev

      loss period:   0.000   0.000   0.000   0.000   0.000

      jitter     :   0.800  18.716  25.311  21.577   4.489

   TX pt=97, size=720x480, fps=15.00, last update:00h:00m:04.235s ago

      total 323pkt 279.3KB (292.2KB +IP hdr) @avg=240.7Kbps/251.8Kbps

      pkt loss=0 (0.0%), dup=0 (0.0%), reorder=0 (0.0%)

            (msec)    min     avg     max     last    dev

      loss period:   0.000   0.000   0.000   0.000   0.000

      jitter     :   0.000   0.000   0.000   0.000   0.000

   RTT msec      :   0.000   0.000   0.000   0.000   0.000

21:53:22.898  pjsua_media.c  ......Call 0: deinitializing media..

21:53:22.898  pjsua_media.c  ........Media stream call00:0 is destroyed

21:53:22.898    pjsua_vid.c  ........Stopping video stream..

21:53:22.903    v4l2_dev.c  .........Stopping v4l2 video stream mmal
service 16.1

[Thread 0x6f2a2450 (LWP 2187) exited]

21:53:24.006    pjsua_vid.c  .........Window 1: destroying..

21:53:24.006    v4l2_dev.c  ..........Stopping v4l2 video stream mmal
service 16.1

21:53:24.006    vid_port.c  ..........Closing mmal service 16.1..

21:53:24.006    v4l2_dev.c  ..........Stopping v4l2 video stream mmal
service 16.1

21:53:24.006    v4l2_dev.c  ..........Destroying v4l2 video stream mmal
service 16.1

21:53:24.007      sdl_dev.c  ..........Stopping sdl video stream

21:53:24.007    vid_port.c  ..........Closing SDL renderer..

21:53:24.007      sdl_dev.c  ..........Stopping sdl video stream

21:53:24.068      sdl_dev.c !.........Stopping sdl video stream

21:53:24.068    pjsua_vid.c  .........Window 0: destroying..

21:53:24.068      sdl_dev.c  ..........Stopping sdl video stream

21:53:24.069    vid_port.c  ..........Closing SDL renderer..

21:53:24.069      sdl_dev.c  ..........Stopping sdl video stream

[Thread 0x6fecf450 (LWP 2186) exited]

Thread 4 "pjsua-armv7l-un" received signal SIGSEGV, Segmentation fault.

[Switching to Thread 0x757c9450 (LWP 2164)]

0x7004bb28 in ?? ()

(gdb) bt

#0  0x7004bb28 in ?? ()

#1  0x76f2c4e0 in GLES2_DestroyTexture (renderer=<optimized out>,
texture=0x74e04098)

at /home/pi/sdl2/SDL2-2.0.7/src/render/opengles2/SDL_render_gles2.c:931

#2  0x76f23f3c in SDL_DestroyTexture_REAL (texture=0x74e04098) at
/home/pi/sdl2/SDL2-2.0.7/src/render/SDL_render.c:2064

#3  0x000b3778 in sdl_destroy ()

#4  0x000b37ac in sdl_destroy_all ()

#5  0x000b3a30 in job_thread ()

#6  0x0011fa84 in thread_main ()

#7  0x76bd7fc4 in start_thread (arg=0x757c9450) at pthread_create.c:335

#8  0x76a49c68 in ?? () at ../sysdeps/unix/sysv/linux/arm/clone.S:76 from
/lib/arm-linux-gnueabihf/libc.so.6

Backtrace stopped: previous frame identical to this frame (corrupt stack?)

(gdb)
"

-zhe

Hello PJSIP developers/users, I've been building PJSIP 2.7.1 on Raspberry Pi 3 Model B with OS Raspbian Stretch Lite. Video is needed so V4L2, SDL2, and OpenH264 are all built and installed. When I ran PJSUA on RPi calling another softphone with video enabled, everything went well, both audio and video were working. Every time when hangup it gave Segmentation fault though. The RPi was used without a UI, I was ssh-ing to it for all the builds/runs. Camera is a Raspberry Pi Camera Module v2. Here is a snippet of info from "gdb" when stopping the video call and the segfault came up. I also tried sample "vid_streamuntil" and it gave segfault as well when quitting. The same setup on Raspian Jessie Lite gave no difference. Anyone have a clue what the problem could be? Could it be something with SDL, since segfault happened when stopping the SDL video stream? Struggling with this for days, any comments are appreciated. " --end msg-- 21:53:22.897 pjsua_app.c ......Call 0 is DISCONNECTED [reason=200 (Normal call clearing)] 21:53:22.898 pjsua_app_comm ...... [DISCONNCTD] To: sip:100@10.0.1.16;tag=nSgBRrGkco4MC2Y00HkhCS0M1xWbDNpH Call time: 00h:00m:08s, 1st res in 1349 ms, conn in 2083ms #0 audio PCMU @8kHz, sendrecv, peer=10.0.1.16:16438 SRTP status: Not active Crypto-suite: RX pt=0, last update:00h:00m:04.400s ago total 201pkt 32.1KB (40.2KB +IP hdr) @avg=27.6Kbps/34.5Kbps pkt loss=0 (0.0%), discrd=0 (0.0%), dup=0 (0.0%), reord=0 (0.0%) (msec) min avg max last dev loss period: 0.000 0.000 0.000 0.000 0.000 jitter : 0.500 14.151 20.000 14.750 4.127 TX pt=0, ptime=20, last update:00h:00m:04.301s ago total 33pkt 5.2KB (6.6KB +IP hdr) @avg=4.5Kbps/5.6Kbps pkt loss=0 (0.0%), dup=0 (0.0%), reorder=0 (0.0%) (msec) min avg max last dev loss period: 0.000 0.000 0.000 0.000 0.000 jitter : 8.875 8.875 8.875 8.875 0.000 RTT msec : 3.143 3.143 3.143 3.143 0.000 #1 video H264, sendrecv, peer=10.0.1.16:11078 SRTP status: Not active Crypto-suite: RX pt=97, size=352x288, fps=15.00, last update:00h:00m:03.933s ago total 151pkt 126.7KB (132.7KB +IP hdr) @avg=109.2Kbps/114.4Kbps pkt loss=0 (0.0%), discrd=0 (0.0%), dup=0 (0.0%), reord=0 (0.0%) (msec) min avg max last dev loss period: 0.000 0.000 0.000 0.000 0.000 jitter : 0.800 18.716 25.311 21.577 4.489 TX pt=97, size=720x480, fps=15.00, last update:00h:00m:04.235s ago total 323pkt 279.3KB (292.2KB +IP hdr) @avg=240.7Kbps/251.8Kbps pkt loss=0 (0.0%), dup=0 (0.0%), reorder=0 (0.0%) (msec) min avg max last dev loss period: 0.000 0.000 0.000 0.000 0.000 jitter : 0.000 0.000 0.000 0.000 0.000 RTT msec : 0.000 0.000 0.000 0.000 0.000 21:53:22.898 pjsua_media.c ......Call 0: deinitializing media.. 21:53:22.898 pjsua_media.c ........Media stream call00:0 is destroyed 21:53:22.898 pjsua_vid.c ........Stopping video stream.. 21:53:22.903 v4l2_dev.c .........Stopping v4l2 video stream mmal service 16.1 [Thread 0x6f2a2450 (LWP 2187) exited] 21:53:24.006 pjsua_vid.c .........Window 1: destroying.. 21:53:24.006 v4l2_dev.c ..........Stopping v4l2 video stream mmal service 16.1 21:53:24.006 vid_port.c ..........Closing mmal service 16.1.. 21:53:24.006 v4l2_dev.c ..........Stopping v4l2 video stream mmal service 16.1 21:53:24.006 v4l2_dev.c ..........Destroying v4l2 video stream mmal service 16.1 21:53:24.007 sdl_dev.c ..........Stopping sdl video stream 21:53:24.007 vid_port.c ..........Closing SDL renderer.. 21:53:24.007 sdl_dev.c ..........Stopping sdl video stream 21:53:24.068 sdl_dev.c !.........Stopping sdl video stream 21:53:24.068 pjsua_vid.c .........Window 0: destroying.. 21:53:24.068 sdl_dev.c ..........Stopping sdl video stream 21:53:24.069 vid_port.c ..........Closing SDL renderer.. 21:53:24.069 sdl_dev.c ..........Stopping sdl video stream [Thread 0x6fecf450 (LWP 2186) exited] Thread 4 "pjsua-armv7l-un" received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x757c9450 (LWP 2164)] 0x7004bb28 in ?? () (gdb) bt #0 0x7004bb28 in ?? () #1 0x76f2c4e0 in GLES2_DestroyTexture (renderer=<optimized out>, texture=0x74e04098) at /home/pi/sdl2/SDL2-2.0.7/src/render/opengles2/SDL_render_gles2.c:931 #2 0x76f23f3c in SDL_DestroyTexture_REAL (texture=0x74e04098) at /home/pi/sdl2/SDL2-2.0.7/src/render/SDL_render.c:2064 #3 0x000b3778 in sdl_destroy () #4 0x000b37ac in sdl_destroy_all () #5 0x000b3a30 in job_thread () #6 0x0011fa84 in thread_main () #7 0x76bd7fc4 in start_thread (arg=0x757c9450) at pthread_create.c:335 #8 0x76a49c68 in ?? () at ../sysdeps/unix/sysv/linux/arm/clone.S:76 from /lib/arm-linux-gnueabihf/libc.so.6 Backtrace stopped: previous frame identical to this frame (corrupt stack?) (gdb) " -zhe