summaryrefslogtreecommitdiff
path: root/gst/rtsp-server/rtsp-session.c
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2009-05-26 19:01:10 +0200
committerWim Taymans <wim.taymans@collabora.co.uk>2009-05-26 19:01:10 +0200
commit9bed89c3b7f05bc0cb8f7fd1cad49ca6e05c414e (patch)
treee9c74a74d0bc00c065995eb74d9a06e29c30419a /gst/rtsp-server/rtsp-session.c
parent7bbdf7bf9754a894557c2d057bcf3b408d232178 (diff)
rtsp: use RTCP to keep the session alive
Use the RTCP rtcp-from stats field to find the associated session and use this to keep the session alive.
Diffstat (limited to 'gst/rtsp-server/rtsp-session.c')
-rw-r--r--gst/rtsp-server/rtsp-session.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/gst/rtsp-server/rtsp-session.c b/gst/rtsp-server/rtsp-session.c
index 54a3700..3afd788 100644
--- a/gst/rtsp-server/rtsp-session.c
+++ b/gst/rtsp-server/rtsp-session.c
@@ -74,6 +74,10 @@ gst_rtsp_session_free_stream (GstRTSPSessionStream *stream)
{
g_message ("free session stream %p", stream);
+ /* remove callbacks now */
+ gst_rtsp_session_stream_set_callbacks (stream, NULL, NULL, NULL, NULL);
+ gst_rtsp_session_stream_set_keepalive (stream, NULL, NULL, NULL);
+
if (stream->trans.transport)
gst_rtsp_transport_free (stream->trans.transport);
@@ -308,7 +312,7 @@ gst_rtsp_session_media_get_stream (GstRTSPSessionMedia *media, guint idx)
result->trans.transport = NULL;
result->media_stream = media_stream;
- g_array_insert_val (media->streams, idx, result);
+ g_array_index (media->streams, GstRTSPSessionStream *, idx) = result;
}
return result;
@@ -513,6 +517,27 @@ gst_rtsp_session_stream_set_callbacks (GstRTSPSessionStream *stream,
}
/**
+ * gst_rtsp_session_stream_set_keepalive:
+ * @stream: a #GstRTSPSessionStream
+ * @keep_alive: a callback called when the receiver is active
+ * @user_data: user data passed to callback
+ * @notify: called with the user_data when no longer needed.
+ *
+ * Install callbacks that will be called when RTCP packets are received from the
+ * receiver of @stream.
+ */
+void
+gst_rtsp_session_stream_set_keepalive (GstRTSPSessionStream *stream,
+ GstRTSPKeepAliveFunc keep_alive, gpointer user_data, GDestroyNotify notify)
+{
+ stream->trans.keep_alive = keep_alive;
+ if (stream->trans.ka_notify)
+ stream->trans.ka_notify (stream->trans.ka_user_data);
+ stream->trans.ka_user_data = user_data;
+ stream->trans.ka_notify = notify;
+}
+
+/**
* gst_rtsp_session_media_set_state:
* @media: a #GstRTSPSessionMedia
* @state: the new state