audio: Bug fix: Race condition on 'pos' member (#413)

This commit is contained in:
Hajime Hoshi 2017-08-17 11:48:29 +09:00
parent 8c3a020693
commit a225f666ac

View File

@ -451,8 +451,10 @@ func (p *Player) bufferToInt16(lengthInBytes int) []int16 {
func (p *Player) proceed(length int) {
// This function must be called on the same goruotine of readToBuffer.
p.m.Lock()
p.buf = p.buf[length:]
p.pos += int64(length)
p.m.Unlock()
}
// Play plays the stream.