Remove the limitation of callback buffer size in AudioDestination::render() |
||||
Issue descriptionAs a part of new audio mixing approach and WebAudio latency hint introduction, we need AudioDestination to be able to render on a varying buffer size callbacks. At the moment there is a check there which prevents that https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/platform/audio/AudioDestination.cpp&cl=GROK&rcl=1462951182&l=158, but the reason for it is unclear: looks like the code is able to work a (almost) any callback buffer size. Could we remove this check?
,
May 12 2016
olka@ > we need AudioDestination to be able to render on a varying buffer size callbacks I thought we were going to move the FIFO for varying buffer size out of WebAudio? I was hoping to use the FIFO in AudioDestination solely for the inter-thread communication. (e.g. AudioWorklet thread and the actual audio thread in the renderer)
,
May 12 2016
Yes, let's clarify things first. Probably we will skip this change.
,
May 30 2016
Now when it's decided to keep both FIFOs in AudioDestination, can we fix it? And are we sure it won't cause buffer underflow?
,
May 30 2016
Okay, let me summarize where we are: > we need AudioDestination to be able to render on a varying buffer size callbacks. This is already happening. We are going to keep input and output FIFOs in AudioDestination, and we do not need to do anything further. The AudioWorklet change will require FIFO in the WebAudio side, so the output FIFO in AudioDestination can handle: 1) the inter-thread buffering and 2) the varying callback buffer size from the audio hardware. > And are we sure it won't cause buffer underflow? Not sure if I am following you. What causes the underflow and what prevents it from happening? WebAudio is based a dynamic audio graph (controlled with JS) so we cannot predict the latency or the required performance of the system. Also any special treatment might lead to the additional latency so we do want to avoid it. The code you pointed out in the post - I am not sure if we should fix this. Is there any scenario these values can be different?
,
May 30 2016
For the issue 564472 , WebAudio has 3 latency category: interactive, balanced and playback. The first two types must provide the fixed callback size. We have not decided what to do with the `playback`, but the fixed callback size (something large enough) seems to be a reasonable design because the web audio graph can change anytime. (Measuring the latency of a dynamic graph is almost impossible due to cycles and filters.)
,
May 30 2016
>Not sure if I am following you. What causes the underflow and what prevents it from happening? WebAudio is based a dynamic audio graph (controlled with JS) so we cannot predict the latency or the required performance of the system. Also any special treatment might lead to the additional latency so we do want to avoid it. As I understood, WebAudio code does not work without those two FIFOs, and they are used for Input somehow as well. My impression was that input pushes data into them. > The code you pointed out in the post - I am not sure if we should fix this. Let's switch to mail to cover the audience for the discussion :)
,
Feb 3 2017
It turns out we do not handle the input in AudioDestination at all. The new FIFO will be landed shortly, and it is designed to support any hardware callback buffer size. Now I am not sure which "check" prevented us from having a variable callback buffer size?
,
Feb 7 2017
olka@ This CL might fix this bug as well. WDYT? https://codereview.chromium.org/2549093009 If so, how do we verify it? Perhaps via the unit test included in that CL?
,
Feb 8 2017
The check is still there, isn't it? In any case it's not a priority, since the mixing experiment is closed for now.
,
Feb 8 2017
olka@ Could you clarify which check are you referring to? The link above does not work anymore.
,
Feb 9 2017
So |numberOfFrames| can be changed dynamically each callback? I know the experiment is closed, but what was the range of the flexible callback size? Certainly the new WebAudio FIFO can handle the variable callback size, but the pre-defined range would be nice to know.
,
Feb 9 2017
It cannot, otherwise DCHECK would be hit.
,
Feb 9 2017
What I meant was; if this mixing experiment is deployed, can |numberOfFrames| be changed dynamically? I thought that was implication of this bug entry, but wanted to confirm.
,
Feb 9 2017
It was deployed, it did not change the buffer size because of DCHECKs, there are no plans to re-deploy it for now. Basically, the bug is obsolete.
,
Feb 9 2017
Got it. Then I am closing this. |
||||
►
Sign in to add a comment |
||||
Comment 1 by rtoy@chromium.org
, May 12 2016