summaryrefslogtreecommitdiffstats
path: root/gst/rtpmanager/gstrtpjitterbuffer.c
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2007-10-02 10:27:45 +0000
committerWim Taymans <wim.taymans@gmail.com>2007-10-02 10:27:45 +0000
commit405ec072108fb8a5741087bfefddf63afe6ee5c4 (patch)
treec46893f0a5fd2b766fffe20959fd2547f94c23c9 /gst/rtpmanager/gstrtpjitterbuffer.c
parentc8daf7eecbcdb1db2aef5e3d6438a82a3aa16175 (diff)
downloadgst-plugins-bad-405ec072108fb8a5741087bfefddf63afe6ee5c4.tar.gz
gst-plugins-bad-405ec072108fb8a5741087bfefddf63afe6ee5c4.tar.bz2
gst-plugins-bad-405ec072108fb8a5741087bfefddf63afe6ee5c4.zip
gst/rtpmanager/gstrtpjitterbuffer.c: Remove some old unused variables.
Original commit message from CVS: * gst/rtpmanager/gstrtpjitterbuffer.c: (gst_rtp_jitter_buffer_flush_start), (gst_rtp_jitter_buffer_flush_stop), (gst_rtp_jitter_buffer_change_state), (apply_offset), (gst_rtp_jitter_buffer_loop): Remove some old unused variables. Don't add the latency to the skew corrected timestamp, latency is only used to sync against the clock. Improve debugging. * gst/rtpmanager/rtpjitterbuffer.c: (rtp_jitter_buffer_init), (rtp_jitter_buffer_reset_skew), (calculate_skew): * gst/rtpmanager/rtpjitterbuffer.h: Handle case where server timestamp goes backwards or wildly jumps by temporarily pausing the skew correction. Improve debugging.
Diffstat (limited to 'gst/rtpmanager/gstrtpjitterbuffer.c')
-rw-r--r--gst/rtpmanager/gstrtpjitterbuffer.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/gst/rtpmanager/gstrtpjitterbuffer.c b/gst/rtpmanager/gstrtpjitterbuffer.c
index 2155df89..e087a7fe 100644
--- a/gst/rtpmanager/gstrtpjitterbuffer.c
+++ b/gst/rtpmanager/gstrtpjitterbuffer.c
@@ -152,7 +152,6 @@ struct _GstRtpJitterBufferPrivate
/* clock rate and rtp timestamp offset */
gint32 clock_rate;
gint64 clock_base;
- guint64 exttimestamp;
gint64 prev_ts_offset;
/* when we are shutting down */
@@ -525,7 +524,6 @@ gst_rtp_jitter_buffer_flush_start (GstRtpJitterBuffer * jitterbuffer)
GST_DEBUG_OBJECT (jitterbuffer, "Disabling pop on queue");
/* this unblocks any waiting pops on the src pad task */
JBUF_SIGNAL (priv);
- rtp_jitter_buffer_flush (priv->jbuf);
/* unlock clock, we just unschedule, the entry will be released by the
* locking streaming thread. */
if (priv->clock_id)
@@ -549,7 +547,8 @@ gst_rtp_jitter_buffer_flush_stop (GstRtpJitterBuffer * jitterbuffer)
priv->next_seqnum = -1;
priv->clock_rate = -1;
priv->eos = FALSE;
- priv->exttimestamp = -1;
+ rtp_jitter_buffer_flush (priv->jbuf);
+ rtp_jitter_buffer_reset_skew (priv->jbuf);
JBUF_UNLOCK (priv);
}
@@ -606,7 +605,8 @@ gst_rtp_jitter_buffer_change_state (GstElement * element,
priv->peer_latency = 0;
/* block until we go to PLAYING */
priv->blocked = TRUE;
- priv->exttimestamp = -1;
+ /* reset skew detection initialy */
+ rtp_jitter_buffer_reset_skew (priv->jbuf);
JBUF_UNLOCK (priv);
break;
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
@@ -943,7 +943,7 @@ duplicate:
}
static GstClockTime
-apply_latency (GstRtpJitterBuffer * jitterbuffer, GstClockTime timestamp)
+apply_offset (GstRtpJitterBuffer * jitterbuffer, GstClockTime timestamp)
{
GstRtpJitterBufferPrivate *priv;
@@ -955,10 +955,6 @@ apply_latency (GstRtpJitterBuffer * jitterbuffer, GstClockTime timestamp)
/* apply the timestamp offset */
timestamp += priv->ts_offset;
- /* add latency, this includes our own latency and the peer latency. */
- timestamp += (priv->latency_ms * GST_MSECOND);
- timestamp += priv->peer_latency;
-
return timestamp;
}
@@ -1011,8 +1007,9 @@ again:
seqnum, GST_TIME_ARGS (timestamp),
rtp_jitter_buffer_num_packets (priv->jbuf));
- /* apply our latency to the incomming buffer before syncing. */
- out_time = apply_latency (jitterbuffer, timestamp);
+ /* apply our timestamp offset to the incomming buffer, this will be our output
+ * timestamp. */
+ out_time = apply_offset (jitterbuffer, timestamp);
/* If we don't know what the next seqnum should be (== -1) we have to wait
* because it might be possible that we are not receiving this buffer in-order,
@@ -1054,6 +1051,9 @@ again:
/* prepare for sync against clock */
sync_time = out_time + GST_ELEMENT_CAST (jitterbuffer)->base_time;
+ /* add latency, this includes our own latency and the peer latency. */
+ sync_time += (priv->latency_ms * GST_MSECOND);
+ sync_time += priv->peer_latency;
/* create an entry for the clock */
id = priv->clock_id = gst_clock_new_single_shot_id (clock, sync_time);
@@ -1093,7 +1093,7 @@ again:
goto again;
}
/* Get new timestamp, latency might have changed */
- out_time = apply_latency (jitterbuffer, timestamp);
+ out_time = apply_offset (jitterbuffer, timestamp);
}
push_buffer:
/* check if we are pushing something unexpected */
@@ -1115,7 +1115,7 @@ push_buffer:
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DISCONT);
}
- /* apply timestamp to buffer now */
+ /* apply timestamp with offset to buffer now */
GST_BUFFER_TIMESTAMP (outbuf) = out_time;
/* now we are ready to push the buffer. Save the seqnum and release the lock