From a225f666ac7075e4d81513a427806d56ea6f3b6e Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Thu, 17 Aug 2017 11:48:29 +0900 Subject: [PATCH] audio: Bug fix: Race condition on 'pos' member (#413) --- audio/audio.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/audio/audio.go b/audio/audio.go index c7293090c..4bad6386e 100644 --- a/audio/audio.go +++ b/audio/audio.go @@ -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.