audio: Avoid busy loops (#183)

This commit is contained in:
Hajime Hoshi 2016-03-13 22:39:03 +09:00
parent b1f856a0e0
commit 8b8eb855a7

View File

@ -20,6 +20,7 @@ import (
"fmt" "fmt"
"io" "io"
"runtime" "runtime"
"time"
"golang.org/x/mobile/exp/audio/al" "golang.org/x/mobile/exp/audio/al"
) )
@ -90,6 +91,9 @@ func (p *player) proceed() error {
if err != nil { if err != nil {
return err return err
} }
if n == 0 {
time.Sleep(1)
}
} }
if p.alSource.State() == al.Stopped { if p.alSource.State() == al.Stopped {