Timestamping buffers with live and non-live sources

Sebastian Dröge slomo at coaxion.net
Thu Oct 17 20:50:24 CEST 2013


On Do, 2013-10-17 at 09:31 -0700, Bob Barker wrote:
> Hi All,
> 
> We’re new to GStreamer, writing our own elements and trying to understand
> the implications of these excerpts from the GStreamer Plugin Writers Guide:
> 
> Sec 18.4.1 Non-live source elements
> 
> “They must choose the timestamps and the values of the SEGMENT event in
> such a way that the
> 
> *running-time of the buffer starts from 0.” *
> 
> Sec 18.4.2 Live Source Elements
> 
> They must choose the timestamps and the values of the SEGMENT event in such
> a way that the *running-time of the buffer* *matches exactly the
> running-time of the pipeline clock when the first byte in the buffer was
> captured.*
>
> Questions:
> 
> -For live sources:  does this mean that if a buffer was captured live at
> time 1934234.34, the timestamp is also 1934234.34?

The timestamp alone is irrelevant here. Important is the relation of the
timestamp with the configured segment. The running time of every buffer
should be equivalent to the running time of the clock when the buffer
was captured. That means that the running time of that buffer should be
the current clock time (of the current pipeline clock) minus the base
time of the pipeline.

The running time of the buffer is calculated from the timestamp of the
buffer and the segment information as is done in the code of
gst_segment_to_running_time(), basically (for positive rate):
rtime = segment.base + segment.rate*(timestamp - (segment.start + segment.offset))

> -For live sources: When is the base time snapped? When the sensor captures
> the first sample? When the first element retrieves the first sample?

When the element reaches the PLAYING state, so very soon after it is set
to PLAYING.

> We went through the tutorial at
> 
> http://docs.gstreamer.com/display/GstSDK/Tutorials
> 
> and couldn’t find anything explaining this. If there’s some documentation
> clarifying all this, please point us at it.

That documentation is only targeted at playback use cases from the
application side (and only for 0.10 anyway). The only documentation I'm
aware of that contains these things is the design documentation in
gstreamer/docs/design.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 966 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20131017/ed75c68b/attachment.pgp>


More information about the gstreamer-devel mailing list