ccconverter: reintroduce frame count reset on cycle completion
authorMatthew Waters <matthew@centricular.com>
Wed, 29 Mar 2023 23:11:11 +0000 (10:11 +1100)
committerTim-Philipp Müller <tim@centricular.com>
Wed, 19 Apr 2023 12:35:38 +0000 (13:35 +0100)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4453>

subprojects/gst-plugins-bad/ext/closedcaption/gstccconverter.c

index 8623913..aa451bb 100644 (file)
@@ -591,6 +591,11 @@ can_take_buffer (GstCCConverter * self,
   output_time_cmp = gst_util_fraction_compare (input_frame_n, input_frame_d,
       output_frame_n, output_frame_d);
 
+  if (output_time_cmp == 0) {
+    self->output_frames = 0;
+    self->input_frames = 0;
+  }
+
   in_fps_entry = cdp_fps_entry_from_fps (self->in_fps_n, self->in_fps_d);
   if (!in_fps_entry || in_fps_entry->fps_n == 0)
     g_assert_not_reached ();
@@ -1455,6 +1460,11 @@ can_generate_output (GstCCConverter * self)
   output_time_cmp = gst_util_fraction_compare (input_frame_n, input_frame_d,
       output_frame_n, output_frame_d);
 
+  if (output_time_cmp == 0) {
+    self->output_frames = 0;
+    self->input_frames = 0;
+  }
+
   /* if the next output frame is at or before the current input frame */
   if (output_time_cmp >= 0)
     return TRUE;