Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid memory allocation in AudioWorkletProcessor.process() #24093

Merged
merged 1 commit into from
Jun 16, 2020

Conversation

chromium-wpt-export-bot
Copy link
Collaborator

@chromium-wpt-export-bot chromium-wpt-export-bot commented Jun 10, 2020

Based on the spec 1, the current implementation of
AudioWorkletProcessor needs to create a new data container
(i.e. WebIDL sequence<>) for input, output, and param arrays.

With the new spec change 2, this CL changes the overall design
of the audio processing callback:

  1. Moves the processing call from AudioWorkletGlobalScope to
    AudioWorkletProcessor object.
  2. AudioWorkletProcessor now keeps the data container within
    the object and allocate memory when it is needed.

The preliminary benchmark shows the sizable improvement in the
audio stream quality. The glitch score
(= buffer underrun/total callback) is improved by ~9x in the
low-tier machine. 3

This is an API change 4, but the real world impact would be
negligible because there's no functionality change.

Bug: 1071085, 1086665
Change-Id: I3e664754973d4d86649d38c1807c6b9d7830fb96
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2218702
Reviewed-by: Raymond Toy <rtoy@chromium.org>
Reviewed-by: Yuki Shiino <yukishiino@chromium.org>
Commit-Queue: Hongchan Choi <hongchan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#779052}

Copy link
Collaborator

@wpt-pr-bot wpt-pr-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The review process for this patch is being conducted in the Chromium project.

@chromium-wpt-export-bot chromium-wpt-export-bot force-pushed the chromium-export-cl-2218702 branch 6 times, most recently from d909863 to 3cc5211 Compare June 16, 2020 16:19
Based on the spec [1], the current implementation of
AudioWorkletProcessor needs to create a new data container
(i.e. WebIDL sequence<>) for input, output, and param arrays.

With the new spec change [2], this CL changes the overall design
of the audio processing callback:

1. Moves the processing call from AudioWorkletGlobalScope to
   AudioWorkletProcessor object.
2. AudioWorkletProcessor now keeps the data container within
   the object and allocate memory when it is needed.

The preliminary benchmark shows the sizable improvement in the
audio stream quality. The glitch score
(= buffer underrun/total callback) is improved by ~9x in the
low-tier machine. [3]

This is an API change [4], but the real world impact would be
negligible because there's no functionality change.

[1]: https://webaudio.github.io/web-audio-api/#dom-audioworkletprocessor-process-inputs-outputs-parameters-inputs
[2]: WebAudio/web-audio-api#1933 (comment)
[3]: https://bugs.chromium.org/p/chromium/issues/detail?id=1086665#c2
[4]: https://chromestatus.com/feature/5647541725036544

Bug: 1071085, 1086665
Change-Id: I3e664754973d4d86649d38c1807c6b9d7830fb96
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2218702
Reviewed-by: Raymond Toy <rtoy@chromium.org>
Reviewed-by: Yuki Shiino <yukishiino@chromium.org>
Commit-Queue: Hongchan Choi <hongchan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#779052}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants