summaryrefslogtreecommitdiffstats
path: root/gst
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2009-04-15 17:28:56 +0200
committerDave Robillard <dave@drobilla.net>2009-05-03 12:03:15 -0400
commit3be7adf505349e4b375425daf007cab8076b95e5 (patch)
tree8306ed04f49173727ceb8257d6a19f32bf4f5d65 /gst
parent2ba9cb8a627dffc524755a4e3ba9f5d47fdd48ac (diff)
downloadgst-plugins-bad-3be7adf505349e4b375425daf007cab8076b95e5.tar.gz
gst-plugins-bad-3be7adf505349e4b375425daf007cab8076b95e5.tar.bz2
gst-plugins-bad-3be7adf505349e4b375425daf007cab8076b95e5.zip
jitterbuffer: more estimated EOS fixes
Do more accurate EOS estimate and guard against backward timestamps.
Diffstat (limited to 'gst')
-rw-r--r--gst/rtpmanager/gstrtpjitterbuffer.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/gst/rtpmanager/gstrtpjitterbuffer.c b/gst/rtpmanager/gstrtpjitterbuffer.c
index 6dcd2db5..63aefec5 100644
--- a/gst/rtpmanager/gstrtpjitterbuffer.c
+++ b/gst/rtpmanager/gstrtpjitterbuffer.c
@@ -786,6 +786,10 @@ gst_rtp_jitter_buffer_flush_stop (GstRtpJitterBuffer * jitterbuffer)
priv->next_in_seqnum = -1;
priv->clock_rate = -1;
priv->eos = FALSE;
+ priv->estimated_eos = -1;
+ priv->last_elapsed = 0;
+ priv->reached_npt_stop = FALSE;
+ priv->ext_timestamp = -1;
GST_DEBUG_OBJECT (jitterbuffer, "flush and reset jitterbuffer");
rtp_jitter_buffer_flush (priv->jbuf);
rtp_jitter_buffer_reset_skew (priv->jbuf);
@@ -842,10 +846,6 @@ gst_rtp_jitter_buffer_change_state (GstElement * element,
/* reset negotiated values */
priv->clock_rate = -1;
priv->clock_base = -1;
- priv->last_elapsed = 0;
- priv->estimated_eos = -1;
- priv->reached_npt_stop = FALSE;
- priv->ext_timestamp = -1;
priv->peer_latency = 0;
priv->last_pt = -1;
/* block until we go to PLAYING */
@@ -1606,7 +1606,15 @@ push_buffer:
rtp_time = gst_rtp_buffer_get_timestamp (outbuf);
- ext_time = gst_rtp_buffer_ext_timestamp (&priv->ext_timestamp, rtp_time);
+ GST_LOG_OBJECT (jitterbuffer, "rtp %" G_GUINT32_FORMAT ", ext %"
+ G_GUINT64_FORMAT, rtp_time, priv->ext_timestamp);
+
+ if (rtp_time < priv->ext_timestamp) {
+ ext_time = priv->ext_timestamp;
+ } else {
+ ext_time = gst_rtp_buffer_ext_timestamp (&priv->ext_timestamp, rtp_time);
+ }
+
if (ext_time > priv->clock_base)
elapsed = ext_time - priv->clock_base;
else
@@ -1615,10 +1623,14 @@ push_buffer:
elapsed = gst_util_uint64_scale_int (elapsed, GST_SECOND, priv->clock_rate);
if (elapsed > priv->last_elapsed) {
+ guint left;
+
priv->last_elapsed = elapsed;
+ left = priv->npt_stop - priv->npt_start;
+
if (elapsed > 0)
- estimated = gst_util_uint64_scale (out_time, priv->npt_stop, elapsed);
+ estimated = gst_util_uint64_scale (out_time, left, elapsed);
else
estimated = -1;