CEF OSR callback latency

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

CEF OSR callback latency

Postby sketch34 » Thu Sep 02, 2021 8:45 am

Hey guys, I'm trying to isolate significant latency / feeling of laggy input with my CEF integration. It looks like it is coming from the OnAcceleratedPaint() callback. Or rather, the time it takes for the callback to be called.

I measured this by inserting a Date.now() timestamp in a div in the webpage and comparing this time in the rendered frame to a timestamp generated in the C++ OnAcceleratedPaint() with chrono::system_clock::now().time_since_epoch().

Results are ~60-100 milliseconds of latency between when the frame is rendered by CEF to when I receive the callback. This occurs with multi-threaded message loop on or off. With it off I tried pumping CefDoMessageLoopWork() more frequently (every 2ms) but it made no difference.

Any ideas on how to reduce this or is it an issue with OSR? Thanks! :)

Method:

I added a custom <Framestamp> React element that updates a <div> with Date.now() every 5 seconds. This triggers a CEF render and a call to OnAccelleratedPaint(). I compared the timestamp rendered to the frame by React with the chrono::system_clock::now().time_since_epoch() in the callback on the C++ side, i.e. when the native app is notified by CEF of the frame.

Image

Code: Select all
468 TaCefBrowserRenderer::onAcceleratedPaint at time: 1630589012894
    Type: View
    Rect: 0, 0, 3000, 1800
469 TaCefBrowserRenderer::onAcceleratedPaint at time: 1630589012910
    Type: View
    Rect: 2563, 23, 170, 29
470 TaCefBrowserRenderer::onAcceleratedPaint at time: 1630589012911
    Type: View
    Rect: 0, 0, 3000, 1800


Results:

For each div update, for some reason I get 3-4 callbacks to OnAccelleratedPaint. One dirty rect is the div area and the others are the entire CEF window.

So in the above sample the latency is:

1630589012894 - 1630589012825 = 69 ms
1630589012910 - 1630589012825 = 85 ms
1630589012911 - 1630589012825 = 86 ms

Note this is with CEF 75.1.4+g4210896+chromium-75.0.3770.100 with OSR.
sketch34
Techie
 
Posts: 11
Joined: Sun Apr 25, 2021 8:24 pm

Re: CEF OSR callback latency

Postby sketch34 » Wed Nov 24, 2021 7:33 am

Anyone have experience or ideas on this?
sketch34
Techie
 
Posts: 11
Joined: Sun Apr 25, 2021 8:24 pm


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 37 guests