From: Jan Schmidt Date: Tue, 18 Aug 2020 06:06:14 +0000 (+1000) Subject: splitmuxsink: Convert asserts into element errors. X-Git-Tag: 1.19.3~509^2~332 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=df8b147e750078eb9cacd2f19b2722e491181ce2;p=platform%2Fupstream%2Fgstreamer.git splitmuxsink: Convert asserts into element errors. Change some g_assert into element errors so that they can be caught and the pipeline shut down. Part-of: --- diff --git a/gst/multifile/gstsplitmuxsink.c b/gst/multifile/gstsplitmuxsink.c index 185b4ad..2c5c5ed 100644 --- a/gst/multifile/gstsplitmuxsink.c +++ b/gst/multifile/gstsplitmuxsink.c @@ -2339,9 +2339,18 @@ handle_gathered_gop (GstSplitMuxSink * splitmux) splitmux->reference_ctx->in_running_time - splitmux->gop_start_time; GST_LOG_OBJECT (splitmux, " queued_bytes %" G_GUINT64_FORMAT, queued_bytes); + GST_LOG_OBJECT (splitmux, "mq at TS %" GST_STIME_FORMAT + " bytes %" G_GUINT64_FORMAT " in running time %" GST_STIME_FORMAT + " gop start time %" GST_STIME_FORMAT, + GST_STIME_ARGS (queued_time), queued_bytes, + GST_STIME_ARGS (splitmux->reference_ctx->in_running_time), + GST_STIME_ARGS (splitmux->gop_start_time)); + + if (queued_gop_time < 0) + goto error_gop_duration; - g_assert (queued_gop_time >= 0); - g_assert (queued_time >= splitmux->fragment_start_time); + if (queued_time < splitmux->fragment_start_time) + goto error_queued_time; queued_time -= splitmux->fragment_start_time; if (queued_time < queued_gop_time) @@ -2350,13 +2359,6 @@ handle_gathered_gop (GstSplitMuxSink * splitmux) /* Expand queued bytes estimate by muxer overhead */ queued_bytes += (queued_bytes * splitmux->mux_overhead); - GST_LOG_OBJECT (splitmux, "mq at TS %" GST_STIME_FORMAT - " bytes %" G_GUINT64_FORMAT " in running time %" GST_STIME_FORMAT - " gop start time %" GST_STIME_FORMAT, - GST_STIME_ARGS (queued_time), queued_bytes, - GST_STIME_ARGS (splitmux->reference_ctx->in_running_time), - GST_STIME_ARGS (splitmux->gop_start_time)); - /* Check for overrun - have we output at least one byte and overrun * either threshold? */ if (need_new_fragment (splitmux, queued_time, queued_gop_time, queued_bytes)) { @@ -2435,6 +2437,20 @@ handle_gathered_gop (GstSplitMuxSink * splitmux) } splitmux->gop_total_bytes = 0; + 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 */