From 8b8eb855a74c591d1f30b651e97596d3136040c5 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 13 Mar 2016 22:39:03 +0900 Subject: [PATCH] audio: Avoid busy loops (#183) --- exp/audio/audio_openal.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/exp/audio/audio_openal.go b/exp/audio/audio_openal.go index bd73aca4a..205ff1aba 100644 --- a/exp/audio/audio_openal.go +++ b/exp/audio/audio_openal.go @@ -20,6 +20,7 @@ import ( "fmt" "io" "runtime" + "time" "golang.org/x/mobile/exp/audio/al" ) @@ -90,6 +91,9 @@ func (p *player) proceed() error { if err != nil { return err } + if n == 0 { + time.Sleep(1) + } } if p.alSource.State() == al.Stopped {