timecodestamper: Validate LTC timestamps before trying to use them

There's no point in working with invalid LTC timestamps as all future
calculations will be wrong based on this, and invalid LTC timestamps can
sometimes be read via the audio input.
This commit is contained in:
Sebastian Dröge 2019-07-25 18:27:30 +03:00
parent e5585b1bde
commit aafda1c76f

View file

@ -1089,10 +1089,17 @@ gst_timecodestamper_transform_ip (GstBaseTransform * vfilter,
if (timecodestamper->ltc_auto_resync) {
if (timecodestamper->ltc_internal_tc)
gst_video_time_code_free (timecodestamper->ltc_internal_tc);
timecodestamper->ltc_internal_tc =
gst_video_time_code_copy (ltc_read_tc_ptr);
updated_internal = TRUE;
GST_INFO_OBJECT (timecodestamper, "Resynced internal LTC counter");
if (gst_video_time_code_is_valid (ltc_read_tc_ptr)) {
timecodestamper->ltc_internal_tc =
gst_video_time_code_copy (ltc_read_tc_ptr);
updated_internal = TRUE;
GST_INFO_OBJECT (timecodestamper, "Resynced internal LTC counter");
} else {
tc_str = gst_video_time_code_to_string (ltc_read_tc_ptr);
GST_INFO_OBJECT (timecodestamper, "Invalid LTC timecode %s",
tc_str);
g_free (tc_str);
}
}
/* And store it for the next frame in case it has more or less the