Server: HTML Performance - tested by Fran莽ois Grassard

Created on 14 Feb 2019  路  10Comments  路  Source: CasparCG/server

I was chatting with Fran莽ois Grassard over the past few days. He once showed me an AE to HTML exporter and I asked him to modify this for the current versions of AE and Caspar. I will add part of that conversation down bellow:

I spent the night on the last release of CasparCG. I can now confirm that the 2.2 release is not able to handle HTML5 well enough. The frame rate is not constant, it's impossible to use WebGl, I made several tests on pure CSS animations and other controlled by JavaScript. Il was always too laggy and abviously impossible to synchronize with audio.

Yes, for now I'm still thinking HTML5 is a great choice in general, but the HTML Producer in CasparCG is not ready yet. I you want to take look, the one integrated in OBS work really well since the last summer.

Take a look at "The browser source was majorly refactored, and is now hardware accelerated."

So I think we should investigate that ASAP,

html

Most helpful comment

I finished shared texture from cef to Caspar. And the result is good. My solution:

  • Create a d3d11 device
  • In OnAcceleratedPaint event of cef, open shared texture, copy it to a surface can read. Map surface to a subresource. Then copy data to Caspar mutable frame.
    But I work in Caspar 2.1 and only support for windows. I shall try in Caspar 2.2 soon.

All 10 comments

The framerate issue I am confident is because of #1165. I feel like I'm trying to blame everything on that, but that issue was found while looking into jerky html rendering. (Fun fact, if you go against all the html in caspar advice and don't use onRequestAnimationFrame things actually render a lot smoother!)

Yes, lack of webgl is known and down to lack of gpu acceleration in cef. There is a config option to enable gpu acceleration (and have decent webgl), but that often gives much worse overall performance.

Audio in html I am hoping for 2.3, still waiting for it to get merged in cef then it should follow shortly after here. #669

I have started working on proper gpu acceleration, but havent had much time to spend on it. Again, something that I aim to have for 2.3

I think you need use cef accelerator to create caspar frame. I try to use CefRenderHandler::OnAcceleratedPaint event, enable shared texture: CefWindowInfo.shared_texture_enabled = true, browse tick time is good with enable-gpu for html, but I don't know copy D3D11Device Texture2D to caspar frame?
No shared:
https://drive.google.com/open?id=1yp8m106hg3gZwVPir05KiX50GX-nN4E6
Shared:
https://drive.google.com/open?id=1n8FHHil2uj330iJ3FXxbrazMdQZprqDp
Test webgl url:
http://pixijs.io/pixi-filters/tools/demo/

I think you need use cef accelerator to create caspar frame. I try to use CefRenderHandler::OnAcceleratedPaint event, enable shared texture: CefWindowInfo.shared_texture_enabled = true, browse tick time is good with enable-gpu for html, but I don't know copy D3D11Device Texture2D to caspar frame?

Yeah, converting the frames is not simple, but I have something working and haven't had time to finish it up yet

May be we must add support for:

  1. CefWindowInfo.shared_texture_enabled (windows DX11 only, example - https://bitbucket.org/chromiumembedded/cef/commits/1e6b870af0117a675014cc559c1ad9141733226b?at=master or https://github.com/daktronics/cef-mixer) + CefRenderHandler::OnAcceleratedPaint
  2. CefWindowInfo.external_begin_frame_enabled (linux: https://bitbucket.org/chromiumembedded/cef/commits/a48e0720762ac3f2c0c6e08b65f82f5ca8050fbd?at=master windows: https://bitbucket.org/chromiumembedded/cef/commits/713eebcafcd7799d4e0eb58b8c2ab58d03ab9b65?at=master) + CefBrowserHost::SendExternalBeginFrame

But soon will be support for Viz - https://bitbucket.org/chromiumembedded/cef/issues/2575/viz-implementation-for-osr

I think you need use cef accelerator to create caspar frame. I try to use CefRenderHandler::OnAcceleratedPaint event, enable shared texture: CefWindowInfo.shared_texture_enabled = true, browse tick time is good with enable-gpu for html, but I don't know copy D3D11Device Texture2D to caspar frame?

Yeah, converting the frames is not simple, but I have something working and haven't had time to finish it up yet

Hi Julusian.
Are you finish "something"?
I think need create a d3d11 context. Then:
Html producer --> CefRenderHandler::OnAcceleratedPaint --> d3d11 context: open_shared_texture --> read image to caspar mutable frame --> draw_frame.
But I do not know how to do

@ducthiem90 I havent been able to spend any time to try and finish this up yet.
It looks like the CEF changes linked to above will break any implementation against the current accelerated rendering, so I am hoping for that change to stabilise soon before I try and make more progress

I finished shared texture from cef to Caspar. And the result is good. My solution:

  • Create a d3d11 device
  • In OnAcceleratedPaint event of cef, open shared texture, copy it to a surface can read. Map surface to a subresource. Then copy data to Caspar mutable frame.
    But I work in Caspar 2.1 and only support for windows. I shall try in Caspar 2.2 soon.

Wow!!

Was this page helpful?
0 / 5 - 0 ratings