Keeping Track of RTSP Server Sessions

Mandar Joshi emailmandar at gmail.com
Sat Feb 4 01:20:58 UTC 2017


>
> Also, I would like to be able to disconnect RTSP Sessions from
> specified IP Addresses. Is this possible?

I found the required function to do this. Problem is, most of the time
the server application freezes after disconnecting a RTSP client.
I modified the test-launch.c example to reproduce the problem.
I have a callback for "client-connected" on the gst-rtsp-server and
after a new client is connected, I start a timer for 4 seconds. On
timeout, I close the RTSP connection. This works but the server
application (test-launch) freezes after I do so i.e. I can no longer
create new connections to gst-rtsp-server

----------------------------------------------------------------------------------------------------------------------------------------
gboolean disconnect_rtsp_client (gpointer user_data) {
  GstRTSPClient *client = (GstRTSPClient *) user_data;
  gst_rtsp_client_close (client);
  return FALSE;
}

void rtsp_client_connected (GstRTSPServer *gstrtspserver,
GstRTSPClient *client, gpointer user_data) {
  const gchar *ip_address = gst_rtsp_connection_get_ip
(gst_rtsp_client_get_connection (client));
  g_message ("New RTSP Client: %s", ip_address);
  g_timeout_add_seconds (4, disconnect_rtsp_client, (gpointer) client);
}

g_signal_connect (server, "client-connected", G_CALLBACK
(rtsp_client_connected), NULL);
------------------------------------------------------------------------------------------------------------------------------------------

The fix I found for this is to use
gst_rtsp_client_get_session_pool(...) and
gst_rtsp_session_pool_filter(...) and the callback func returning
GST_RTSP_FILTER_REMOVE;

------------------------------------------------------------------------------------------------------------------------------------------
GstRTSPFilterResult func (GstRTSPSessionPool *pool, GstRTSPSession
*session, gpointer user_data) {
   return GST_RTSP_FILTER_REMOVE;
}

gboolean disconnect_rtsp_client (gpointer user_data) {
  GstRTSPClient *client = (GstRTSPClient *) user_data;
  GstRTSPSessionPool *pool = gst_rtsp_client_get_session_pool (client);
  gst_rtsp_session_pool_filter (pool, func, NULL);
  return FALSE;
}

void rtsp_client_connected (GstRTSPServer *gstrtspserver,
GstRTSPClient *client, gpointer user_data) {
  const gchar *ip_address = gst_rtsp_connection_get_ip
(gst_rtsp_client_get_connection (client));
  g_message ("New RTSP Client: %s", ip_address);
  g_timeout_add_seconds (4, disconnect_rtsp_client, (gpointer) client);
}
------------------------------------------------------------------------------------------------------------------------------------------


Is this expected behaviour? Any comments or suggestions?

Thanks
Mandar Joshi


More information about the gstreamer-devel mailing list