aboutsummaryrefslogtreecommitdiffhomepage
path: root/stream
diff options
context:
space:
mode:
authorGravatar wm4 <wm4@nowhere>2017-08-17 17:29:17 +0200
committerGravatar wm4 <wm4@nowhere>2017-08-17 17:38:07 +0200
commitb9430309ec69e853add16c60e078710f5fc4052b (patch)
tree329edad96d8dd0e05d34b2db702e52842203b13f /stream
parent79a39aeebd5053e6de9874052a02a34267ac6830 (diff)
stream: add an assert() to an obscure seek case
This affects small seeks backwards while within the buffer. Demuxers usually avoid this, so it's probably not triggered very often. (Although demux_mkv.c potentially triggers it often, and it uses stream_peek() to explicitly guarantee that it can use this code to seek back.) The condition is complex enough to warrant an assertion.
Diffstat (limited to 'stream')
-rw-r--r--stream/stream.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/stream/stream.c b/stream/stream.c
index ca17fa787f..29234e59a5 100644
--- a/stream/stream.c
+++ b/stream/stream.c
@@ -563,6 +563,7 @@ bool stream_seek(stream_t *s, int64_t pos)
int64_t x = pos - (s->pos - (int)s->buf_len);
if (x >= 0) {
s->buf_pos = x;
+ assert(s->buf_pos <= s->buf_len);
return true;
}
}