summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Schmidt <jan@centricular.com>2020-08-18 16:06:14 +1000
committerTim-Philipp Müller <tim@centricular.com>2020-12-14 09:57:15 +0000
commite00810b2d03e7711d9b0e5624189dd75593b99ab (patch)
treee3603d38537312a3f70dea671b330a0752622d73
parent2e2eb43758de6aca8a040f2c1fc757c76219d974 (diff)
downloadgstreamer-plugins-good-e00810b2d03e7711d9b0e5624189dd75593b99ab.tar.gz
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: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/840>
-rw-r--r--gst/multifile/gstsplitmuxsink.c34
1 files changed, 25 insertions, 9 deletions
diff --git a/gst/multifile/gstsplitmuxsink.c b/gst/multifile/gstsplitmuxsink.c
index 185b4ad5a..2c5c5ed20 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 */