Commit 235e29da authored by bcoudurier's avatar bcoudurier

fix ctts index computation when seeking, check must be done against next ctts...

fix ctts index computation when seeking, check must be done against next ctts sample, thanks to Uoti

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@9007 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent feefca76
...@@ -1525,12 +1525,13 @@ static int mov_seek_stream(AVStream *st, int64_t timestamp, int flags) ...@@ -1525,12 +1525,13 @@ static int mov_seek_stream(AVStream *st, int64_t timestamp, int flags)
if (sc->ctts_data) { if (sc->ctts_data) {
time_sample = 0; time_sample = 0;
for (i = 0; i < sc->ctts_count; i++) { for (i = 0; i < sc->ctts_count; i++) {
time_sample += sc->ctts_data[i].count; int next = time_sample + sc->ctts_data[i].count;
if (time_sample >= sc->current_sample) { if (next > sc->current_sample) {
sc->sample_to_ctime_index = i; sc->sample_to_ctime_index = i;
sc->sample_to_ctime_sample = time_sample - sc->current_sample; sc->sample_to_ctime_sample = sc->current_sample - time_sample;
break; break;
} }
time_sample = next;
} }
} }
return sample; return sample;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment