Close the connection of RTSP from server side gracefully

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Close the connection of RTSP from server side gracefully

Tran Tu
Hi all,

I read the examples from gst-rtsp-server plugin and the test_cleanup.c. The I write an example for closing the current connection of client from server side. Below is the flow:
- Construct Rtsp server for streaming in a second thread follow test-video.c example
- Register callback for "client-connect" signal
- Attach g_main_loop
- Then client access the stream from another PC using VLC
After a duration, from main thread I call function to  close the connection and free evrything in server side. And this is the flow for it
- Get current connection by gst_rtsp_client_get_connection()
- Close that connection by gst_rtsp_client_close()
- Unref mountpoint, session pool, g_source_remove(sourceID), unref server....

I got the exception frequently when I call gst_rtsp_client_close() function. It notify SIGABRT from glib_thread when lock the mutex.
Anybody can help me with this issue?

P.S: I also try to use gdb for debugging, but currently I cannot build gst-rtsp-server-plugin in debug symbols mode. Please guide me how to enable this configuration in Yocto, the version of gst-rtsp-server plugin I use is 1.4.1
Reply | Threaded
Open this post in threaded view
|

Re: Close the connection of RTSP from server side gracefully

Tran Tu
Hi all,

I update the backtrace log of the crash, is there any hint, please help me

Client stop access to stream for sessionId1/
GLib (gthread-posix.c): UnexpecteERROR: v4l2 capture: mxc_v4l_dqueue() interrupt received
d error from C library during 'pthread_mutex_lock': Invalid argument.  Aborting.

Program received signal SIGABRT, Aborted.
0x76a56d84 in __GI_raise (sig=sig@entry=6)
    at ../sysdeps/unix/sysv/linux/raise.c:55
55        return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);
(gdb) backtrace
#0  0x76a56d84 in __GI_raise (sig=sig@entry=6)
    at ../sysdeps/unix/sysv/linux/raise.c:55
#1  0x76a5a884 in __GI_abort () at abort.c:89
#2  0x76c2d348 in g_thread_abort (status=<optimized out>,
    function=0x2 <error: Cannot access memory at address 0x2>)
    at /usr/src/debug/glib-2.0/1_2.40.0-r0/glib-2.40.0/glib/gthread-posix.c:75
#3  0x76c2d7a4 in g_mutex_lock (mutex=mutex@entry=0x768c6000)
    at /usr/src/debug/glib-2.0/1_2.40.0-r0/glib-2.40.0/glib/gthread-posix.c:210
#4  0x76be35e8 in g_source_unref_internal (source=0x2, context=0x768c6000,
    have_lock=1991618716)
    at /usr/src/debug/glib-2.0/1_2.40.0-r0/glib-2.40.0/glib/gmain.c:1991
#5  0x76b86904 in gst_rtsp_client_close (client=0x59670)
    at /usr/src/debug/gstreamer1.0-rtsp-server/1.4.1-r0/gst-rtsp-server-1.4.1/gst/rtsp-server/rtsp-client.c:833
#6  0x00009e68 in STRMN_StopStreamServer (StreamVar=0x133bc <STRMN_StreamVar>)
    at ../Prog/Asw/StreamMngr/TestRtspServer.c:504
#7  0x0000a370 in STRMN_DeInit ()
    at ../Prog/Asw/StreamMngr/TestRtspServer.c:687
#8  0x0000a41c in main () at ../Prog/Asw/StreamMngr/TestRtspServer.c:725