summaryrefslogtreecommitdiffstats
path: root/stream/stream.c
diff options
context:
space:
mode:
Diffstat (limited to 'stream/stream.c')
-rw-r--r--stream/stream.c7
1 files 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) {