disconnecting gst-rtsp-server clients

Aleix Conchillo Flaqué aconchillo at gmail.com
Mon Sep 10 14:22:00 PDT 2012


Hi,

I've been trying different methods to disconnect specific clients from
an RTSP server (gst-rtsp).

One option that works is releasing the client (GstRTSPClient) session
media, like this:

  GList *walk;
  for (walk = client->sessions  ;  walk  ;  walk = g_list_next (walk))
    { GstRTSPSession *session = (GstRTSPSession *) walk->data;

      GstRTSPSessionMedia *media =
        gst_rtsp_session_get_media (session, client->uri);

      gst_rtsp_session_release_media (session, media);
    }

However, this only disconnects the media streams, not the main client
connection to the server which is only closed after a timeout. This
means that "rtspsrc" does not receive any more data but is still
connected to the client and sending RTSP requests to the server.

To close this client connection I've tried this in the server:

gst_rtsp_connection_close (client->connection);

Which works well. However, sometimes, rtspsrc opens the connection
again (and the server will just accept the connection). I've tracked
down this and the reason is that when rtspsrc receives GST_RTSP_EEOF,
it tries to reconnect.

The code is in gst-plugins-good/gst/rtsp/gstrtspsrc.c:gst_rtspsrc_loop_udp,
handling  the GST_RTSP_EEOF case. There's a comment that reads:

        /* server closed the connection. not very fatal for UDP, reconnect and
         * see what happens. */

But GstRTSPConnection is a TCP connection, so my guess would be that
if the server closes the connection is because he wants us out of or
may be it has crashed.

What am I missing?

Thanks in advance,

Aleix


More information about the gstreamer-devel mailing list