Keeping Track of RTSP Server Sessions

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

Keeping Track of RTSP Server Sessions

Mandar Joshi
Hello everyone,

I want to keep track of IP addresses and corresponding sessions in a
secure gst-rtsp-server. I have the accept_certificate signal which
gives me a callback having GTlsConnection as a parameter.

Is it possible to determine the IP address and the corresponding rtsp
session from here?

Or is there a simpler method?

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

Regards
Mandar Joshi
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Keeping Track of RTSP Server Sessions

Mandar Joshi
>
> 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
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel