mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-23 07:38:16 +00:00
decklinkvideosrc: Apply the diff between element and pipeline "base" time in all cases
Even if both clocks have the same rate, we need to apply this diff. Only when it's the same clock we don't, as it's our clock then.
This commit is contained in:
parent
f83ac624e3
commit
9ed4054a94
1 changed files with 13 additions and 12 deletions
|
@ -376,28 +376,18 @@ gst_decklink_video_src_convert_to_external_clock (GstDecklinkVideoSrc * self,
|
|||
clock = gst_element_get_clock (GST_ELEMENT_CAST (self));
|
||||
if (clock && clock != self->input->clock) {
|
||||
GstClockTime internal, external, rate_n, rate_d;
|
||||
GstClockTimeDiff external_start_time_diff;
|
||||
|
||||
gst_clock_get_calibration (self->input->clock, &internal, &external,
|
||||
&rate_n, &rate_d);
|
||||
|
||||
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
|
||||
|
@ -437,6 +427,17 @@ gst_decklink_video_src_convert_to_external_clock (GstDecklinkVideoSrc * self,
|
|||
} else {
|
||||
GST_LOG_OBJECT (self, "No clock conversion needed, relative rate is 1.0");
|
||||
}
|
||||
|
||||
// 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;
|
||||
*timestamp += external_start_time_diff;
|
||||
} else {
|
||||
GST_LOG_OBJECT (self, "No clock conversion needed, same clocks");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue