From acfcb88acab717f37b812fc7a0c77d1f1b670e6c Mon Sep 17 00:00:00 2001 From: pax Date: Thu, 9 Apr 2026 20:52:22 -0500 Subject: [PATCH] mpv_gl: add network streaming tuning options behavior change: mpv now uses explicit cache=yes, cache_pause=no (stutter over pause for short clips), 50MiB demuxer buffer cap, 20s read-ahead, and 10s network timeout (down from ~60s default). Improves first-frame latency on uncached video streams and surfaces stalled-connection errors faster. --- booru_viewer/gui/media/mpv_gl.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/booru_viewer/gui/media/mpv_gl.py b/booru_viewer/gui/media/mpv_gl.py index 216ac76..443433f 100644 --- a/booru_viewer/gui/media/mpv_gl.py +++ b/booru_viewer/gui/media/mpv_gl.py @@ -70,6 +70,18 @@ class _MpvGLWidget(QWidget): # don't care about a tiny quality dip during ramp-up. vd_lavc_fast="yes", vd_lavc_skiploopfilter="nonkey", + # Network streaming tuning for the uncached-video fast path. + # cache=yes is mpv's default for network sources but explicit + # is clearer. cache_pause=no keeps playback running through + # brief buffer underruns instead of pausing — for short booru + # clips a momentary stutter beats a pause icon. demuxer caps + # keep RAM bounded. network_timeout=10 replaces mpv's ~60s + # default so stalled connections surface errors promptly. + cache="yes", + cache_pause="no", + demuxer_max_bytes="50MiB", + demuxer_readahead_secs="20", + network_timeout="10", ) # Wire up the GL surface's callbacks to us self._gl._owner = self