New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 816483 link

Starred by 4 users

Issue metadata

Status: Assigned
Owner:
OOO Dec 22 - Jan 8
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

Speed: Real-time audio threads in the browser process do not get CPU cycles

Project Member Reported by olka@chromium.org, Feb 26 2018

Issue description

Mac OS X 10.11.6
Chrome/64.0.3282.167
Macbook Air

Running AppRTC; browser-side has 1 input audio thread (117603) and 1 output audio thread (124631) which are expected to be real-time.
Both threads show a pattern of intervals (up to ~18 ms long)  where they do not get CPU cycles - see an example in the attachment.

AUAudioInputStream::OnDataIsAvailable

Wall:
avg	
0.264 ms
count	
4,701
max	
19.268 ms **********
min	
0.074 ms
std	
1.231 ms

CPU:
avg	
0.165 ms
count	
4,701
max	
2.445 ms
min	
0.073 ms
std	
0.125 ms

AUHALStream::Render

Wall:
avg	
0.199 ms
count	
9,479
max	
19.098 ms ****
min	
0.005 ms
std	
0.848 ms

CPU:
avg	
0.150 ms
count	
9,479
max	
2.248 ms
min	
0.005 ms
std	
0.131 ms



 
browser process descheduled.png
218 KB View Download
Did you somehow verify that these are actually real-time and we didn't just assume they were all this time?

Comment 2 by olka@chromium.org, Feb 26 2018

Don't see any blocking operations there except one-time memory allocation [1] and allocation at [2] which is not expected to happen under these circumstances, and is not expected to happen that often.

[1] https://cs.chromium.org/chromium/src/media/audio/mac/audio_auhal_mac.cc?type=cs&q=AUHALStream::Render&sq=package:chromium&l=307
[2]https://cs.chromium.org/chromium/src/media/audio/mac/audio_low_latency_input_mac.cc?type=cs&q=AUAudioInputStream::OnDataIsAvailable&sq=package:chromium&l=731

Comment 3 by olka@chromium.org, Feb 26 2018

Labels: Performance
Summary: Speed: Real-time audio threads in the browser process do not get CPU cycles (was: Real-time audio threads in the browser process do not get CPU cycles)
Could the Speed team take a look?
Trace shows the time being spend between beginning of OnMoreData (https://cs.chromium.org/chromium/src/media/audio/audio_output_controller.cc?type=cs&q=AudioOutputController::OnMoreData&sq=package:chromium&l=366) and beginning of AudioSyncReader::WaitUntilDataIsReady. The only stuff in between is a couple of atomic ops. :/

Comment 5 by olka@chromium.org, Feb 28 2018

Hmm looks like the trace itself got dropped from the description. Reattaching.

Comment 6 by olka@chromium.org, Feb 28 2018

Did not work. Reattaching again.
trace_MACBOOK_AIR_TRACING(AEC_on)_echo_observed_echo_ToMacbookPro(AEC_off).json.gz
13.3 MB Download

Comment 7 by olka@chromium.org, Mar 1 2018

Related to  Issue 811525 ?

Comment 8 by olka@chromium.org, Mar 6 2018

Maybe App Nap issue?

vasanthakumar@ - is it possible that chrome was not in foreground during the test?
@Olga: I dont think thats possible. I remember leaving it in the foreground while performing the test. 

Also at that moment all other tabs were closed. Only relevant ones to the test were active during that time. (~2 tabs)
On Windows I would investigate an issue like this by recording an ETW trace, which would show me all context switch data, meaning it would show me exactly where the audio thread was waiting, and who woke it up, regardless of whether the delays were caused by Chrome, other software, or hardware.

I've never used Instruments on OSX but my understanding is that it records the same types of information and allows the same type of analysis. Can the original reporter record this type of data and see if it reveals anything useful? Ideally this should let us jump from guesses to an observable explanation. I've heard that Instruments is easier to use than ETW, which wouldn't take much.

Labels: M-70
Labels: -Pri-1 Pri-2
Dropping to p2 since it hasn't been worked on for sometime.
Issue 798690 has been merged into this issue.

Sign in to add a comment