summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-10-08 00:58:21 +0200
committerwm4 <wm4@nowhere>2014-10-08 00:58:21 +0200
commit8d905288262d04526d3c0348a07fa34c8ada6b96 (patch)
tree8ce6b187fd85169e8301715615d928eed2eda04a /stream
parent34571b3c2425ddaa9adf9e074c2bcb7147b4687e (diff)
downloadmpv-8d905288262d04526d3c0348a07fa34c8ada6b96.tar.bz2
mpv-8d905288262d04526d3c0348a07fa34c8ada6b96.tar.xz
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.)
Diffstat (limited to 'stream')
-rw-r--r--stream/stream.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/stream/stream.c b/stream/stream.c
index 3b8915c8ac..f50003660c 100644
--- a/stream/stream.c
+++ b/stream/stream.c
@@ -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;
}