From d9cec2e4935722ab609fc10be4adeb873a7089d9 Mon Sep 17 00:00:00 2001 From: Drew Weymouth Date: Tue, 25 Jun 2024 07:34:16 -0700 Subject: [PATCH] limit MPV back cache too --- backend/player/mpv/player.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/player/mpv/player.go b/backend/player/mpv/player.go index 57e77ea0..41a31b66 100644 --- a/backend/player/mpv/player.go +++ b/backend/player/mpv/player.go @@ -104,7 +104,10 @@ func (p *Player) Init(maxCacheMB int) error { m.SetOptionString("terminal", "no") // limit in-memory cache size - m.SetOptionString("demuxer-max-bytes", fmt.Sprintf("%dMiB", maxCacheMB)) + maxBackMB := maxCacheMB / 3 + maxForwardMB := maxBackMB + maxBackMB + m.SetOptionString("demuxer-max-bytes", fmt.Sprintf("%dMiB", maxForwardMB)) + m.SetOptionString("demuxer-max-back-bytes", fmt.Sprintf("%dMiB", maxBackMB)) if p.vol < 0 { p.vol = 100