diff options
author | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2007-12-15 19:08:42 +0000 |
---|---|---|
committer | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2007-12-15 19:08:42 +0000 |
commit | 2aaf95a210f2d05f11a9fc190760d30304469863 (patch) | |
tree | 1c9dec907c8c571ef17cb406e28ac7f5118c5cb4 | |
parent | 88808c60afe1a8fd3bf347dc486c8b8a49c2ebbb (diff) | |
download | ffmpeg-2aaf95a210f2d05f11a9fc190760d30304469863.tar.gz |
choose next sample by sample position
when streams' next dts difference is below AV_TIME_BASE,
to reduce seeking, needed for slow underlying protocols (http),
a slightly modified patch from elupus, elupus at ecce dot se
Originally committed as revision 11226 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavformat/mov.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c index b22fac1f91..545564b3cb 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1511,7 +1511,9 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt) int64_t dts = av_rescale(current_sample->timestamp * (int64_t)msc->time_rate, AV_TIME_BASE, msc->time_scale); dprintf(s, "stream %d, sample %d, dts %"PRId64"\n", i, msc->current_sample, dts); - if (dts < best_dts) { + if (!sample || + ((FFABS(best_dts - dts) <= AV_TIME_BASE && current_sample->pos < sample->pos) || + (FFABS(best_dts - dts) > AV_TIME_BASE && dts < best_dts))) { sample = current_sample; best_dts = dts; sc = msc; |