Skip to content

Commit

Permalink
fix: do not hang on end of context
Browse files Browse the repository at this point in the history
  • Loading branch information
devgianlu committed May 27, 2024
1 parent 5385999 commit b05410e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions player/player.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,14 @@ loop:
case err := <-outErr:
if err != nil {
log.WithError(err).Errorf("output device failed")

_ = out.Close()
out = nil
outErr = make(<-chan error)
}

// the current output device has exited, clean it up
_ = out.Close()
out = nil
outErr = make(<-chan error)

p.ev <- Event{Type: EventTypeNotPlaying}
p.ev <- Event{Type: EventTypeStopped}
case <-source.Done():
p.ev <- Event{Type: EventTypeNotPlaying}
Expand Down

0 comments on commit b05410e

Please sign in to comment.