To calculate a buffer running-time, we need a buffer timestamp and
the SEGMENT event that preceded the buffer. First we can convert
the SEGMENT event into a
and then we can use the
gst_segment_to_running_time () function to
perform the calculation of the buffer running-time.
Synchronization is now a matter of making sure that a buffer with a certain running-time is played when the clock reaches the same running-time. Usually this task is done by sink elements. Sink also have to take into account the latency configured in the pipeline and add this to the buffer running-time before synchronizing to the pipeline clock.