[Bug 792434] gstbasesink: Include segment.offset in the computation of position

GStreamer (GNOME Bugzilla) bugzilla at gnome.org
Thu Jan 11 20:23:06 UTC 2018


https://bugzilla.gnome.org/show_bug.cgi?id=792434

--- Comment #4 from Thibault Saunier <tsaunier at gnome.org> ---
(In reply to Sebastian Dröge (slomo) from comment #2)
> It should basically be like gst_segment_to_stream_time(), which also does
> not seem to use the offset. Which IIRC also makes sense because offset is
> related to running time, not stream time.

> Why do you think this is correct? Note that the calculations in the design docs seem to be all about running time, and how to get from there to the stream time.

My first understanding was also that `segment.offset` only applies to the
running_time but then I read the design doc again and the final formula with
the following statement: "This last formula is typically used in sinks to
report the current position in an accurate and efficient way.". The formula:

    stream_time = (S.offset + (absolute_time - base_time - S.base) * ABS
(S.rate)) * ABS (S.applied_rate) + S.time

>From my reading and understanding of the code in `gst_basesink_get_position` we
are using this exact formula modulo the addition of `S.offset`, thus my
statement that this patch looks correct to me. Now afaiu, in
`gst_segment_to_stream_time()` we use:

    stream_time = (position - S.start) * ABS (S.applied_rate) + S.time

which indeed does not take `S.offset` into account.

Afaiu from the design doc those formulas are equivalent.

Now I am confused and might be mistaking or have misunderstood the code :-)

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list