mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-13 12:32:05 +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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
buf := make([]byte, p.context.maxBufferSize())
|
if !p.eof {
|
||||||
for len(p.buf) < p.context.maxBufferSize() {
|
buf := make([]byte, p.context.maxBufferSize())
|
||||||
n, err := p.src.Read(buf)
|
for len(p.buf) < p.context.maxBufferSize() {
|
||||||
if err != nil && err != io.EOF {
|
n, err := p.src.Read(buf)
|
||||||
p.setErrorImpl(err)
|
if err != nil && err != io.EOF {
|
||||||
return
|
p.setErrorImpl(err)
|
||||||
}
|
return
|
||||||
p.buf = append(p.buf, buf[:n]...)
|
}
|
||||||
if err == io.EOF {
|
p.buf = append(p.buf, buf[:n]...)
|
||||||
break
|
if err == io.EOF {
|
||||||
|
if len(p.buf) == 0 {
|
||||||
|
p.eof = true
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user