From 9b10869a614dd055c6f68a1d0750899f4411d638 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 11 Oct 2018 05:43:54 +0200 Subject: stream: something --- stream/stream.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/stream/stream.c b/stream/stream.c index e0dfbd33fd..1ec1c9167b 100644 --- a/stream/stream.c +++ b/stream/stream.c @@ -505,13 +505,14 @@ bool stream_seek(stream_t *s, int64_t pos) s->eof = 0; // eof should be set only on read; seeking always clears it - if (pos == stream_tell(s)) - return true; - if (pos < 0) { MP_ERR(s, "Invalid seek to negative position %lld!\n", (long long)pos); pos = 0; } + + if (pos == stream_tell(s)) + return true; + if (pos < s->pos) { int64_t x = pos - (s->pos - (int)s->buf_len); if (x >= 0) { -- cgit v1.2.3