From 49b0b8d27c2a37e4869857542b4750fc61771d95 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Fri, 30 Jun 2023 16:53:37 +0200 Subject: serialize player state change though a channel Only the player.serveCmds and the runMpv goroutines are racing now. But this race should be a benign race. --- wrms.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'wrms.go') diff --git a/wrms.go b/wrms.go index 1fdb5a0..29110a9 100644 --- a/wrms.go +++ b/wrms.go @@ -155,7 +155,7 @@ type Wrms struct { Songs []Song queue Playlist CurrentSong atomic.Pointer[Song] - Player Player + Player *Player Playing bool Config Config eventId atomic.Uint64 @@ -357,7 +357,7 @@ func (wrms *Wrms) PlayPause() { } // Wrms has an active mpv process -> continue playing - if wrms.Player.mpv != nil { + if wrms.Player.mpv.Load() != nil { wrms.Player.Continue() // Wrms has a current song but no mpv process playing it -> start a new one } else { -- cgit v1.2.3