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).


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29741 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2009-09-30 08:19:49 +00:00
parent 70cdf76c6a
commit 1ad332f8a5
1 changed files with 4 additions and 1 deletions

View File

@ -617,7 +617,10 @@ static void demux_seek_lavf(demuxer_t *demuxer, float rel_seek_secs, float audio
} 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)