mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
audio/internal/readerdriver: Bug fix: Avoid busy loop when EOF is reached
This is a part of reverting 81015a3c19
.
On Drawin, the loop became busy when the source reached EOF. This
change fixes this issue by making the loop wait when the EOF is
reached and until the state is reset.
Updates #1650
This commit is contained in:
parent
95a98950b8
commit
91d3d6b4e7
@ -621,7 +621,9 @@ func (p *playerImpl) shouldWait() bool {
|
||||
case playerPaused:
|
||||
return true
|
||||
case playerPlay:
|
||||
return len(p.buf) >= p.context.maxBufferSize()
|
||||
// If the buffer has too much data, wait until the buffer data is consumed.
|
||||
// If the source reaches EOF, wait until the state is reset.
|
||||
return len(p.buf) >= p.context.maxBufferSize() || p.eof
|
||||
case playerClosed:
|
||||
return false
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user