Skip to content

Commit

Permalink
oto: bug fix: ready channel might never be closed
Browse files Browse the repository at this point in the history
  • Loading branch information
hajimehoshi committed Aug 6, 2024
1 parent e73becc commit d412d64
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions driver_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ func newContext(sampleRate int, channelCount int, format mux.Format, bufferSizeI
runtime.LockOSThread()
defer runtime.UnlockOSThread()

defer func() {
if ready != nil {
close(ready)
}
}()

q, bs, err := newAudioQueue(sampleRate, channelCount, oneBufferSizeInBytes)
if err != nil {
c.err.TryStore(err)
Expand Down Expand Up @@ -152,6 +158,7 @@ func newContext(sampleRate int, channelCount int, format mux.Format, bufferSizeI
}

close(ready)
ready = nil

c.loop()
}()
Expand Down

0 comments on commit d412d64

Please sign in to comment.