Mercurial > mplayer.hg
changeset 35392:092c40fbd33d
Try to improve seeking in files with only few video packets,
in particular files with cover art.
This might cause issues with badly interleaved files, particularly
together with -audio-delay, even though I did not see issues
in my very limited testing.
author | reimar |
---|---|
date | Mon, 26 Nov 2012 19:30:58 +0000 |
parents | d076af01765d |
children | 67de02ade8af |
files | libmpdemux/demuxer.c libmpdemux/demuxer.h |
diffstat | 2 files changed, 7 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpdemux/demuxer.c Mon Nov 26 11:32:50 2012 +0000 +++ b/libmpdemux/demuxer.c Mon Nov 26 19:30:58 2012 +0000 @@ -663,6 +663,7 @@ demux_packet_t *p = ds->first; // obviously not yet EOF after all ds->eof = 0; + ds->fill_count = 0; #if 0 if (demux->reference_clock != MP_NOPTS_VALUE) { if ( p->pts != MP_NOPTS_VALUE @@ -697,6 +698,11 @@ --ds->packs; return 1; } + // avoid buffering too far ahead in e.g. badly interleaved files + // or when one stream is shorter, without breaking large audio + // delay with well interleaved files. + if (ds->fill_count++ > 20) + break; // avoid printing the "too many ..." message over and over if (ds->eof) break;
--- a/libmpdemux/demuxer.h Mon Nov 26 11:32:50 2012 +0000 +++ b/libmpdemux/demuxer.h Mon Nov 26 19:30:58 2012 +0000 @@ -144,6 +144,7 @@ int non_interleaved; // 1 if this stream is not properly interleaved, // so e.g. subtitle handling must do explicit reads. //--------------- + int fill_count; // number of unsuccessful tries to get a packet int packs; // number of packets in buffer int bytes; // total bytes of packets in buffer demux_packet_t *first; // read to first buffer after the current buffer from here