splitmuxsink: Warn when calculating the next fragment time in timecode mode fails
authorSebastian Dröge <sebastian@centricular.com>
Mon, 24 Jan 2022 08:45:33 +0000 (10:45 +0200)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Tue, 25 Jan 2022 12:08:20 +0000 (12:08 +0000)
But only if timecode mode is enabled as it will fail all the time
otherwise.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1557>

subprojects/gst-plugins-good/gst/multifile/gstsplitmuxsink.c

index 080510e..1846f42 100644 (file)
@@ -792,11 +792,13 @@ gst_splitmux_sink_set_property (GObject * object, guint prop_id,
           splitmux->threshold_timecode_str = NULL;
         }
       }
-      splitmux->next_fragment_start_tc_time = GST_CLOCK_TIME_NONE;
-      if (splitmux->tc_interval && splitmux->fragment_start_tc) {
-        splitmux->next_fragment_start_tc_time =
-            calculate_next_max_timecode (splitmux, splitmux->fragment_start_tc,
-            splitmux->fragment_start_time, NULL);
+      splitmux->next_fragment_start_tc_time =
+          calculate_next_max_timecode (splitmux, splitmux->fragment_start_tc,
+          splitmux->fragment_start_time, NULL);
+      if (splitmux->tc_interval && splitmux->fragment_start_tc
+          && !GST_CLOCK_TIME_IS_VALID (splitmux->next_fragment_start_tc_time)) {
+        GST_WARNING_OBJECT (splitmux,
+            "Couldn't calculate next fragment start time for timecode mode");
       }
       GST_OBJECT_UNLOCK (splitmux);
       break;
@@ -1540,6 +1542,11 @@ request_next_keyframe (GstSplitMuxSink * splitmux, GstBuffer * buffer,
 
       timecode_based = GST_CLOCK_TIME_IS_VALID (max_tc_time) &&
           GST_CLOCK_TIME_IS_VALID (next_max_tc_time);
+
+      if (!timecode_based) {
+        GST_WARNING_OBJECT (splitmux,
+            "Couldn't calculate maximum fragment time for timecode mode");
+      }
     } else {
       /* This can happen in the presence of GAP events that trigger
        * a new fragment start */
@@ -2541,7 +2548,8 @@ handle_gathered_gop (GstSplitMuxSink * splitmux, const InputGop * gop,
     splitmux->next_fragment_start_tc_time =
         calculate_next_max_timecode (splitmux, splitmux->fragment_start_tc,
         splitmux->fragment_start_time, NULL);
-    if (!GST_CLOCK_TIME_IS_VALID (splitmux->next_fragment_start_tc_time)) {
+    if (splitmux->tc_interval && splitmux->fragment_start_tc
+        && !GST_CLOCK_TIME_IS_VALID (splitmux->next_fragment_start_tc_time)) {
       GST_WARNING_OBJECT (splitmux,
           "Couldn't calculate next fragment start time for timecode mode");
     }
@@ -2969,7 +2977,12 @@ handle_mq_input (GstPad * pad, GstPadProbeInfo * info, MqStreamCtx * ctx)
         splitmux->next_fragment_start_tc_time =
             calculate_next_max_timecode (splitmux, &tc_meta->tc,
             running_time, NULL);
-
+        if (splitmux->tc_interval
+            && !GST_CLOCK_TIME_IS_VALID (splitmux->next_fragment_start_tc_time))
+        {
+          GST_WARNING_OBJECT (splitmux,
+              "Couldn't calculate next fragment start time for timecode mode");
+        }
 #ifndef GST_DISABLE_GST_DEBUG
         {
           gchar *tc_str;