diff options
author | wm4 <wm4@nowhere> | 2013-06-06 17:51:43 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-06-16 22:05:10 +0200 |
commit | df09c1aa63b442d41ddd1b57245da1c62ffca514 (patch) | |
tree | 40aa810b89690f4b6e43e6513baaf200b1f2bb8e | |
parent | 5999efb96478cefa33cf61e3ce2c9d872365cec6 (diff) | |
download | mpv-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.
-rw-r--r-- | stream/stream.c | 5 |
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; } |