From 5793cb40c83f6b56d33e539c5375d27977921f36 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 14 Feb 2020 16:08:54 +0100 Subject: stream: early-out in stream_seek_skip() if nothing is skipped stream_seek() might somewhat show up in the profiler, even if it's a no-OP, because of the MP_TRACE() call. I find this annoying. Otherwise, this should be of no consequence, and should not break or improve anything. --- stream/stream.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/stream/stream.c b/stream/stream.c index 157776cd87..a3285e4d8f 100644 --- a/stream/stream.c +++ b/stream/stream.c @@ -720,8 +720,13 @@ bool stream_seek(stream_t *s, int64_t pos) // it's a forward-seek. bool stream_seek_skip(stream_t *s, int64_t pos) { - return !s->seekable && pos > stream_tell(s) - ? stream_skip_read(s, pos - stream_tell(s)) + uint64_t cur_pos = stream_tell(s); + + if (cur_pos == pos) + return true; + + return !s->seekable && pos > cur_pos + ? stream_skip_read(s, pos - cur_pos) : stream_seek(s, pos); } -- cgit v1.2.3