diff --git a/audio/internal/readerdriver/driver_darwin.go b/audio/internal/readerdriver/driver_darwin.go index 2797a06b5..edbac251c 100644 --- a/audio/internal/readerdriver/driver_darwin.go +++ b/audio/internal/readerdriver/driver_darwin.go @@ -674,14 +674,10 @@ func (p *playerImpl) loop() { p.cond.L.Lock() p.buf = append(p.buf, buf[:n]...) - l := len(p.buf) - p.cond.L.Unlock() - - if err == io.EOF && l == 0 { - p.cond.L.Lock() + if err == io.EOF && len(p.buf) == 0 { p.eof = true - p.cond.L.Unlock() } + p.cond.L.Unlock() } }