Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML Performance - tested by François Grassard #1177

Closed
didikunz opened this issue Feb 14, 2019 · 10 comments
Closed

HTML Performance - tested by François Grassard #1177

didikunz opened this issue Feb 14, 2019 · 10 comments
Labels

Comments

@didikunz
Copy link

didikunz commented Feb 14, 2019

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,

@Julusian
Copy link
Member

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

@Julusian Julusian added the html label Feb 18, 2019
@ducthiem90
Copy link
Contributor

ducthiem90 commented Mar 18, 2019

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/

@Julusian
Copy link
Member

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

@drakmor
Copy link
Contributor

drakmor commented Mar 18, 2019

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

@drakmor
Copy link
Contributor

drakmor commented Apr 9, 2019

@ducthiem90
Copy link
Contributor

ducthiem90 commented May 22, 2019

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

@Julusian
Copy link
Member

@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

@ducthiem90
Copy link
Contributor

ducthiem90 commented Jun 7, 2019

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.

@jesperstarkar
Copy link
Contributor

Wow!!

@hreinnbeck
Copy link
Contributor

You could do a PR against https://github.com/nrkno/tv-automation-casparcg-server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants