mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-02-03 22:44:28 +01:00
audio/internal/readerplayer: Bug fix: Delay on audio on Android
Updates #1650
This commit is contained in:
parent
88d2663bc5
commit
c4f85bea2b
@ -160,10 +160,7 @@ func (p *player) IsPlaying() bool {
|
|||||||
func (p *player) Reset() {
|
func (p *player) Reset() {
|
||||||
p.cond.L.Lock()
|
p.cond.L.Lock()
|
||||||
defer p.cond.L.Unlock()
|
defer p.cond.L.Unlock()
|
||||||
p.resetImpl()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *player) resetImpl() {
|
|
||||||
if p.err != nil {
|
if p.err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -319,9 +316,9 @@ func (p *player) loop() {
|
|||||||
// Even when the unplayed buffer size is 0,
|
// Even when the unplayed buffer size is 0,
|
||||||
// the audio data in the hardware might not be played yet (#1632).
|
// the audio data in the hardware might not be played yet (#1632).
|
||||||
// Just wait for a while.
|
// Just wait for a while.
|
||||||
time.Sleep(100 * time.Millisecond)
|
|
||||||
p.resetImpl()
|
|
||||||
p.cond.L.Unlock()
|
p.cond.L.Unlock()
|
||||||
|
time.Sleep(100 * time.Millisecond)
|
||||||
|
p.Reset()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
p.cond.L.Unlock()
|
p.cond.L.Unlock()
|
||||||
|
Loading…
Reference in New Issue
Block a user