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

Issue 717431 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Jul 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug



Sign in to add a comment

Add UMA stats for buffer underflow and overflow in AudioDestination / PushPullFIFO

Project Member Reported by olka@google.com, May 2 2017

Issue description

As a result of this CL https://codereview.chromium.org/2777903005/ WebAudio rendering is split between producer and consumer threads. The consumer (audio rendering) thread now renders zeros if there is no audio available in the FIFO. This differs from the previous behavior when it waited until the whole WebAudio graph is pulled.

In the previous implementation there was missed IPC deadline registered if rendering took too long. Now it will never be missed, but silence will be rendered in case of underflow, which will be heard as an audio glitch. We need new UMA stats to reflect audio quality for WebAudio.
 

Comment 1 by olka@chromium.org, May 2 2017

Cc: olka@chromium.org
I understand the need of the instrumentation and the data collection, but I am not entirely sure about how/when/where.

I think we can start collecting events of over/underflow in FIFO within the life cycle of AudioContext. However, this event counts are only meaningful when associated with other parameters like callback_buffer_size, and sampling_rate. I do not know how to get the combined data set through UMA. (On a related note, if you can make the association of these parameters from the collected data somehow, it does actually look like fingerprinting.)

With that said, it makes sense that we compare the data collected over time. That'll tell us when the regression happens.

Comment 3 by olka@chromium.org, May 5 2017

"However, this event counts are only meaningful when associated with other parameters like callback_buffer_size, and sampling_rate" - could you elaborate?

We need a logical replacement for 
Media.AudioRendererMissedDeadline and Media.AudioRendererAudioGlitches in WebAudio case, since WebAudio glitches won't be captured by these two any more.
I didn't know that you have been already using metric like 'MissedDeadline' and 'AudioGlitches'.

Currently the new FIFO only keeps track of two anomalies: Underflow/Overflow. However, technically only the underflow can happen (because the pulling drives the pushing) and this is the closest thing to 'MissedDeadline'. As a result, it will cause glitches.

How are these two events different?

Comment 5 by olka@chromium.org, May 9 2017

Sorry I should have mentioned metric names in the bug description.
If "events" are metrics referred above,
AudioRendererAudioGlitches is true is there were glitches during a stream lifetime; AudioRendererMissedDeadline is a percentage of missed deadlines for a stream.
You can check the source code on how they are calculated, and src/tools/metrics/histograms/histograms.xml for their meaning.
I started working on this, but now I have some concerns on how UMA data collection works in the destructor.

When user closes the tab, is the destructor properly invoked? I tried in many different layers in WebAudio/Blink (e.g. BaseAudioContext, AudioContext, AudioDestination...) and destructors never gets called. (Perhaps the renderer might handle the tear-down process a bit differently?)

Then what is the meaning of adding UMA calls in the destructor?

Comment 7 by olka@google.com, May 29 2017

Destruction of a renderer is a bit tricky: there is a fast shutdown and normal one, destructors are not called on "fast" shutdown path since it's basically killing the renderer process. I'm always confused about it, you may need to dig to find out more on when "slow" shutdown path is initiated.
Another option is to log a stat per some time interval.
I think the https://cs.chromium.org/chromium/src/components/metrics/single_sample_metrics_factory_impl.h can help with reliably reporting the stat at destruction. I haven't used it myself though.
olka@

> Another option is to log a stat per some time interval.

Not sure how meaningful is this. I think it would be better if we can track each lifecycle of BaseAudioContext.

maxmorin@

Ah, good to know. Yes, it seems that way but it is not exposed to Blink yet, so I need to consult Blink architecture folks first before I can use it through some plumbing. Also I am slightly concerned that there is no customer for this class yet.

Comment 10 by olka@chromium.org, Jun 26 2017

Could you suggest what is a plan of implementing it?
We can't help much in triaging WebAudio-related issues without this info.
Also, changing priorities of worklet threads cannot be done prior to having these stats, since we need to have a way to estimate positive impact of such a change (and we'll have negative impact in terms of missed IPC deadlines due to scheduling).
Status: Started (was: Assigned)
Project Member

Comment 12 by bugdroid1@chromium.org, Jul 6 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/d8e3450bc28b308bd4426170a153a96c4180aaee

commit d8e3450bc28b308bd4426170a153a96c4180aaee
Author: Hongchan Choi <hongchan@chromium.org>
Date: Thu Jul 06 19:06:47 2017

Add UMA metrics for FIFO underflow

This CL adds two new metrics from PushPullFIFO, the new rendering
pipeline for WebAudio. The motivation is to transfer the metric
coverage from the media renderer:

Media.AudioRendererAudioGlitches
    -> WebAudio.PushPullFIFO.UnderflowGlitches
Media.AudioRendererMissedDeadline
    -> WebAudio.PushPullFIFO.UnderflowPercentage

Bug:  717431 
Change-Id: Ib01eeb2f6acac12a125e9f12aced1e784620eab3
Reviewed-on: https://chromium-review.googlesource.com/548338
Commit-Queue: Hongchan Choi <hongchan@chromium.org>
Reviewed-by: Mark Pearson <mpearson@chromium.org>
Reviewed-by: Olga Sharonova <olka@chromium.org>
Reviewed-by: Raymond Toy <rtoy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#484698}
[modify] https://crrev.com/d8e3450bc28b308bd4426170a153a96c4180aaee/third_party/WebKit/Source/platform/audio/PushPullFIFO.cpp
[modify] https://crrev.com/d8e3450bc28b308bd4426170a153a96c4180aaee/third_party/WebKit/Source/platform/audio/PushPullFIFO.h
[modify] https://crrev.com/d8e3450bc28b308bd4426170a153a96c4180aaee/tools/metrics/histograms/histograms.xml

Status: Fixed (was: Started)

Sign in to add a comment