limit MPV in-memory cache size and make it configurable

This commit is contained in:
Drew Weymouth
2023-03-28 17:34:39 -07:00
parent d67dfa07b3
commit 0a11df8c07
3 changed files with 13 additions and 6 deletions
+3 -1
View File
@@ -80,7 +80,9 @@ func (a *App) readConfig() {
func (a *App) initMPV() error {
p := player.NewWithClientName(AppName)
if err := p.Init(a.Config.LocalPlayback.AudioExclusive); err != nil {
c := a.Config.LocalPlayback
c.InMemoryCacheSizeMB = clamp(c.InMemoryCacheSizeMB, 10, 500)
if err := p.Init(c.AudioExclusive, c.InMemoryCacheSizeMB); err != nil {
return fmt.Errorf("failed to initialize mpv player: %s", err.Error())
}
a.Player = p