From 788529ff764b738b3ab097b6002dfcc6977ad095 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Thu, 1 Feb 2024 17:31:16 +0900 Subject: [PATCH] audio: skip making a player at SetPosition when possible --- audio/player.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/audio/player.go b/audio/player.go index fbf38f503..5db88e295 100644 --- a/audio/player.go +++ b/audio/player.go @@ -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 }