Page 1 of 1

How to IPC with utility process

PostPosted: Wed Jul 08, 2020 4:29 pm
by Nicky
I want to send messages from the browser process to the utility (--type=utility) process.
There is SendProcessMessage and OnProcessMessageReceived for this, But for SendProcessMessage I can only set either PID_BROWSER or PID_RENDERER, I would expect something like PID_UTILITY.
I tried treating it like a rendering process (using PID_RENDER and passing a CefRenderProcessHandler implementation to CefExecuteProcess) but it didn't work; ultimately it makes no real sense anyway that it works like that, but I wanted to try before creating a thread here.

Is there some supported way to send messages to the utility process? I obviously could rig my own, but not only would this be very messy, it also would be very platform specific; while CEF or at least Chromium under the hood must already be fully capable of talking to the utility process and exchanging messages with it.

Re: How to IPC with utility process

PostPosted: Wed Jul 08, 2020 5:18 pm
by magreenblatt
Why do you want to send IPC messages to the utility process?

Re: How to IPC with utility process

PostPosted: Thu Jul 09, 2020 3:17 am
by Nicky
It's another iteration for calum's problem here: viewtopic.php?f=6&t=17533

The utility process is the one who plays the audio when AudioServiceOutOfProcess is true. So my idea was to send a volume message to this process and then handle it accordingly.\

I tried your other suggestion from that thread (walking the DOM via Javascript), but on sites like youtube this became quickly non trivial (admittedly I am no experienced JavaScript Developer)
I also tried using chrome.tabCapture.capture to capture the tab, then get an audio context, a gain sink etc for it, but again no luck. Using this would have been my preferred solution, as it is the least intrusive of them all.

Re: How to IPC with utility process

PostPosted: Thu Jul 09, 2020 10:18 am
by magreenblatt
You can use CefAudioHandler to get the audio content, mute CEF playback with CefBrowserHost::SetAudioMuted, then play the audio yourself at whatever volume you prefer.