diff --git a/driver_android.go b/driver_android.go index 846603c..17111e0 100644 --- a/driver_android.go +++ b/driver_android.go @@ -36,14 +36,15 @@ func newContext(sampleRate int, channelCount int, format mux.Format, bufferSizeI mux: mux.New(sampleRate, channelCount, format), } go func() { + // The ready channel must close even if Play fails, or callers waiting on it block forever. + defer close(ready) + c.m.Lock() defer c.m.Unlock() if err := oboe.Play(sampleRate, channelCount, c.mux.ReadFloat32s, c.err.Join, bufferSizeInBytes); err != nil { c.err.Join(err) - return } - close(ready) }() return c, ready, nil }