Page 1 of 1

Graphics stutter after starting audio capture

PostPosted: Wed May 25, 2022 2:36 am
by NickChapman
Hi all,
I'm running into an issue where I get a graphics stutter - a frame that takes ~50 ms to render, instead of the usual 1 ms or so.

I've tracked the cause down to audio capture of the browser.
When I return true from GetAudioParameters() to enable audio stream capture, then anywhere from 200 ms to 2.5 seconds after initiating capture, the application stutters, with a single frame that takes > 50 ms to render.

From previous experience, this type of graphics stutter is caused by the nvidia OpenGL drivers being blocked when trying to allocate or free memory, due to excessive memory alloc/frees on some other thread.

It's possible also some threading priority issue.

The stutter is relatively reliably reproduced - it happens maybe 80% of the time after initiating audio capture.

When I return false from GetAudioParameters(), no such stutter is caused.

For context, I'm using offscreen rendering in an OpenGL app, on Windows 10, GPU is RTX 3080. CEF build is 4951, built from source.

Any ideas / thoughts / workarounds?

Re: Graphics stutter after starting audio capture

PostPosted: Thu May 26, 2022 7:41 pm
by amaitland

Re: Graphics stutter after starting audio capture

PostPosted: Fri May 27, 2022 7:06 am
by NickChapman
amaitland wrote:Possibly related to https://bitbucket.org/chromiumembedded/ ... acket-loss


Possibly, however it looks like the proposed change in that thread was committed to Chromium already: https://chromium.googlesource.com/chrom ... %5E%21/#F1

Re: Graphics stutter after starting audio capture

PostPosted: Fri May 27, 2022 2:49 pm
by amaitland
That's the only performance issue I'm aware of.

Have you confirmed the change is included in your local build?

Re: Graphics stutter after starting audio capture

PostPosted: Sat May 28, 2022 5:54 am
by NickChapman
amaitland wrote:Have you confirmed the change is included in your local build?


Yes, the change is in my local chromium src.

Re: Graphics stutter after starting audio capture

PostPosted: Sat May 28, 2022 6:15 am
by amaitland
- Load chrome://gpu in a CefBrowser instance, confirm GPU acceleration is enabled
- Try with an official spotify build, make sure it's not something specific to your source build.

Re: Graphics stutter after starting audio capture

PostPosted: Mon May 30, 2022 5:51 am
by NickChapman
amaitland wrote:- Load chrome://gpu in a CefBrowser instance, confirm GPU acceleration is enabled


The issue happens with GPU acceleration, and also without (e.g. using --disable-gpu and --disable-gpu-compositing")

Re: Graphics stutter after starting audio capture

PostPosted: Mon May 30, 2022 9:06 am
by NickChapman
amaitland wrote:- Try with an official spotify build, make sure it's not something specific to your source build.


Tried with latest spotify build, same problem.

Re: Graphics stutter after starting audio capture

PostPosted: Mon May 30, 2022 3:50 pm
by amaitland
Are you using release builds? Antivirus disabled?

Does the problem reproduce with different hardware?

Perhaps Marshall has some other suggestions.

Re: Graphics stutter after starting audio capture

PostPosted: Tue May 31, 2022 2:15 am
by magreenblatt
You could try the Chromium profiling tools, to see if that points to a possible culprit. https://chromium.googlesource.com/chrom ... troduction