From 9cd525a04eea20a1b58294d3400ffbd96f7de298 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 16 Mar 2024 22:03:34 +0900 Subject: [PATCH] audio: bug fix: position adjustment should not start before ready Updates #2901 --- audio/player.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/audio/player.go b/audio/player.go index 89d6a3be7..4fc7fcb37 100644 --- a/audio/player.go +++ b/audio/player.go @@ -356,6 +356,10 @@ func (p *playerImpl) updatePosition() { p.adjustedPosition = 0 return } + if !p.context.IsReady() { + p.adjustedPosition = 0 + return + } samples := (p.stream.position() - int64(p.player.BufferedSize())) / bytesPerSampleInt16