fix(viewer): eliminate dual-decoder race and seek-flood jerkiness#13
Draft
Tailspin45 wants to merge 4 commits into
Draft
fix(viewer): eliminate dual-decoder race and seek-flood jerkiness#13Tailspin45 wants to merge 4 commits into
Tailspin45 wants to merge 4 commits into
Conversation
- Share a single HTMLVideoElement decoder for both playback and filmstrip thumb capture. Drop the hidden extractor <video>, its canvas/ctx, and the onseeked-based busy flag. Thumb drain is now a serialized Promise chain with a generation counter so new-video loads abort old chains. - Add _seekToFrame helper that resolves on seeked + requestVideoFrameCallback (with a timeout/safety fallback). Used by _stepFrame, _jumpToFrame, slider input, scrub-play, and thumb capture. - Replace fixed-interval _scrubPlayTick with an async while-loop that awaits each seek, then throttles to 1/fps only if the decoder is faster than real-time. scrubPlayToggle guards against double-start. - Render via a requestAnimationFrame batcher driven by 'seeked'; timeupdate is now loop-wrap only. Avoids duplicate _updateFivePanel calls per step. - Detect real fps: rVFC median-delta probe first, then GET /api/video/fps (new ffprobe-backed Flask route), then fall back to 30. _initFrameScrubber no longer hardcodes 30. - Round _jumpToFrame argument defensively. ffprobe is optional on the host: the route returns 404 on absence and the frontend falls back cleanly.
| return jsonify({"error": "ffprobe timeout"}), 404 | ||
| except Exception as exc: | ||
| logger.warning(f"[Telescope] video fps probe error: {exc}") | ||
| return jsonify({"error": str(exc)}), 404 |
- Opportunistic thumb capture on every _seekToFrame completion - Drain queue during playback (in-place capture only, no extra seeks) - Await initial seek(0) before extracting thumbs; wait for videoWidth>0 - Prime the pump: capture frame 0 synchronously on load - Guard 5-panel render against premature canvas access - _VIDDBG flag for silent debug logging
Owner
Author
|
Follow-up commit pushed: What changed (static/telescope.js only, +96 / −11)
Test plan
|
- Capture happens after seeked event; previous render sees empty thumb - Schedule a second render from capture paths when frame is in visible window - Reject suspiciously small captures (decoder not ready) and re-queue - Consolidate on single _scheduleFivePanelRender helper
Owner
Author
|
Follow-up commit pushed: `0f90278` — fixes "center panel stays blank after step/play" regression. Root causeThe `seeked` listener fires BEFORE the rVFC callback that does the actual `drawImage` capture. So the rAF-batched `_updateFivePanel` ran with `_frameThumbs[N]` still empty for the frame just landed on, and nothing scheduled a second render after the capture completed — the center panel stayed blank until the next seek. Fix (static/telescope.js only, +60 / −17)
Test plan
|
…ward play - Guard _currentFrame against overwrite during programmatic seeks (fixes step-by-2) - Forward play now uses native <video>.play() + requestVideoFrameCallback (smooth at native fps) - Reverse play keeps step-based loop (seek-serialized) - Center panel no longer blanks on first pass (capture fires on every rVFC tick)
Owner
Author
|
Follow-up commit: step-by-2 + smooth forward play What changed
Test plan (4K det_*.mp4)
Commit: 7f742fb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Root cause
Fix summary
`ffprobe` is not guaranteed on every host (bundled Electron, headless Pi). The route returns 404 on absence and the frontend falls back to the rVFC probe → 30 chain, so missing ffprobe is non-fatal.
Files changed
Manual test plan