diff options
author | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2008-10-04 07:21:21 +0300 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2008-10-04 07:37:18 +0300 |
commit | 0a674354b714248722d070c9a6dbafbde1a19557 (patch) | |
tree | 6e1c2238fe34cffc6464558bfae54104c1d7a1ce /libmpdemux/demuxer.c | |
parent | e7a611de0058bb48bfe75dd86f28c9ea3f3288c5 (diff) | |
download | mpv-0a674354b714248722d070c9a6dbafbde1a19557.tar.bz2 mpv-0a674354b714248722d070c9a6dbafbde1a19557.tar.xz |
demux: Reset demux stream 'eof' flag after packet buffer overflow
The eof flag is set when another demuxer stream has hit the limit on
the size or count of buffered packets. This makes sense because in that
error situation the calling code can not rely on being able to demux
more packets from this stream, so it should rather exit or whatever
instead of getting stuck trying. However the situation can improve if
packets are demuxed from the other stream. In that case the eof flag
should be cleared. This commit adds code to clear the flag if
something is successfully read from the stream (so it's only cleared
if a caller tries to read packets despite the flag being set; that's
enough to fix audio sync issues after video packet buffer overflow).
Diffstat (limited to 'libmpdemux/demuxer.c')
-rw-r--r-- | libmpdemux/demuxer.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libmpdemux/demuxer.c b/libmpdemux/demuxer.c index caabdc5415..05225d31b6 100644 --- a/libmpdemux/demuxer.c +++ b/libmpdemux/demuxer.c @@ -489,6 +489,14 @@ int ds_fill_buffer(demux_stream_t *ds) if (!ds->first) ds->last = NULL; --ds->packs; + /* The code below can set ds->eof to 1 when another stream runs + * out of buffer space. That makes sense because in that situation + * the calling code should not count on being able to demux more + * packets from this stream. + * If however the situation improves and we're called again + * despite the eof flag then it's better to clear it to avoid + * weird behavior. */ + ds->eof = 0; return 1; } if (demux->audio->packs >= MAX_PACKS |