audio: skip making a player at SetPosition when possible

This commit is contained in:
Hajime Hoshi 2024-02-01 17:31:16 +09:00
parent eccf67172f
commit 788529ff76

View File

@ -262,6 +262,10 @@ func (p *playerImpl) SetPosition(offset time.Duration) error {
p.m.Lock()
defer p.m.Unlock()
if offset == 0 && p.player == nil {
return nil
}
if err := p.ensurePlayer(); err != nil {
return err
}