audio/internal/readerdriver: Refactoring

This commit is contained in:
Hajime Hoshi 2021-05-17 04:04:04 +09:00
parent 66999989e1
commit 58f6eb0dea

View File

@ -674,14 +674,10 @@ func (p *playerImpl) loop() {
p.cond.L.Lock() p.cond.L.Lock()
p.buf = append(p.buf, buf[:n]...) p.buf = append(p.buf, buf[:n]...)
l := len(p.buf) if err == io.EOF && len(p.buf) == 0 {
p.cond.L.Unlock()
if err == io.EOF && l == 0 {
p.cond.L.Lock()
p.eof = true p.eof = true
p.cond.L.Unlock()
} }
p.cond.L.Unlock()
} }
} }