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.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()
}
}