From f6cc65a6bca0f83d829447314bd8e6eb471f0767 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 31 Jan 2025 14:40:27 +0200 Subject: [PATCH] splitmuxsink: Be less strict about queueing negative durations In case of temporary backwards timestamps durations can become negative. Instead of erroring out, simply clip the durations and warn. Part-of: --- .../gst/multifile/gstsplitmuxsink.c | 29 ++++++++----------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxsink.c b/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxsink.c index e3a7a82de9..f77da99a72 100644 --- a/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxsink.c +++ b/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxsink.c @@ -2669,11 +2669,19 @@ handle_gathered_gop (GstSplitMuxSink * splitmux, const InputGop * gop, GST_STIME_ARGS (queued_time), queued_bytes, GST_STIME_ARGS (next_gop_start_time), GST_STIME_ARGS (gop->start_time)); - if (queued_gop_time < 0) - goto error_gop_duration; + if (queued_gop_time < 0) { + GST_WARNING_OBJECT (splitmux, + "Queued GOP time is negative %" GST_STIME_FORMAT, + -GST_STIME_ARGS (queued_gop_time)); + queued_gop_time = 0; + } - if (queued_time < splitmux->fragment_start_time) - goto error_queued_time; + if (queued_time < splitmux->fragment_start_time) { + GST_WARNING_OBJECT (splitmux, + "Queued time is negative. Input went backwards. queued_time - %" + GST_STIME_FORMAT, GST_STIME_ARGS (queued_time)); + queued_time = splitmux->fragment_start_time; + } queued_time -= splitmux->fragment_start_time; if (queued_time < queued_gop_time) @@ -2743,19 +2751,6 @@ handle_gathered_gop (GstSplitMuxSink * splitmux, const InputGop * gop, } return; - -error_gop_duration: - GST_ELEMENT_ERROR (splitmux, - STREAM, FAILED, ("Timestamping error on input streams"), - ("Queued GOP time is negative %" GST_STIME_FORMAT, - GST_STIME_ARGS (queued_gop_time))); - return; -error_queued_time: - GST_ELEMENT_ERROR (splitmux, - STREAM, FAILED, ("Timestamping error on input streams"), - ("Queued time is negative. Input went backwards. queued_time - %" - GST_STIME_FORMAT, GST_STIME_ARGS (queued_time))); - return; } /* Called with splitmux lock held */