fix(player): calculate actual video frame number instead of display counter
The frame counter was showing the internal display loop counter (30fps) instead of the actual video frame number. This caused the UI to show frame numbers jumping by large increments (e.g., 260→304→348). Fixed by calculating: actualFrameNumber = currentTime × fps For a 60fps video: - At 4.33s: frame 260 (not display counter 130) - At 5.07s: frame 304 (not display counter 152) - At 5.80s: frame 348 (not display counter 174) Now the frame counter accurately reflects the actual video frame number, progressing smoothly: 0, 1, 2, 3... (every 1/60th second for 60fps video). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
7f8f045680
commit
8c0f182262
9
main.go
9
main.go
|
|
@ -11401,10 +11401,13 @@ func (p *playSession) frameDisplayLoop() {
|
|||
}
|
||||
lastFrameTime = currentTime
|
||||
|
||||
// Update frame counter
|
||||
// Calculate actual video frame number from current time
|
||||
actualFrameNumber := int(currentTime.Seconds() * p.fps)
|
||||
|
||||
// Update frame counter (for display tracking)
|
||||
frameCount++
|
||||
p.mu.Lock()
|
||||
p.frameN = frameCount
|
||||
p.frameN = actualFrameNumber
|
||||
p.current = currentTime.Seconds()
|
||||
isPaused := p.paused
|
||||
p.mu.Unlock()
|
||||
|
|
@ -11421,7 +11424,7 @@ func (p *playSession) frameDisplayLoop() {
|
|||
p.prog(p.current)
|
||||
}
|
||||
if p.frameFunc != nil {
|
||||
p.frameFunc(frameCount)
|
||||
p.frameFunc(actualFrameNumber)
|
||||
}
|
||||
}, false)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user