summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-10-11 05:43:54 +0200
committerAnton Kindestam <antonki@kth.se>2018-12-06 10:33:14 +0100
commit9b10869a614dd055c6f68a1d0750899f4411d638 (patch)
tree3c429d6656fd569294c1cae75dc6132ea3412e5a
parentf4ce3b8bb9ac715e3390f047697d6905eab55ef1 (diff)
downloadmpv-9b10869a614dd055c6f68a1d0750899f4411d638.tar.bz2
mpv-9b10869a614dd055c6f68a1d0750899f4411d638.tar.xz
stream: something
-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) {