Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-06-18 22:48:53 +0400
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2013-06-19 01:46:05 +0400
commitc77b3737b9d1bdc27a7ac9ae8d5655c5bb000304 (patch)
treea57b3ba5197ec4900961128744e50a350fd2f687 /libavformat
parent04d69466003ff9496a8238d5d5e8714759662112 (diff)
ff_gen_search: fix limit
The limit value could become slightly wrong in the last iteration Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit b3dd50cd0dbbda08610b75384128f5f47f5199d9)
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/utils.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 1ba9258977..d9c95cf999 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1860,11 +1860,13 @@ int64_t ff_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts,
if(ts_max == AV_NOPTS_VALUE){
int64_t step= 1024;
+ int64_t limit;
filesize = avio_size(s->pb);
pos_max = filesize - 1;
do{
+ limit = pos_max;
pos_max = FFMAX(0, pos_max - step);
- ts_max = ff_read_timestamp(s, stream_index, &pos_max, pos_max + step, read_timestamp);
+ ts_max = ff_read_timestamp(s, stream_index, &pos_max, limit, read_timestamp);
step += step;
}while(ts_max == AV_NOPTS_VALUE && pos_max > 0);
if (ts_max == AV_NOPTS_VALUE)