0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00

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).
This commit is contained in:
Uoti Urpala 2008-10-04 07:21:21 +03:00
parent e7a611de00
commit 0a674354b7

View File

@ -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