From a3c832405eed2d2376d724657c2ee8dd3d398276 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Sun, 28 Jun 2009 17:31:11 +0200 Subject: [PATCH] asfdemux: No longer queue GOPs now that seeking is fixed. We now *always* seek to the keyframe just before our requested position. When we encounter the first keyframe and we were not accurate (therefore doing keyframe seeking), we update the segment start position to the keyframe timestamp. --- gst/asfdemux/gstasfdemux.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/gst/asfdemux/gstasfdemux.c b/gst/asfdemux/gstasfdemux.c index 8124aca9df..c8557ba1ee 100644 --- a/gst/asfdemux/gstasfdemux.c +++ b/gst/asfdemux/gstasfdemux.c @@ -1174,13 +1174,21 @@ gst_asf_demux_find_stream_with_complete_payload (GstASFDemux * demux) last_idx = stream->payloads->len - 1; payload = &g_array_index (stream->payloads, AsfPayload, last_idx); - if (GST_CLOCK_TIME_IS_VALID (payload->ts) && - payload->ts < demux->segment.start) { - GST_DEBUG_OBJECT (stream->pad, "Last queued payload has timestamp %" - GST_TIME_FORMAT " which is before our segment start %" - GST_TIME_FORMAT ", not pushing yet", GST_TIME_ARGS (payload->ts), - GST_TIME_ARGS (demux->segment.start)); - continue; + if (G_UNLIKELY (GST_CLOCK_TIME_IS_VALID (payload->ts) && + (payload->ts < demux->segment.start))) { + if (G_UNLIKELY ((!demux->accurate) && payload->keyframe)) { + GST_DEBUG_OBJECT (stream->pad, + "Found keyframe, updating segment start to %" GST_TIME_FORMAT, + GST_TIME_ARGS (payload->ts)); + demux->segment.start = payload->ts; + demux->segment.time = payload->ts; + } else { + GST_DEBUG_OBJECT (stream->pad, "Last queued payload has timestamp %" + GST_TIME_FORMAT " which is before our segment start %" + GST_TIME_FORMAT ", not pushing yet", GST_TIME_ARGS (payload->ts), + GST_TIME_ARGS (demux->segment.start)); + continue; + } } }