limit MPV back cache too

This commit is contained in:
Drew Weymouth
2024-06-25 07:34:16 -07:00
parent 396547d0d6
commit d9cec2e493
+4 -1
View File
@@ -104,7 +104,10 @@ func (p *Player) Init(maxCacheMB int) error {
m.SetOptionString("terminal", "no") m.SetOptionString("terminal", "no")
// limit in-memory cache size // 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 { if p.vol < 0 {
p.vol = 100 p.vol = 100