Overlay sometimes freezes; stays off/white background on refresh
resir014 opened this issue · comments
Some users are reporting the viz could get stuck in a certain position after a while. Refreshing shows a white background, but the viz remains off.
Removing the web source on OBS and re-adding it seems to fix the problem.
This has been tracked down to a memory leak issue, caused by the way we poll the gamepad data.
Benchmark Results
Original gamepad (from https://github.com/resir014/stream-overlays)
Standalone gamepad (TMViz)
What we did
- Dropped the framerate passed onto
useInterval()
and use the standard 1000ms interval instead. This means theframerate
option is now deprecated. - Made use of
requestAnimationFrame()
to update gamepad input visualisation. - Rewritten
useGamepad()
to be settings-agnostic, making use ofrequestAnimationFrame()
mentioned above as well as React Context.
A fix has been attempted in #12 with promising results. Will further dogfood our current solution.
Update: It seems that Chakra UI is causing the memory leak. I guess this project is a perfect way to stress-test public design systems...
What we did
- Rewritten overlay section entirely in CSS Modules. Chakra UI is still retained for the overlay customiser.
- Completely remove polling with useInterval.
requestAnimationFrame()
has already done the trick.
Update: Fix implemented in #13.
The fixes mentioned above is confirmed to be working! Closing now.