FPS of OnPaint calls

Having problems with building or using the CefSharp .NET binding? Ask your CEF-related questions here. Please ask general usage questions on StackOverflow.

Moderator: amaitland

FPS of OnPaint calls

Postby ValentinNikin » Fri Jun 18, 2021 2:06 am

Hello!

I want to control Fps of OnPaint calls for Offscreen mode. I.e I want to set up FPS as 25, 30, 60, or something other value. How I can do it?

I have one idea - save buffer from last OnPoint call, and by some timer render this buffer.

I also know about host.Invalidate() function. Seems I can call this function by timer to emulate the FPS value I need. But in this way I need somehow disable automatic OnPaint calls when changes on the page occured.

But, maybe exists more easy way? I'm a beginner in CEF, so please help me.
ValentinNikin
Techie
 
Posts: 24
Joined: Fri Jun 18, 2021 1:37 am

Re: FPS of OnPaint calls

Postby amaitland » Fri Jun 18, 2021 2:31 pm

You can set the http://cefsharp.github.io/api/91.1.x/ht ... meRate.htm property when the browser is created. Pass an instance of BrowserSettings into the ChromiumWebBrowser constructor.

You can set the http://cefsharp.github.io/api/91.1.x/ht ... meRate.htm to change the frame rate dynamically. Call http://cefsharp.github.io/api/91.1.x/ht ... erHost.htm to get a IBrowserHost reference.
Maintainer of the CefSharp project.
amaitland
Master
 
Posts: 967
Joined: Wed Jan 14, 2015 2:35 am

Re: FPS of OnPaint calls

Postby ValentinNikin » Fri Jun 18, 2021 4:05 pm

amaitland, thanks for the reply.

But seems this approach not suitable for me. I need render the frames with constant value of the frame rate.
If content on the page is static, this approach doesn't generate OnPaint event.

Let me describe more details of my task.
I have an URL of the some site. I need render the frames of this site with constant predefined frame rate and send this stream of frames by NDI (https://www.ndi.tv/sdk/) to the some clients.
Seems Cef is great solution to render the frames, but I need to send the frames with constant frequency, but OnPaint event doesn't generate when content on the page is static.
ValentinNikin
Techie
 
Posts: 24
Joined: Fri Jun 18, 2021 1:37 am

Re: FPS of OnPaint calls

Postby amaitland » Fri Jun 18, 2021 4:29 pm

Best to start with exactly what it is you are trying to achieve.

CEF does have functionality for controlling frame generation, issue https://bitbucket.org/chromiumembedded/ ... s-not-call suggests it's not working currently.

You can test it out for yourself.

http://cefsharp.github.io/api/91.1.x/ht ... rowser.htm
http://cefsharp.github.io/api/91.1.x/ht ... nabled.htm
http://cefsharp.github.io/api/91.1.x/ht ... nFrame.htm

Pass automaticallyCreateBrowser false to the ChromiumWebBrowser constructor.
Pass an instance of http://cefsharp.github.io/api/91.1.x/ht ... owInfo.htm to CreateBrowser
Make sure to call IWindowInfo.SetAsWindowless

https://github.com/cefsharp/CefSharp/bl ... er.cs#L330

If you find problems with this functionality then you can try hacking something together setting the framerate to 1 and calling Invalidate on a timer.

I've not tested either, so no guarantees.
Maintainer of the CefSharp project.
amaitland
Master
 
Posts: 967
Joined: Wed Jan 14, 2015 2:35 am

Re: FPS of OnPaint calls

Postby ValentinNikin » Fri Jun 18, 2021 4:51 pm

Hm... Ok, I will investigate your material. Thank you.
ValentinNikin
Techie
 
Posts: 24
Joined: Fri Jun 18, 2021 1:37 am


Return to CefSharp Forum

Who is online

Users browsing this forum: No registered users and 1 guest