summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2015-02-10 15:30:44 +0100
committerSebastian Dröge <sebastian@centricular.com>2015-02-10 15:30:44 +0100
commitf83ac624e3e88bd06e932596e052c5848dce462d (patch)
treed676bc498cc5da04b5fd7f318c2f6be4ef6af173
parentd4575e759ba17a20f428b398825596f2e8acd715 (diff)
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.
-rw-r--r--sys/decklink/gstdecklinkvideosrc.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/sys/decklink/gstdecklinkvideosrc.cpp b/sys/decklink/gstdecklinkvideosrc.cpp
index 08d8b287a..0d65814cb 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