From ca11abd193012f99b33412a0f7eaca8a8ea02a5d Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 20 Nov 2012 13:34:46 +0100 Subject: [PATCH] test-auth: add example of how to remove sessions Add an example of the session filter api. --- examples/test-auth.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/examples/test-auth.c b/examples/test-auth.c index eeb61fdf5c..2375bc0991 100644 --- a/examples/test-auth.c +++ b/examples/test-auth.c @@ -21,9 +21,29 @@ #include +static gboolean +remove_func (GstRTSPSessionPool * pool, GstRTSPSession * session, + GstRTSPServer * server) +{ + return GST_RTSP_FILTER_REMOVE; +} static gboolean -timeout (GstRTSPServer * server, gboolean ignored) +remove_sessions (GstRTSPServer * server) +{ + GstRTSPSessionPool *pool; + + g_print ("removing all sessions\n"); + pool = gst_rtsp_server_get_session_pool (server); + gst_rtsp_session_pool_filter (pool, (GstRTSPSessionFilterFunc) remove_func, + server); + g_object_unref (pool); + + return FALSE; +} + +static gboolean +timeout (GstRTSPServer * server) { GstRTSPSessionPool *pool; @@ -100,8 +120,11 @@ main (int argc, char *argv[]) goto failed; g_timeout_add_seconds (2, (GSourceFunc) timeout, server); + g_timeout_add_seconds (10, (GSourceFunc) remove_sessions, server); /* start serving */ + g_print ("stream with user:admin ready at rtsp://127.0.0.1:8554/test\n"); + g_print ("stream with user2:admin2 ready at rtsp://127.0.0.1:8554/test2\n"); g_main_loop_run (loop); return 0;