ff_gen_search: fix infinite loop

Fixes Ticket2639

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f8ca8138f0)
This commit is contained in:
Michael Niedermayer
2013-06-18 20:50:15 +02:00
committed by Carl Eugen Hoyos
parent c77b3737b9
commit c0445df5b3

View File

@@ -1868,7 +1868,7 @@ int64_t ff_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts,
pos_max = FFMAX(0, pos_max - step);
ts_max = ff_read_timestamp(s, stream_index, &pos_max, limit, read_timestamp);
step += step;
}while(ts_max == AV_NOPTS_VALUE && pos_max > 0);
}while(ts_max == AV_NOPTS_VALUE && 2*limit > step);
if (ts_max == AV_NOPTS_VALUE)
return -1;