aboutsummaryrefslogtreecommitdiff
path: root/wrms.go
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2023-06-30 16:53:37 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2023-06-30 18:09:46 +0200
commit49b0b8d27c2a37e4869857542b4750fc61771d95 (patch)
tree6884b88d3733c72a0b097489dc3eb1d23e379066 /wrms.go
parent5d7a7c837732519c7013cccc7819d92f321a284c (diff)
downloadWRMS-49b0b8d27c2a37e4869857542b4750fc61771d95.tar.gz
WRMS-49b0b8d27c2a37e4869857542b4750fc61771d95.zip
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.
Diffstat (limited to 'wrms.go')
-rw-r--r--wrms.go4
1 files changed, 2 insertions, 2 deletions
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 {