avformat/utils: fix timebase error in avformat_seek_file()
authorXinzheng Zhang <zhangxzheng@gmail.com>
Wed, 14 Sep 2016 08:13:45 +0000 (16:13 +0800)
committerMichael Niedermayer <michael@niedermayer.cc>
Wed, 14 Sep 2016 13:50:07 +0000 (15:50 +0200)
When there is only one stream and stream_index has not specified,
The ts has been transferd by the timebase of stream0 without modifying the stream_index
In this condation it cause seek failure.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/utils.c

index cbaeef0..d605a96 100644 (file)
@@ -2418,6 +2418,7 @@ int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts,
             max_ts = av_rescale_rnd(max_ts, time_base.den,
                                     time_base.num * (int64_t)AV_TIME_BASE,
                                     AV_ROUND_DOWN | AV_ROUND_PASS_MINMAX);
+            stream_index = 0;
         }
 
         ret = s->iformat->read_seek2(s, stream_index, min_ts,