audio: Bug fix: buffers might be run out (#207)

This commit is contained in:
Hajime Hoshi 2016-04-16 12:09:25 +09:00
parent e5609f06d6
commit 6ba088d021
2 changed files with 4 additions and 2 deletions

View File

@ -110,7 +110,8 @@ func (p *Player) Proceed(data []byte) error {
} }
if len(p.alBuffers) == 0 { if len(p.alBuffers) == 0 {
return errors.New("driver: p.alBuffers must > 0") // This can happen (#207)
return nil
} }
buf := p.alBuffers[0] buf := p.alBuffers[0]
p.alBuffers = p.alBuffers[1:] p.alBuffers = p.alBuffers[1:]

View File

@ -116,7 +116,8 @@ func (p *Player) Proceed(data []byte) error {
} }
} }
if headerToWrite == nil { if headerToWrite == nil {
return errors.New("driver: no available buffers") // This can happen (#207)
return nil
} }
if err := headerToWrite.Write(p.out, p.buffer[:bufferSize]); err != nil { if err := headerToWrite.Write(p.out, p.buffer[:bufferSize]); err != nil {
return err return err