mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
splitmuxsink: Never start a new fragment with no reference buffers
If there has been no bytes from the reference stream muxed into the current fragment, then time can't have advanced, there's no GOP... this fragment would be broken or empty, so wait for some data on the reference buffer. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/798>
This commit is contained in:
parent
537e7d873a
commit
1316dd9c65
2 changed files with 13 additions and 2 deletions
|
@ -2186,8 +2186,10 @@ need_new_fragment (GstSplitMuxSink * splitmux,
|
|||
&& splitmux->muxer_has_reserved_props;
|
||||
GST_OBJECT_UNLOCK (splitmux);
|
||||
|
||||
/* Have we muxed anything into the new file at all? */
|
||||
if (splitmux->fragment_total_bytes <= 0)
|
||||
/* Have we muxed at least one thing from the reference
|
||||
* stream into the file? If not, no other streams can have
|
||||
* either */
|
||||
if (splitmux->fragment_reference_bytes <= 0)
|
||||
return FALSE;
|
||||
|
||||
/* User told us to split now */
|
||||
|
@ -2361,6 +2363,7 @@ handle_gathered_gop (GstSplitMuxSink * splitmux)
|
|||
new_out_ts = splitmux->reference_ctx->in_running_time;
|
||||
splitmux->fragment_start_time = splitmux->gop_start_time;
|
||||
splitmux->fragment_total_bytes = 0;
|
||||
splitmux->fragment_reference_bytes = 0;
|
||||
|
||||
if (splitmux->tc_interval) {
|
||||
video_time_code_replace (&splitmux->fragment_start_tc,
|
||||
|
@ -2800,6 +2803,9 @@ handle_mq_input (GstPad * pad, GstPadProbeInfo * info, MqStreamCtx * ctx)
|
|||
|
||||
/* Update total input byte counter for overflow detect */
|
||||
splitmux->gop_total_bytes += buf_info->buf_size;
|
||||
if (ctx->is_reference) {
|
||||
splitmux->fragment_reference_bytes += buf_info->buf_size;
|
||||
}
|
||||
|
||||
/* Now add this buffer to the queue just before returning */
|
||||
g_queue_push_head (&ctx->queued_bufs, buf_info);
|
||||
|
@ -3494,6 +3500,7 @@ gst_splitmux_sink_reset (GstSplitMuxSink * splitmux)
|
|||
GST_CLOCK_STIME_NONE;
|
||||
splitmux->max_out_running_time = 0;
|
||||
splitmux->fragment_total_bytes = 0;
|
||||
splitmux->fragment_reference_bytes = 0;
|
||||
splitmux->gop_total_bytes = 0;
|
||||
splitmux->muxed_out_bytes = 0;
|
||||
splitmux->ready_for_output = FALSE;
|
||||
|
|
|
@ -144,6 +144,10 @@ struct _GstSplitMuxSink
|
|||
/* Number of bytes sent to the
|
||||
* current fragment */
|
||||
guint64 fragment_total_bytes;
|
||||
/* Number of bytes for the reference
|
||||
* stream in this fragment */
|
||||
guint64 fragment_reference_bytes;
|
||||
|
||||
/* Number of bytes we've collected into
|
||||
* the GOP that's being collected */
|
||||
guint64 gop_total_bytes;
|
||||
|
|
Loading…
Reference in a new issue