diff --git a/sys/decklink/gstdecklinkvideosrc.cpp b/sys/decklink/gstdecklinkvideosrc.cpp index 08d8b287ac..0d65814cb3 100644 --- a/sys/decklink/gstdecklinkvideosrc.cpp +++ b/sys/decklink/gstdecklinkvideosrc.cpp @@ -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