summaryrefslogtreecommitdiffstats
path: root/gst/rtsp
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2007-09-28 14:56:19 +0000
committerWim Taymans <wim.taymans@gmail.com>2007-09-28 14:56:19 +0000
commitbea901065843072d691f397397e815332be0b071 (patch)
tree0f7b332f40690678f9bd605cd47ee7c816cf9a29 /gst/rtsp
parentc57ce8b9d561ddd7f82016ed27a35f4871d29169 (diff)
gst/rtsp/gstrtspsrc.*: In TCP mode, only timestamp the first buffer. TCP is not real time and it does not make sense ...
Original commit message from CVS: * gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_loop_interleaved), (gst_rtspsrc_play): * gst/rtsp/gstrtspsrc.h: In TCP mode, only timestamp the first buffer. TCP is not real time and it does not make sense to try to skew compensate, also some servers send the first batch of data in a burst.
Diffstat (limited to 'gst/rtsp')
-rw-r--r--gst/rtsp/gstrtspsrc.c30
-rw-r--r--gst/rtsp/gstrtspsrc.h1
2 files changed, 22 insertions, 9 deletions
diff --git a/gst/rtsp/gstrtspsrc.c b/gst/rtsp/gstrtspsrc.c
index 7a309303..23f4764b 100644
--- a/gst/rtsp/gstrtspsrc.c
+++ b/gst/rtsp/gstrtspsrc.c
@@ -2450,15 +2450,6 @@ gst_rtspsrc_loop_interleaved (GstRTSPSrc * src)
/* don't need message anymore */
gst_rtsp_message_unset (&message);
- /* set reception timestamp */
- GST_OBJECT_LOCK (src);
- if (GST_ELEMENT_CLOCK (src)) {
- GstClockTime now = gst_clock_get_time (GST_ELEMENT_CLOCK (src));
-
- GST_BUFFER_TIMESTAMP (buf) = now - GST_ELEMENT_CAST (src)->base_time;
- }
- GST_OBJECT_UNLOCK (src);
-
GST_DEBUG_OBJECT (src, "pushing data of size %d on channel %d", size,
channel);
@@ -2473,10 +2464,30 @@ gst_rtspsrc_loop_interleaved (GstRTSPSrc * src)
gst_buffer_set_caps (buf, stream->caps);
}
+ if (src->base_time == -1) {
+ /* Take current running_time. This timestamp will be put on
+ * the first buffer of each stream because we are a live source and so we
+ * timestamp with the running_time. When we are dealing with TCP, we also
+ * only timestamp the first buffer (using the DISCONT flag) because a server
+ * typically bursts data, for which we don't want to compensate by speeding
+ * up the media. The other timestamps will be interpollated from this one
+ * using the RTP timestamps. */
+ GST_OBJECT_LOCK (src);
+ if (GST_ELEMENT_CLOCK (src)) {
+ GstClockTime now = gst_clock_get_time (GST_ELEMENT_CLOCK (src));
+
+ src->base_time = now - GST_ELEMENT_CAST (src)->base_time;
+ }
+ GST_OBJECT_UNLOCK (src);
+ }
+
if (stream->discont && !is_rtcp) {
/* mark first RTP buffer as discont */
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DISCONT);
stream->discont = FALSE;
+ /* first buffer gets the timestamp, other buffers are not timestamped and
+ * their presentation time will be interpollated from the rtp timestamps. */
+ GST_BUFFER_TIMESTAMP (buf) = src->base_time;
}
/* chain to the peer pad */
@@ -4157,6 +4168,7 @@ gst_rtspsrc_play (GstRTSPSrc * src)
gst_task_set_lock (src->task, GST_RTSP_STREAM_GET_LOCK (src));
}
src->running = TRUE;
+ src->base_time = -1;
src->state = GST_RTSP_STATE_PLAYING;
gst_rtspsrc_loop_send_cmd (src, CMD_WAIT, FALSE);
gst_task_start (src->task);
diff --git a/gst/rtsp/gstrtspsrc.h b/gst/rtsp/gstrtspsrc.h
index d956d7e1..29f23ce4 100644
--- a/gst/rtsp/gstrtspsrc.h
+++ b/gst/rtsp/gstrtspsrc.h
@@ -135,6 +135,7 @@ struct _GstRTSPSrc {
gint free_channel;
GstEvent *close_segment;
GstEvent *start_segment;
+ GstClockTime base_time;
/* UDP mode loop */
gint loop_cmd;