Fix #483: workaround MPV failing to begin playback of track with new sample rate on Windows

This commit is contained in:
Drew Weymouth
2024-12-21 12:40:56 -08:00
parent 7c774c65ed
commit e8737f47b3
3 changed files with 49 additions and 3 deletions
+9
View File
@@ -26,6 +26,8 @@ const (
// arg3: bool (shuffle)
cmdLoadItems
cmdLoadRadioStation // arg: *mediaprovider.RadioStation, arg2: InsertQueueMode
cmdForceRestartPlayback
)
type playbackCommand struct {
@@ -144,6 +146,13 @@ func (c *playbackCommandQueue) LoadItems(items []mediaprovider.MediaItem, insert
c.cmdAvailable.Signal()
}
func (c *playbackCommandQueue) addCommand(command playbackCommand) {
c.mutex.Lock()
c.queue = append(c.queue, command)
c.mutex.Unlock()
c.cmdAvailable.Signal()
}
func (c *playbackCommandQueue) filterCommandsAndAdd(excludeTypes []playbackCommandType, command playbackCommand) {
c.mutex.Lock()
j := 0