From ad45fd18270ef42baf6f46235c5b5600dc6b6171 Mon Sep 17 00:00:00 2001 From: Robert Swain Date: Tue, 16 Feb 2010 12:59:54 +0100 Subject: [PATCH] asfdemux: Improve seek behaviour for audio-only with no index Instead of seeking to seek_time - 5s in the hope of hitting a keyframe for video, we can just seek to seek_time instead. --- gst/asfdemux/gstasfdemux.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gst/asfdemux/gstasfdemux.c b/gst/asfdemux/gstasfdemux.c index 72a7e523e8..f5eccee829 100644 --- a/gst/asfdemux/gstasfdemux.c +++ b/gst/asfdemux/gstasfdemux.c @@ -661,9 +661,12 @@ gst_asf_demux_handle_seek_event (GstASFDemux * demux, GstEvent * event) GST_TIME_ARGS (seek_time), offset, demux->data_offset, demux->packet_size, packet); } else { - /* Hackety hack, this sucks. We just seek to an earlier position - * and let the sinks throw away the stuff before the segment start */ - if (flush && (demux->accurate || keyunit_sync)) { + /* FIXME: For streams containing video, seek to an earlier position in + * the hope of hitting a keyframe and let the sinks throw away the stuff + * before the segment start. For audio-only this is unnecessary as every + * frame is 'key'. */ + if (flush && (demux->accurate || keyunit_sync) + && demux->num_video_streams > 0) { seek_time -= 5 * GST_SECOND; if (seek_time < 0) seek_time = 0;