mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-12 01:40:04 +01:00
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:
@@ -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){
|
||||
|
||||
Reference in New Issue
Block a user