I have been exploring the electron framework in Windows 10 platform to render the binary YUV data (video frames) on the canvas using webgl.
I developed a c++ based node addon which can provide the video stream to the JS rendering webgl layer. Then these YUV frames are converted to RGB frames using the fragment shader and rendered in the callback which is tied to requestAnimationFrame
And I observed that the CPU % when displaying binary streams in electron is atleast twice compared to rendering the streams using a native WPF app.
Currently, I render data using a canvas which exposes Webgl context. And just the following rendering logic takes bulk of the CPU%:
Just to add more information, while fetching the webgl context from canvas, I had disabled preserveDrawingBuffer, alpha, depth, stencil and antialias to have the best performance setting. But still the CPU% was still 2x more than that of a WPF app. Is this performance expected on rendering the canvas content in windows? Or is there another way to render the binary streams in electron app which is more CPU efficient than the webgl based canvas rendering?