summaryrefslogtreecommitdiff
path: root/gst/multifile/gstsplitmuxsink.c
diff options
context:
space:
mode:
Diffstat (limited to 'gst/multifile/gstsplitmuxsink.c')
-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 */