Time out sessions
authorWim Taymans <wim.taymans@collabora.co.uk>
Fri, 13 Feb 2009 19:00:34 +0000 (20:00 +0100)
committerWim Taymans <wim.taymans@collabora.co.uk>
Fri, 13 Feb 2009 19:00:34 +0000 (20:00 +0100)
Add support for session timeouts in the example.

examples/test-video.c

index b03bc6c..5ed8b1d 100644 (file)
 
 #include <gst/rtsp-server/rtsp-server.h>
 
+
+static gboolean
+timeout (GstRTSPServer *server, gboolean ignored)
+{
+  GstRTSPSessionPool *pool;
+
+  pool = gst_rtsp_server_get_session_pool (server);
+  gst_rtsp_session_pool_cleanup (pool);
+  g_object_unref (pool);
+
+  return TRUE;
+}
+
 int
 main (int argc, char *argv[])
 {
@@ -61,6 +74,8 @@ main (int argc, char *argv[])
   /* attach the server to the default maincontext */
   gst_rtsp_server_attach (server, NULL);
 
+  g_timeout_add_seconds (2, (GSourceFunc) timeout, server); 
+
   /* start serving */
   g_main_loop_run (loop);