mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
stream: change internal instead of external pos when dropping buffers
stream provides a read buffer (so even something like stream_read_char() is very fast). This means the stream reads ahead by a few KBs, and implies that the internal position (s->pos, which would match e.g. the file position in stream_file.c), and the external position (stream_tell()) can be different. stream_tell() shows how these are related. When dropping buffers, which happens on byte-level discontinuities with a bunch of streams (including DVB), we should not change the position as seen by the demuxer. On the other hand, the internal position is not really meaningful, since these streams aren't seekable anyway. So just change the code such that stream_drop_buffers() doesn't change the demuxer visible position. I'm hoping that this will fix a few problems with DVB. (Also see previous commit.)
This commit is contained in:
@@ -631,6 +631,7 @@ static int stream_skip_read(struct stream *s, int64_t len)
|
||||
// logical stream position by the amount of buffered but not yet read data.
|
||||
void stream_drop_buffers(stream_t *s)
|
||||
{
|
||||
s->pos = stream_tell(s);
|
||||
s->buf_pos = s->buf_len = 0;
|
||||
s->eof = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user