mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 02:01:12 +00:00
docs/design/part-live-source.txt: Add docs on how live sources should timestamp.
Original commit message from CVS: * 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.
This commit is contained in:
parent
9299939987
commit
3b67d01585
3 changed files with 43 additions and 1 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
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:
|
||||
|
|
|
@ -46,3 +46,15 @@ The latency is the time it takes to construct one buffer of data. This latency
|
|||
is exposed with a LATENCY query.
|
||||
|
||||
See part-latency.txt.
|
||||
|
||||
|
||||
Timestamps
|
||||
----------
|
||||
|
||||
Live sources always timestamp their buffers with the running_time of the
|
||||
pipeline. This is needed to be able to match the timestamps of different live
|
||||
sources in order to synchronize them.
|
||||
|
||||
This is in contrast to non-live sources, which timestamp their buffers starting
|
||||
from running_time 0.
|
||||
|
||||
|
|
|
@ -1507,6 +1507,9 @@ gst_base_src_do_sync (GstBaseSrc * basesrc, GstBuffer * buffer)
|
|||
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)
|
||||
|
@ -1514,7 +1517,7 @@ gst_base_src_do_sync (GstBaseSrc * basesrc, GstBuffer * buffer)
|
|||
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)) {
|
||||
|
@ -1524,6 +1527,9 @@ gst_base_src_do_sync (GstBaseSrc * basesrc, GstBuffer * buffer)
|
|||
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
|
||||
|
@ -1534,6 +1540,9 @@ gst_base_src_do_sync (GstBaseSrc * basesrc, GstBuffer * buffer)
|
|||
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 */
|
||||
|
@ -1548,6 +1557,16 @@ gst_base_src_do_sync (GstBaseSrc * basesrc, GstBuffer * buffer)
|
|||
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,
|
||||
|
|
Loading…
Reference in a new issue