seek: Fix av_gen_search() so that seeks outside max/min do not successfully seek to random

points but rather seek to the min/max.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer
2011-10-21 20:45:00 +02:00
parent 7846280d1d
commit 27f7589ab1
7 changed files with 63 additions and 44 deletions

View File

@@ -1621,6 +1621,11 @@ int64_t av_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts, i
return -1;
}
if(ts_min >= target_ts){
*ts_ret= ts_min;
return pos_min;
}
if(ts_max == AV_NOPTS_VALUE){
int step= 1024;
filesize = avio_size(s->pb);
@@ -1646,6 +1651,11 @@ int64_t av_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts, i
pos_limit= pos_max;
}
if(ts_max <= target_ts){
*ts_ret= ts_max;
return pos_max;
}
if(ts_min > ts_max){
return -1;
}else if(ts_min == ts_max){