decklinksrc: Reset timestamp observations on format change

We will usually get timestamps starting from 0 again and due to the
format change the clock of the input might also be different.
This commit is contained in:
Sebastian Dröge 2019-07-22 17:57:01 +03:00
parent 733c109ce9
commit b4b911da4d

View file

@ -887,6 +887,27 @@ public:
m_input->input->EnableVideoInput (mode->GetDisplayMode (),
pixelFormat, bmdVideoInputEnableFormatDetection);
m_input->input->FlushStreams ();
/* Reset any timestamp observations we might've made */
if (m_input->videosrc) {
GstDecklinkVideoSrc *videosrc = GST_DECKLINK_VIDEO_SRC (m_input->videosrc);
g_mutex_lock (&videosrc->lock);
videosrc->window_fill = 0;
videosrc->window_filled = FALSE;
videosrc->window_skip = 1;
videosrc->window_skip_count = 0;
videosrc->current_time_mapping.xbase = 0;
videosrc->current_time_mapping.b = 0;
videosrc->current_time_mapping.num = 1;
videosrc->current_time_mapping.den = 1;
videosrc->next_time_mapping.xbase = 0;
videosrc->next_time_mapping.b = 0;
videosrc->next_time_mapping.num = 1;
videosrc->next_time_mapping.den = 1;
g_mutex_unlock (&videosrc->lock);
}
m_input->input->StartStreams ();
m_input->mode =
gst_decklink_get_mode (gst_decklink_get_mode_enum_from_bmd