summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-06-06 17:51:43 +0200
committerwm4 <wm4@nowhere>2013-06-16 22:05:10 +0200
commitdf09c1aa63b442d41ddd1b57245da1c62ffca514 (patch)
tree40aa810b89690f4b6e43e6513baaf200b1f2bb8e /stream
parent5999efb96478cefa33cf61e3ce2c9d872365cec6 (diff)
downloadmpv-df09c1aa63b442d41ddd1b57245da1c62ffca514.tar.bz2
mpv-df09c1aa63b442d41ddd1b57245da1c62ffca514.tar.xz
stream: don't adjust stream position if seek succeeds, but read fails
This was probably done this way to ensure that after a successful seek, the reported stream position is the same as the requested seek position. But it doesn't make too much sense, since both stream->pos and the stream implementation's internal position will go out of sync.
Diffstat (limited to 'stream')
-rw-r--r--stream/stream.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/stream/stream.c b/stream/stream.c
index e9a0478609..ddebc6da74 100644
--- a/stream/stream.c
+++ b/stream/stream.c
@@ -570,8 +570,7 @@ static int stream_seek_long(stream_t *s, int64_t pos)
}
pos -= s->buf_len;
}
- // Fill failed, but seek still is a success.
- s->pos += pos;
+ // Fill failed, but seek still is a success (partially).
s->buf_pos = 0;
s->buf_len = 0;
s->eof = 0; // eof should be set only on read
@@ -615,7 +614,7 @@ int stream_skip(stream_t *s, int64_t len)
int r = stream_seek(s, target - 1);
if (r) {
stream_read_char(s);
- return !stream_eof(s);
+ return !stream_eof(s) && stream_tell(s) == target;
}
return r;
}