summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gst/isomp4/qtdemux.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c
index 23be06171..0ac2d6983 100644
--- a/gst/isomp4/qtdemux.c
+++ b/gst/isomp4/qtdemux.c
@@ -2028,11 +2028,23 @@ gst_qtdemux_handle_sink_event (GstPad * sinkpad, GstObject * parent,
segment.duration = demux->segment.duration;
segment.base = gst_segment_to_running_time (&demux->segment,
GST_FORMAT_TIME, demux->segment.position);
+ if (demux->n_streams == 0 && segment.start != 0) {
+ GstClockTime backdrift = segment.start;
+ /* If this is not a segment update, we shift the segment start/stop */
+ GST_DEBUG_OBJECT (demux, "Shifting segment back by %" GST_TIME_FORMAT,
+ GST_TIME_ARGS (backdrift));
+ segment.start = 0;
+ segment.position = 0;
+ segment.base = 0;
+ if (GST_CLOCK_TIME_IS_VALID (segment.stop))
+ segment.stop -= backdrift;
+ }
gst_segment_copy_into (&segment, &demux->segment);
GST_DEBUG_OBJECT (demux, "Pushing newseg %" GST_SEGMENT_FORMAT, &segment);
segment_event = gst_event_new_segment (&segment);
gst_event_set_seqnum (segment_event, gst_event_get_seqnum (event));
+ gst_event_replace (&demux->pending_newsegment, segment_event);
gst_qtdemux_push_event (demux, segment_event);
/* clear leftover in current segment, if any */