From c4f85bea2bc37f32c3b300f991aef6d0a2871c1b Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Thu, 27 May 2021 00:52:40 +0900 Subject: [PATCH] audio/internal/readerplayer: Bug fix: Delay on audio on Android Updates #1650 --- audio/internal/readerdriver/driver_android.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/audio/internal/readerdriver/driver_android.go b/audio/internal/readerdriver/driver_android.go index 9438c6584..2387e9f36 100644 --- a/audio/internal/readerdriver/driver_android.go +++ b/audio/internal/readerdriver/driver_android.go @@ -160,10 +160,7 @@ func (p *player) IsPlaying() bool { func (p *player) Reset() { p.cond.L.Lock() defer p.cond.L.Unlock() - p.resetImpl() -} -func (p *player) resetImpl() { if p.err != nil { return } @@ -319,9 +316,9 @@ func (p *player) loop() { // Even when the unplayed buffer size is 0, // the audio data in the hardware might not be played yet (#1632). // Just wait for a while. - time.Sleep(100 * time.Millisecond) - p.resetImpl() p.cond.L.Unlock() + time.Sleep(100 * time.Millisecond) + p.Reset() return } p.cond.L.Unlock()