orbiscreen | fix: drop stale frames and eliminate stream latency accumulation (#77) - #78
Merged
shadow-x78 merged 1 commit intoSep 14, 2026
Conversation
Contributor
Author
|
Allowing it to drop frames and reducing the buffer has genuinely shown me a lot of improvement on my personal setup. The queue just created a bottleneck in my setup especially if the hardware is on the slower side. The performance is comparable to Spacedesk now, especially on my decade old tablet. Opened a pull request if these suggestions can help out the project as a whole. I was looking around and found some other minor improvements as well. Would love a discussion space to discuss them before opening a PR. |
Owner
|
@Yashb404 Thanks for PR and help, really glad it helped with your tablet. I'll check PR in a bit. Setting up a Discord server soon to talk through new ideas, and I'll link it in README once it's up. |
shadow-x78
self-requested a review
September 14, 2026 16:33
shadow-x78
removed their request for review
September 14, 2026 16:34
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.
What does this PR do?
Resolves issue #77 by stopping the video stream from buffering stale frames and accumulating seconds of video and mouse latency over time (both via Wi-Fi and USB Direct/AOA).
Key changes:
appsinkincrates/orbiscreen-transport/src/lib.rsfromdrop=false max-buffers=16todrop=true max-buffers=1 sync=false.is-live=true do-timestamp=trueon the pipeline so that under network or USB backpressure, the sink immediately drops stale frames rather than queueing up multi-second delays.stream_handleracross frame gaps exceeding 250ms back to the nominal frame time (e.g.16.6msfor 60fps), preventing timeline desync and buffer inflation inmpegtsmuxand client decoders after laptop suspend/resume or heavy pipeline stalls.sync_channelcapacity incrates/orbiscreen-transport/src/aoa.rsfrom 64 chunks (1MB) to 8 chunks, eliminating multi-frame host queueing over USB.n-threads=4to CPUvideoconvertelements across capture and encode pipelines (kwin_virtual.rs,wayland.rs, andorbiscreen-encode/lib.rs) to prevent single-core bottlenecks when converting BGRA to NV12 at 1080p+.appsrcmax-bytes to 1 uncompressed frame and encoderappsinkmax-buffers to 1 across capture pipelines to prevent buffer bloat.Why?
Addresses Issue #77 (
[bug] Video stream accumulates seconds of latency instead of dropping stale frames (Wi-Fi and USB/AOA)) and the pendingCHANGELOG.mdentry under[Unreleased].Prior to this fix, moving windows continuously, dropping packets, or resuming from system sleep caused frames to queue up indefinitely inside
appsink (max-buffers=16, drop=false)and the AOA sync channel. The display on the client fell behind real time by 5–15+ seconds ("slow motion" effect). With zero-delay dropping and clamped timestamp deltas, the stream remains locked to real time.How was it tested?
cargo fmt --allcargo clippy --workspace --all-targets --locked -- -D warningscargo test --workspaceChecklist
// Orbiscreen - <module> (GPL-3.0-or-later)+ GitHub URL).CHANGELOG.mdupdated.