From 2221e404de6bba09543b5f29e2effc11a54184ec Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 15 Mar 2010 11:36:22 +0100 Subject: [PATCH] rtsp: make timeout usec more accurate Adjust the returned usec from the elapsed time so it represents the remaining timeout. --- gst-libs/gst/rtsp/gstrtspconnection.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gst-libs/gst/rtsp/gstrtspconnection.c b/gst-libs/gst/rtsp/gstrtspconnection.c index c45f639cac..def369a149 100644 --- a/gst-libs/gst/rtsp/gstrtspconnection.c +++ b/gst-libs/gst/rtsp/gstrtspconnection.c @@ -2462,7 +2462,7 @@ stopped: * @timeout: a timeout * * Calculate the next timeout for @conn, storing the result in @timeout. - * + * * Returns: #GST_RTSP_OK. */ GstRTSPResult @@ -2481,6 +2481,10 @@ gst_rtsp_connection_next_timeout (GstRTSPConnection * conn, GTimeVal * timeout) usec = 0; } else { sec = conn->timeout - elapsed; + if (usec <= G_USEC_PER_SEC) + usec = G_USEC_PER_SEC - usec; + else + usec = 0; } timeout->tv_sec = sec; @@ -2494,7 +2498,7 @@ gst_rtsp_connection_next_timeout (GstRTSPConnection * conn, GTimeVal * timeout) * @conn: a #GstRTSPConnection * * Reset the timeout of @conn. - * + * * Returns: #GST_RTSP_OK. */ GstRTSPResult