diff options
author | der richter <der.richter@gmx.de> | 2020-11-14 14:33:17 +0100 |
---|---|---|
committer | der richter <der.richter@gmx.de> | 2021-05-16 13:48:45 +0200 |
commit | f8128f6570cfee1d076811c8c2abb9e82c4834bc (patch) | |
tree | e2292d1aa91a3fe8af9e3e239998088377e48bde /stream | |
parent | 3010588d14c638815cac1f1c8386b062e0b40f33 (diff) | |
download | mpv-f8128f6570cfee1d076811c8c2abb9e82c4834bc.tar.bz2 mpv-f8128f6570cfee1d076811c8c2abb9e82c4834bc.tar.xz |
stream_file: disable read ahead for remote files on macOS
this can cause stutter on remote files because in certain cases this
causes a reconnect to the remote that leads to the file not being read
fast enough. VLC had the same problem and fixes it the same way.
https://github.com/videolan/vlc/commit/b8b8c438f8f65a93da82364c8fea1dbf987c4a8e
Fixes #4434
Diffstat (limited to 'stream')
-rw-r--r-- | stream/stream_file.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/stream/stream_file.c b/stream/stream_file.c index 0ba12278ab..4895a8301b 100644 --- a/stream/stream_file.c +++ b/stream/stream_file.c @@ -340,8 +340,15 @@ static int open_f(stream_t *stream, const struct stream_open_args *args) stream->get_size = get_size; stream->close = s_close; - if (check_stream_network(p->fd)) + if (check_stream_network(p->fd)) { stream->streaming = true; +#if HAVE_COCOA + if (fcntl(p->fd, F_RDAHEAD, 0) < 0) { + MP_VERBOSE(stream, "Cannot disable read ahead on file '%s': %s\n", + filename, mp_strerror(errno)); + } +#endif + } p->orig_size = get_size(stream); |