Closed MayamaTakeshi closed 6 months ago
I copied samples/g729.js to samples/pcma.js and adjusted it to use PCMA instead of G729 but could not reproduce this issue exact issue. But I got (once):
call_id=0 restart_media_stream: stream characteristics no change
audio_endpoint_remove_port
Thread 12 "clock" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffcd1fb640 (LWP 18658)]
get_frame (port=0x5c814f8, frame=0x7fffcd1fac60) at ../src/pjmedia/stream.c:770
770 status = pjmedia_codec_decode( stream->codec, &frame_in,
(gdb) bt
#0 get_frame (port=0x5c814f8, frame=0x7fffcd1fac60) at ../src/pjmedia/stream.c:770
#1 0x00007ffff4ca0dfc in read_port (type=<synthetic pointer>, count=160, frame=<optimized out>, cport=0x5c65d50, conf=0x5c846c0) at ../src/pjmedia/conference.c:1588
#2 get_frame (this_port=<optimized out>, frame=0x7fffcd1facd0) at ../src/pjmedia/conference.c:2042
#3 0x00007ffff4ca5fb3 in clock_callback (ts=0x5c65d10, user_data=0x5c85948) at ../src/pjmedia/master_port.c:193
#4 0x00007ffff4cc154b in clock_thread (arg=0x5c65cf0) at ../src/pjmedia/clock_thread.c:391
#5 0x00007ffff4d15498 in thread_main (param=0x5c66958) at ../src/pj/os_core_unix.c:701
#6 0x00007ffff7894ac3 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#7 0x00007ffff7926850 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
(gdb)
which should have the same underlyaing cause.
The problem was that I was removing the ports before calling pjmedia_master_port_stop.
Running this inside gdb we eventually get:
This probably is not related to G729. As we can see, it happens after "audio_endpoint_remove_port". So probably we are not properly syncing access to stream or some related object and we are nullifying some field and when the thread writing data to the stream tries to read it, it segfaults.
Commit: 39c4bd5514d5ea5e8757e19fa6c330df9e758d93