mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
audio/internal/readerdriver: Bug fix: A player must be the EOF state when the buffer is empty
This commit is contained in:
parent
9f9d53aad3
commit
658192f83d
@ -172,16 +172,21 @@ func (p *playerImpl) playImpl() {
|
||||
return
|
||||
}
|
||||
|
||||
buf := make([]byte, p.context.maxBufferSize())
|
||||
for len(p.buf) < p.context.maxBufferSize() {
|
||||
n, err := p.src.Read(buf)
|
||||
if err != nil && err != io.EOF {
|
||||
p.setErrorImpl(err)
|
||||
return
|
||||
}
|
||||
p.buf = append(p.buf, buf[:n]...)
|
||||
if err == io.EOF {
|
||||
break
|
||||
if !p.eof {
|
||||
buf := make([]byte, p.context.maxBufferSize())
|
||||
for len(p.buf) < p.context.maxBufferSize() {
|
||||
n, err := p.src.Read(buf)
|
||||
if err != nil && err != io.EOF {
|
||||
p.setErrorImpl(err)
|
||||
return
|
||||
}
|
||||
p.buf = append(p.buf, buf[:n]...)
|
||||
if err == io.EOF {
|
||||
if len(p.buf) == 0 {
|
||||
p.eof = true
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user