audio/vorbis: Cause runtime.Gosched more often

This commit is contained in:
Hajime Hoshi 2017-06-04 03:44:39 +09:00
parent cf452bb709
commit e0bc85e790

View File

@ -63,7 +63,6 @@ type decoded struct {
} }
func (d *decoded) readUntil(posInBytes int) error { func (d *decoded) readUntil(posInBytes int) error {
c := 0
buffer := make([]float32, 8192) buffer := make([]float32, 8192)
for d.readBytes < posInBytes { for d.readBytes < posInBytes {
n, err := d.decoder.Read(buffer) n, err := d.decoder.Read(buffer)
@ -87,10 +86,7 @@ func (d *decoded) readUntil(posInBytes int) error {
if err != nil { if err != nil {
return err return err
} }
c++ runtime.Gosched()
if c%2 == 0 {
runtime.Gosched()
}
} }
return nil return nil
} }