mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
splitmuxsrc: Avoid stall when parts get out of sync
When one part moves ahead of the others - due to excessive downstream queueing, or really small input files - then we can end up activating parts more than once. That can lead to effects like shutting down pad tasks prematurely. https://bugzilla.gnome.org/show_bug.cgi?id=772138
This commit is contained in:
parent
628af4f091
commit
f8d7a2a0af
3 changed files with 28 additions and 13 deletions
|
@ -1185,6 +1185,18 @@ gst_splitmux_part_reader_activate (GstSplitMuxPartReader * reader,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_splitmux_part_reader_is_active (GstSplitMuxPartReader * part)
|
||||
{
|
||||
gboolean ret;
|
||||
|
||||
SPLITMUX_PART_LOCK (part);
|
||||
ret = part->active;
|
||||
SPLITMUX_PART_UNLOCK (part);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
gst_splitmux_part_reader_deactivate (GstSplitMuxPartReader * reader)
|
||||
{
|
||||
|
|
|
@ -103,6 +103,7 @@ gboolean gst_splitmux_part_is_eos (GstSplitMuxPartReader *reader);
|
|||
|
||||
gboolean gst_splitmux_part_reader_activate (GstSplitMuxPartReader *part, GstSegment *seg);
|
||||
void gst_splitmux_part_reader_deactivate (GstSplitMuxPartReader *part);
|
||||
gboolean gst_splitmux_part_reader_is_active (GstSplitMuxPartReader *part);
|
||||
|
||||
gboolean gst_splitmux_part_reader_src_query (GstSplitMuxPartReader *part, GstPad *src_pad, GstQuery * query);
|
||||
void gst_splitmux_part_reader_set_start_offset (GstSplitMuxPartReader *part, GstClockTime offset);
|
||||
|
|
|
@ -955,21 +955,23 @@ gst_splitmux_end_of_part (GstSplitMuxSrc * splitmux, SplitMuxSrcPad * splitpad)
|
|||
(GstPad *) (splitpad));
|
||||
|
||||
if (splitmux->cur_part != next_part) {
|
||||
GstSegment tmp;
|
||||
/* If moving backward into a new part, set stop
|
||||
* to -1 to ensure we play the entire file - workaround
|
||||
* a bug in qtdemux that misses bits at the end */
|
||||
gst_segment_copy_into (&splitmux->play_segment, &tmp);
|
||||
if (tmp.rate < 0)
|
||||
tmp.stop = -1;
|
||||
if (!gst_splitmux_part_reader_is_active (splitpad->reader)) {
|
||||
GstSegment tmp;
|
||||
/* If moving backward into a new part, set stop
|
||||
* to -1 to ensure we play the entire file - workaround
|
||||
* a bug in qtdemux that misses bits at the end */
|
||||
gst_segment_copy_into (&splitmux->play_segment, &tmp);
|
||||
if (tmp.rate < 0)
|
||||
tmp.stop = -1;
|
||||
|
||||
/* This is the first pad to move to the new part, activate it */
|
||||
/* This is the first pad to move to the new part, activate it */
|
||||
GST_DEBUG_OBJECT (splitpad,
|
||||
"First pad to change part. Activating part %d with seg %"
|
||||
GST_SEGMENT_FORMAT, next_part, &tmp);
|
||||
if (!gst_splitmux_part_reader_activate (splitpad->reader, &tmp))
|
||||
goto error;
|
||||
}
|
||||
splitmux->cur_part = next_part;
|
||||
GST_DEBUG_OBJECT (splitpad,
|
||||
"First pad to change part. Activating part %d with seg %"
|
||||
GST_SEGMENT_FORMAT, next_part, &tmp);
|
||||
if (!gst_splitmux_part_reader_activate (splitpad->reader, &tmp))
|
||||
goto error;
|
||||
}
|
||||
res = TRUE;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue