diff options
author | Wim Taymans <wim.taymans@collabora.co.uk> | 2009-05-26 19:01:10 +0200 |
---|---|---|
committer | Wim Taymans <wim.taymans@collabora.co.uk> | 2009-05-26 19:01:10 +0200 |
commit | 9bed89c3b7f05bc0cb8f7fd1cad49ca6e05c414e (patch) | |
tree | e9c74a74d0bc00c065995eb74d9a06e29c30419a /gst/rtsp-server/rtsp-session.c | |
parent | 7bbdf7bf9754a894557c2d057bcf3b408d232178 (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.c | 27 |
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 |