summaryrefslogtreecommitdiff
path: root/gst/multifile
diff options
context:
space:
mode:
Diffstat (limited to 'gst/multifile')
-rw-r--r--gst/multifile/gstsplitmuxpartreader.c2
-rw-r--r--gst/multifile/gstsplitmuxsink.c17
-rw-r--r--gst/multifile/gstsplitmuxsink.h1
3 files changed, 15 insertions, 5 deletions
diff --git a/gst/multifile/gstsplitmuxpartreader.c b/gst/multifile/gstsplitmuxpartreader.c
index fc87f81d3..6e92c7101 100644
--- a/gst/multifile/gstsplitmuxpartreader.c
+++ b/gst/multifile/gstsplitmuxpartreader.c
@@ -905,7 +905,7 @@ type_found (GstElement * typefind, guint probability,
gst_bin_add (GST_BIN_CAST (reader), demux);
gst_element_link_pads (reader->typefind, "src", demux, NULL);
- gst_element_set_state (reader->demux, GST_STATE_PLAYING);
+ gst_element_sync_state_with_parent (reader->demux);
/* Connect to demux signals */
g_signal_connect (demux,
diff --git a/gst/multifile/gstsplitmuxsink.c b/gst/multifile/gstsplitmuxsink.c
index 6da34e3ab..91d7fc4cd 100644
--- a/gst/multifile/gstsplitmuxsink.c
+++ b/gst/multifile/gstsplitmuxsink.c
@@ -487,8 +487,10 @@ complete_or_wait_on_out (GstSplitMuxSink * splitmux, MqStreamCtx * ctx)
GST_TIME_ARGS (splitmux->max_out_running_time));
if (splitmux->max_out_running_time == GST_CLOCK_TIME_NONE ||
- ctx->out_running_time < splitmux->max_out_running_time)
+ ctx->out_running_time < splitmux->max_out_running_time) {
+ splitmux->have_muxed_something = TRUE;
return;
+ }
if (ctx->flushing || splitmux->state == SPLITMUX_STATE_STOPPED)
return;
@@ -678,10 +680,15 @@ start_next_fragment (GstSplitMuxSink * splitmux)
/* Switch state and go back to processing */
splitmux->state = SPLITMUX_STATE_COLLECTING_GOP_START;
- if (!splitmux->video_ctx->in_eos)
+
+ if (!splitmux->video_ctx->in_eos) {
splitmux->max_out_running_time = splitmux->video_ctx->in_running_time;
- else
+ } else {
splitmux->max_out_running_time = GST_CLOCK_TIME_NONE;
+ splitmux->have_muxed_something = FALSE;
+ }
+ splitmux->have_muxed_something =
+ (splitmux->video_ctx->in_running_time > splitmux->muxed_out_time);
/* Store the overflow parameters as the basis for the next fragment */
splitmux->mux_start_time = splitmux->muxed_out_time;
@@ -759,7 +766,7 @@ handle_gathered_gop (GstSplitMuxSink * splitmux)
/* Check for overrun - have we output at least one byte and overrun
* either threshold? */
- if ((splitmux->mux_start_bytes < splitmux->muxed_out_bytes) &&
+ if (splitmux->have_muxed_something &&
((splitmux->threshold_bytes > 0 &&
queued_bytes >= splitmux->threshold_bytes) ||
(splitmux->threshold_time > 0 &&
@@ -782,6 +789,8 @@ handle_gathered_gop (GstSplitMuxSink * splitmux)
/* Wake everyone up to push this one GOP, then sleep */
splitmux->state = SPLITMUX_STATE_COLLECTING_GOP_START;
+ splitmux->have_muxed_something = TRUE;
+
if (!splitmux->video_ctx->in_eos)
splitmux->max_out_running_time = splitmux->video_ctx->in_running_time;
else
diff --git a/gst/multifile/gstsplitmuxsink.h b/gst/multifile/gstsplitmuxsink.h
index f38376733..a305ed4e0 100644
--- a/gst/multifile/gstsplitmuxsink.h
+++ b/gst/multifile/gstsplitmuxsink.h
@@ -118,6 +118,7 @@ struct _GstSplitMuxSink {
GstClockTime muxed_out_time;
gsize muxed_out_bytes;
+ gboolean have_muxed_something;
GstClockTime mux_start_time;
gsize mux_start_bytes;