g_get_current_time (&session->last_access);
}
+void
+gst_rtsp_session_prevent_expire (GstRTSPSession *session)
+{
+ g_return_if_fail (GST_IS_RTSP_SESSION (session));
+
+ g_atomic_int_add (&session->expire_count, 1);
+}
+
+void
+gst_rtsp_session_allow_expire (GstRTSPSession *session)
+{
+ g_atomic_int_add (&session->expire_count, -1);
+}
+
/**
* gst_rtsp_session_next_timeout:
* @session: a #GstRTSPSession
g_return_val_if_fail (GST_IS_RTSP_SESSION (session), -1);
g_return_val_if_fail (now != NULL, -1);
+ if (g_atomic_int_get (&session->expire_count) != 0) {
+ /* touch session when the expire count is not 0 */
+ g_get_current_time (&session->last_access);
+ }
+
last_access = GST_TIMEVAL_TO_TIME (session->last_access);
/* add timeout allow for 5 seconds of extra time */
last_access += session->timeout * GST_SECOND + (5 * GST_SECOND);
* @timeout: the timeout of the session
* @create_time: the time when the session was created
* @last_access: the time the session was last accessed
+ * @expire_count: the expire prevention counter
* @media: a list of #GstRTSPSessionMedia managed in this session
*
* Session information kept by the server for a specific client.
guint timeout;
GTimeVal create_time;
GTimeVal last_access;
+ gint expire_count;
GList *medias;
};
/* session timeout stuff */
void gst_rtsp_session_touch (GstRTSPSession *session);
+void gst_rtsp_session_prevent_expire (GstRTSPSession *session);
+void gst_rtsp_session_allow_expire (GstRTSPSession *session);
gint gst_rtsp_session_next_timeout (GstRTSPSession *session, GTimeVal *now);
gboolean gst_rtsp_session_is_expired (GstRTSPSession *session, GTimeVal *now);