From 1f7f434df6dedf896d2925560e36a1fe0875763e Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Mon, 7 Mar 2011 16:56:43 +0100 Subject: [PATCH] jitterbuffer: also estimate eos if very near eos --- gst/rtpmanager/gstrtpjitterbuffer.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/gst/rtpmanager/gstrtpjitterbuffer.c b/gst/rtpmanager/gstrtpjitterbuffer.c index c8965ac9e9..9f08203221 100644 --- a/gst/rtpmanager/gstrtpjitterbuffer.c +++ b/gst/rtpmanager/gstrtpjitterbuffer.c @@ -1873,17 +1873,25 @@ push_buffer: elapsed = compute_elapsed (jitterbuffer, outbuf); - if (elapsed > priv->last_elapsed) { + if (elapsed > priv->last_elapsed || !priv->last_elapsed) { guint64 left; priv->last_elapsed = elapsed; left = priv->npt_stop - priv->npt_start; + GST_LOG_OBJECT (jitterbuffer, "left %" GST_TIME_FORMAT, + GST_TIME_ARGS (left)); if (elapsed > 0) estimated = gst_util_uint64_scale (out_time, left, elapsed); - else - estimated = -1; + else { + /* if there is almost nothing left, + * we may never advance enough to end up in the above case */ + if (left < GST_SECOND) + estimated = GST_SECOND; + else + estimated = -1; + } GST_LOG_OBJECT (jitterbuffer, "elapsed %" GST_TIME_FORMAT ", estimated %" GST_TIME_FORMAT, GST_TIME_ARGS (elapsed), GST_TIME_ARGS (estimated));