audio/internal/readerdriver: Bug fix: Race condition on UNIX/Linux

Updates #1680
This commit is contained in:
Hajime Hoshi 2021-06-25 03:17:39 +09:00
parent c7ac5a32b5
commit ab5f5cbfea

View File

@ -358,11 +358,8 @@ func (p *playerImpl) readSourceToBuffer() {
return
}
src := p.src
p.m.Unlock()
buf := make([]byte, maxBufferSize)
n, err := src.Read(buf)
p.m.Lock()
n, err := p.src.Read(buf)
if err != nil && err != io.EOF {
p.setErrorImpl(err)