Repository navigation
Conversation
With no GOP configured the encoder emitted an IDR every second. At 4K a keyframe is 10-30x a P-frame and takes ~25-30 ms to deliver, so the next 2-3 frames arrive late every second: measured on a static desktop over 60s, GOP=60 gave 23 frame gaps over 50 ms (p99 46 ms) against none with a 10 s GOP (p99 16.6 ms). The remote cursor visibly stuttered with it. - Default GOP is now 10 s of source frames; viewers still get keyframes on demand (new session, PLI). - PLI-driven keyframes are at least 500 ms apart, so a client that keeps losing packets cannot turn every frame into an IDR (a test client did push ~2600 IDRs a minute). - The web client asks for a zero jitter-buffer target so frames play as soon as they decode instead of the buffer growing on keyframe bursts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
|
Closing as a duplicate of #78, which makes the same three changes (10 s default GOP, 500 ms PLI keyframe limit, zero jitter buffer) and is already green. #78 also limits the zero jitter buffer to the video receiver, so audio keeps its buffer, and resumes encoding with Generated by Claude Code |
9 tasks done
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.
Requested by 4c
Summary
The remote picture (and the host cursor in it) hitched about once a second, even on a LAN. With no GOP configured, the encoder sent a full 4K IDR every second. Each one takes ~25–30 ms to deliver, so the next 2–3 frames arrive late.
Before: GOP = fps (one IDR per second); PLI keyframes unthrottled; the browser uses its default adaptive jitter buffer.
After: GOP = 10 s of source frames, keyframes still sent on demand (new viewer, PLI); PLI-driven keyframes at least 500 ms apart; the web client asks for
jitterBufferTarget = 0(andplayoutDelayHint = 0).How
pipeline.rs: the dynamic GOP isfps * DEFAULT_GOP_SECONDS(10). An explicit--video-gop/RUSTKVM_VIDEO_GOPstill overrides it.pipeline.rs:force_keyframe(the PLI path) skips requests withinKEYFRAME_MIN_INTERVAL(500 ms) of the last forced keyframe.force_keyframe_now(new viewer) stays unconditional and records the time.rkvm-web/net/peer.rs: ontrack, setjitterBufferTarget/playoutDelayHintto 0 on the receiver viaReflect, so no new web-sys features are needed.Testing
Measured on hardware (RK3588, 4K60 H.264 source, static desktop). I used a WebRTC viewer that records per-frame RTP arrival without decoding, 60 s per setting:
This build ran on the device and logged
Set dynamic GOP to 600 (10s) based on source 60.0fps. An 18 s sample (cut short when a browser viewer took over) gave p99 gap 18.6 ms and one keyframe.The first version of the measurement client overflowed its jitter buffer and sent PLIs continuously; the device emitted ~2600 IDRs in a minute. That's why the PLI rate limit is in this PR.
cargo +nightly fmt --allcargo +nightly clippy --workspace --release --all-targets -- -D warningscargo +nightly test --workspace: not run to completion locally. The host link step fails withcannot open /lib64/libm.so.6, which comes from this build machine and not from the diff. Leaving it to CI.Frontend touched:
trunk build --releaseOK. wasm32 clippy reports twothis lifetime isn't used in the typeerrors inui/button.rs/ui/field.rs. Those files are untouched here; it's a newer nightly lint.Tested on an RK3588 device (above)
Checklist
#[allow(...)]suppressions and no newunwrap()/expect()in production pathsMissedTickBehavior::Delayrkvm-proto(none added)🤖 Generated with Claude Code