fix: reduce WebGL ReadPixels GPU stalls in video source capture#510
Closed
livepeer-tessa wants to merge 1 commit intomainfrom
Closed
fix: reduce WebGL ReadPixels GPU stalls in video source capture#510livepeer-tessa wants to merge 1 commit intomainfrom
livepeer-tessa wants to merge 1 commit intomainfrom
Conversation
Replace requestAnimationFrame + captureStream(fps) with setInterval + captureStream(0) + manual requestFrame(). This ensures canvas drawing only happens at the target FPS rate, eliminating the mismatch between ~60fps draws and lower-rate captures that caused 'GPU stall due to ReadPixels' warnings. Fixes #509
Author
|
Closing - wrong codebase. The WebGL issue was on the web platform, not desktop app. |
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 #509 — WebGL performance warnings ("GPU stall due to ReadPixels") in the Playground 3D view.
Root Cause
useVideoSource.tswas drawing video frames to a canvas viarequestAnimationFrame(~60fps) whilecaptureStream(fps)captured at a lower rate (e.g. 15fps). This mismatch caused the browser to perform synchronousReadPixelscalls at ~60fps, triggering GPU stalls.Fix
captureStream(0)(manual frame capture mode) instead ofcaptureStream(fps)requestAnimationFramewithsetIntervalat the target FPS ratevideoTrack.requestFrame()after each draw, so canvas readback only happens at the intended capture rateThis reduces canvas readback frequency from ~60fps to the target FPS (default 15), eliminating the GPU stall warnings.