# HG changeset patch # User reimar # Date 1254298789 0 # Node ID 3819fcdeaaf8999dcf2256c613396d4c8f503206 # Parent 069c927d20d21dad8cb79028f178ead3903896c9 lavf: if seeking in the desired direction failed, also try in the opposite one, otherwise we might end up at some random position (where lavf last ended up while trying to build the index). diff -r 069c927d20d2 -r 3819fcdeaaf8 libmpdemux/demux_lavf.c --- a/libmpdemux/demux_lavf.c Wed Sep 30 07:54:04 2009 +0000 +++ b/libmpdemux/demux_lavf.c Wed Sep 30 08:19:49 2009 +0000 @@ -617,7 +617,10 @@ } else { priv->last_pts += rel_seek_secs * AV_TIME_BASE; } - av_seek_frame(priv->avfc, -1, priv->last_pts, avsflags); + if (av_seek_frame(priv->avfc, -1, priv->last_pts, avsflags) < 0) { + avsflags ^= AVSEEK_FLAG_BACKWARD; + av_seek_frame(priv->avfc, -1, priv->last_pts, avsflags); + } } static int demux_lavf_control(demuxer_t *demuxer, int cmd, void *arg)