Repository navigation
fix: stop re-sending unchanged MJPEG frames and speed up the first frame - #12
Merged
Merged
Conversation
- Compare a new screenshot with the previous captured one instead of the previous sent one. With mjpegScalingFactor < 100 the sent frame never matched the captured data, so a static screen was rescaled and streamed at the full framerate. - Recompress scaled frames with the configured mjpegServerScreenshotQuality. The forced minimum of 0.9 made scaled frames larger than full-size ones for low quality settings. - Fix data races on the last frame and the new client flag, which were accessed from several queues without synchronization. - Resend the last frame once the client is subscribed to the broadcast, so a new client on a static screen does not wait for the periodic frame. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
A client joining a static screen waited for the next tick of the 0.5s first-frame timer. Trigger the resend as soon as the client is subscribed; the timer still retries if no frame has been captured yet. Time to the first frame on a static screen dropped from 120-370ms to 1-5ms on the simulator. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Summary
Fixes in the MJPEG screenshots broadcaster (
FBMjpegServer,FBImageProcessor).mjpegScalingFactor < 100a static screen was rescaled and streamed at the full framerate. It is now compared with the last captured frame, the scaling factor and the orientation setting.mjpegServerScreenshotQuality. With the default quality of 10 a 50% frame came out bigger than the original. The configured quality is used now.Measurements (simulator, static screen)
mjpegScalingFactor=50, 10 fpsTesting
FBImageProcessorTestspass.