diff options
author | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2007-05-12 22:02:27 +0000 |
---|---|---|
committer | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2007-05-12 22:02:27 +0000 |
commit | 54a5c7193be19ad781a1df539bd120c3d8987251 (patch) | |
tree | 932ffeccbfcae47c7110d0a5c6029513df9c3196 /libavformat/mov.c | |
parent | d2bc04738b842169b6e32160ffa81db9c868eec4 (diff) | |
download | ffmpeg-54a5c7193be19ad781a1df539bd120c3d8987251.tar.gz |
fix ctts index computation when seeking, check must be done against next ctts sample, thanks to Uoti
Originally committed as revision 9007 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/mov.c')
-rw-r--r-- | libavformat/mov.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c index 5d38ebf550..6f783b3d05 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1525,12 +1525,13 @@ static int mov_seek_stream(AVStream *st, int64_t timestamp, int flags) if (sc->ctts_data) { time_sample = 0; for (i = 0; i < sc->ctts_count; i++) { - time_sample += sc->ctts_data[i].count; - if (time_sample >= sc->current_sample) { + int next = time_sample + sc->ctts_data[i].count; + if (next > sc->current_sample) { 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; } + time_sample = next; } } return sample; |