decklink: Reset the clock calibration when unsetting the master clock
authorSebastian Dröge <sebastian@centricular.com>
Mon, 2 Mar 2015 15:45:45 +0000 (16:45 +0100)
committerSebastian Dröge <sebastian@centricular.com>
Mon, 2 Mar 2015 15:45:45 +0000 (16:45 +0100)
Otherwise the old calibration will stick around for the next time we use it,
potentially giving us completely wrong times.

sys/decklink/gstdecklinkvideosink.cpp
sys/decklink/gstdecklinkvideosrc.cpp

index 3bccca7..0096d9e 100644 (file)
@@ -705,6 +705,8 @@ gst_decklink_video_sink_change_state (GstElement * element,
           gst_message_new_clock_lost (GST_OBJECT_CAST (element),
               self->output->clock));
       gst_clock_set_master (self->output->clock, NULL);
+      // Reset calibration to make the clock reusable next time we use it
+      gst_clock_set_calibration (self->output->clock, 0, 0, 1, 1);
       g_mutex_lock (&self->output->lock);
       self->output->clock_start_time = GST_CLOCK_TIME_NONE;
       self->output->clock_last_time = 0;
index b600634..0432e8c 100644 (file)
@@ -765,6 +765,8 @@ gst_decklink_video_src_change_state (GstElement * element,
           gst_message_new_clock_lost (GST_OBJECT_CAST (element),
               self->input->clock));
       gst_clock_set_master (self->input->clock, NULL);
+      // Reset calibration to make the clock reusable next time we use it
+      gst_clock_set_calibration (self->input->clock, 0, 0, 1, 1);
       g_mutex_lock (&self->input->lock);
       self->input->clock_start_time = GST_CLOCK_TIME_NONE;
       self->input->clock_last_time = 0;