mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
audio: Bug fix: Race condition on 'pos' member (#413)
This commit is contained in:
parent
8c3a020693
commit
a225f666ac
@ -451,8 +451,10 @@ func (p *Player) bufferToInt16(lengthInBytes int) []int16 {
|
|||||||
|
|
||||||
func (p *Player) proceed(length int) {
|
func (p *Player) proceed(length int) {
|
||||||
// This function must be called on the same goruotine of readToBuffer.
|
// This function must be called on the same goruotine of readToBuffer.
|
||||||
|
p.m.Lock()
|
||||||
p.buf = p.buf[length:]
|
p.buf = p.buf[length:]
|
||||||
p.pos += int64(length)
|
p.pos += int64(length)
|
||||||
|
p.m.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Play plays the stream.
|
// Play plays the stream.
|
||||||
|
Loading…
Reference in New Issue
Block a user