matroskademux: increase NEWSEGMENT accuracy after seeking

demux->common.segment is populated during seek handling with the target
start/stop positions. Don't override them when sending out a NEWSEGMENT.

Conflicts:

	gst/matroska/matroska-demux.c
This commit is contained in:
Alessandro Decina 2012-04-19 08:37:28 +02:00 committed by Sebastian Dröge
parent 66d95d808c
commit 51c8cd805d

View file

@ -1975,10 +1975,10 @@ gst_matroska_demux_handle_seek_event (GstMatroskaDemux * demux,
* would be determined again when parsing, but anyway ... */
seeksegment.duration = demux->common.segment.duration;
flush = !!(flags & GST_SEEK_FLAG_FLUSH);
keyunit = !!(flags & GST_SEEK_FLAG_KEY_UNIT);
after = !!(flags & GST_SEEK_FLAG_SNAP_AFTER);
before = !!(flags & GST_SEEK_FLAG_SNAP_BEFORE);
flush = ! !(flags & GST_SEEK_FLAG_FLUSH);
keyunit = ! !(flags & GST_SEEK_FLAG_KEY_UNIT);
after = ! !(flags & GST_SEEK_FLAG_SNAP_AFTER);
before = ! !(flags & GST_SEEK_FLAG_SNAP_BEFORE);
GST_DEBUG_OBJECT (demux, "New segment %" GST_SEGMENT_FORMAT, &seeksegment);
@ -3432,14 +3432,19 @@ gst_matroska_demux_parse_blockgroup_or_simpleblock (GstMatroskaDemux * demux,
"Setting stream start time to %" GST_TIME_FORMAT,
GST_TIME_ARGS (lace_time));
}
if (GST_CLOCK_TIME_IS_VALID (segment->stop))
segment_duration = segment->stop - segment->start;
else if (GST_CLOCK_TIME_IS_VALID (segment->position))
segment_duration = segment->position - segment->start;
segment->base += segment_duration / fabs (segment->rate);
segment->start = MAX (lace_time, demux->stream_start_time);
segment->stop = GST_CLOCK_TIME_NONE;
segment->position = segment->start - demux->stream_start_time;
if (demux->common.segment.start == 0) {
/* set segment fields only if they weren't already set by seek handling
* code
*/
if (GST_CLOCK_TIME_IS_VALID (segment->stop))
segment_duration = segment->stop - segment->start;
else if (GST_CLOCK_TIME_IS_VALID (segment->position))
segment_duration = segment->position - segment->start;
segment->base += segment_duration / fabs (segment->rate);
segment->start = MAX (lace_time, demux->stream_start_time);
segment->stop = GST_CLOCK_TIME_NONE;
segment->position = segment->start - demux->stream_start_time;
}
/* now convey our segment notion downstream */
gst_matroska_demux_send_event (demux, gst_event_new_segment (segment));
demux->need_segment = FALSE;