decklinkvideosrc: Add the diff between the pipeline base time and when we start to play

Add the diff between the external time when we went to playing and
the external time when the pipeline went to playing. Otherwise we
will always start outputting from 0 instead of the current running
time.
This commit is contained in:
Sebastian Dröge 2015-02-10 15:30:44 +01:00
parent d4575e759b
commit f83ac624e3

View File

@ -381,11 +381,23 @@ gst_decklink_video_src_convert_to_external_clock (GstDecklinkVideoSrc * self,
if (rate_n != rate_d && self->internal_base_time != GST_CLOCK_TIME_NONE) {
GstClockTime internal_timestamp = *timestamp;
GstClockTimeDiff external_start_time_diff;
// Convert to the running time corresponding to both clock times
internal -= self->internal_base_time;
external -= self->external_base_time;
// Add the diff between the external time when we
// went to playing and the external time when the
// pipeline went to playing. Otherwise we will
// always start outputting from 0 instead of the
// current running time.
external_start_time_diff =
gst_element_get_base_time (GST_ELEMENT_CAST (self));
external_start_time_diff =
self->external_base_time - external_start_time_diff;
external += external_start_time_diff;
// Get the difference in the internal time, note
// that the capture time is internal time.
// Then scale this difference and offset it to