+2007-09-11 Wim Taymans <wim.taymans@gmail.com>
+
+ * docs/design/part-live-source.txt:
+ Add docs on how live sources should timestamp.
+
+ * libs/gst/base/gstbasesrc.c: (gst_base_src_do_sync):
+ Add some more debug info.
+ For subclasses that are live and like to sync, add aditional startup
+ latency to sync time and timestamps so that we timstamp according to the
+ design doc.
+
2007-09-11 Tim-Philipp Müller <tim at centricular dot net>
* gst/gstbuffer.c:
if (basesrc->priv->startup_latency == -1) {
now = gst_clock_get_time (clock);
+ GST_LOG_OBJECT (basesrc, "startup timestamp: %" GST_TIME_FORMAT,
+ GST_TIME_ARGS (timestamp));
+
/* startup latency is the diff between when we went to PLAYING (base_time)
* and the current clock time */
if (now > base_time)
else
basesrc->priv->startup_latency = 0;
- GST_LOG_OBJECT (basesrc, "startup latency: %" GST_TIME_FORMAT,
+ GST_LOG_OBJECT (basesrc, "startup running_time: %" GST_TIME_FORMAT,
GST_TIME_ARGS (basesrc->priv->startup_latency));
if (!GST_CLOCK_TIME_IS_VALID (timestamp)) {
timestamp = 0;
GST_BUFFER_TIMESTAMP (buffer) = timestamp;
+
+ GST_LOG_OBJECT (basesrc, "created timestamp: %" GST_TIME_FORMAT,
+ GST_TIME_ARGS (timestamp));
}
/* we have a timestamp, we can subtract it from the startup_latency when it is
else
basesrc->priv->startup_latency = 0;
}
+
+ GST_LOG_OBJECT (basesrc, "startup latency: %" GST_TIME_FORMAT,
+ GST_TIME_ARGS (basesrc->priv->startup_latency));
} else {
/* not the first buffer, the timestamp is the diff between the clock and
* base_time */
if (!GST_CLOCK_TIME_IS_VALID (start))
goto invalid_start;
+ if (basesrc->is_live) {
+ /* live source and we need to sync, add startup latency to timestamp to
+ * get the real running_time */
+ if (timestamp != -1) {
+ start += basesrc->priv->startup_latency;
+ GST_BUFFER_TIMESTAMP (buffer) =
+ timestamp + basesrc->priv->startup_latency;
+ }
+ }
+
GST_LOG_OBJECT (basesrc,
"waiting for clock, base time %" GST_TIME_FORMAT
", stream_start %" GST_TIME_FORMAT,