Mercurial > libavformat.hg
changeset 2814:3fa92d78424c libavformat
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
author | bcoudurier |
---|---|
date | Sat, 15 Dec 2007 19:08:42 +0000 |
parents | 9d53cc092c55 |
children | 64cf0a2303ac |
files | mov.c |
diffstat | 1 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mov.c Sat Dec 15 16:54:58 2007 +0000 +++ b/mov.c Sat Dec 15 19:08:42 2007 +0000 @@ -1511,7 +1511,9 @@ 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;