audio: Bug fix: Dead lock at seeking

When sending something to channels, a lock should not be used,
or the receiver side might be using the same lock.

Bug: #855
This commit is contained in:
Hajime Hoshi 2019-04-30 12:51:22 +09:00
parent e19479d243
commit 339e76afec

View File

@ -619,8 +619,6 @@ func (p *playerImpl) Seek(offset time.Duration) error {
}
p.m.Lock()
defer p.m.Unlock()
o := int64(offset) * bytesPerSample * int64(p.sampleRate) / int64(time.Second)
o &= mask
@ -630,12 +628,15 @@ func (p *playerImpl) Seek(offset time.Duration) error {
}
pos, err := seeker.Seek(o, io.SeekStart)
if err != nil {
p.m.Unlock()
return err
}
p.buf = nil
p.pos = pos
p.srcEOF = false
p.m.Unlock()
p.seekCh <- struct{}{}
<-p.seekedCh
return nil