mirror of https://github.com/mpv-player/mpv
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.
This commit is contained in:
parent
c59ca06a0f
commit
5793cb40c8
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue