New issue
Advanced search Search tips

Issue 780125 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Nov 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

AudioParam clamping to current time is very slow

Project Member Reported by rtoy@chromium.org, Oct 31 2017

Issue description

Chrome Version: 63.0.3239.18 (Official Build) beta (64-bit)

What steps will reproduce the problem?
Run this bit of code (with some AudioBuffer source that's at least many seconds long):

c = new AudioContext();
b = /* some long audio buffer of audio */;
s = new AudioBufferSourceNode(c, {loop: true, buffer: b});
gains = new Array(400);
for (let k = 0; k < gains.length; ++k) {
  gains[k] = new GainNode(c);
  s.connect(gains[k]).connect(c.destination);
}

ct = c.currenTime;
for (let t = 0; t < 20; t += 0.02) {
  let v = (t - Math.floor(t)) / gains.length;
  for (let k = 0; k < gains.length; ++k) {
    gains[k].gain.linearRampToValueAtTime(v, ct + t);
  }
}

What is the expected result?

Audio is smooth and glitch free, with varying volume

What happens instead?

Audio glitches.


 

Comment 1 by rtoy@chromium.org, Nov 1 2017

Owner: rtoy@chromium.org
Status: Started (was: Available)

Comment 2 by hames...@gmail.com, Nov 2 2017

Raymond,

Is it connected to our issue ?

Thanks

Comment 3 by rtoy@chromium.org, Nov 2 2017

hameshiv@ I don't know, since you don't link to any issue.
Project Member

Comment 5 by bugdroid1@chromium.org, Nov 14 2017

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

commit aa260864abeb2898f711578e864673a5ec7bc43a
Author: Raymond Toy <rtoy@chromium.org>
Date: Tue Nov 14 17:16:50 2017

Handle AudioParam start clamping more efficiently.

Add a new vector to keep track of all newly inserted events.  This
vector is processed once in the audio thread to clamp the start time
of the event if needed.  Once processed, this vector is cleared.

Previously, the clamp check would process the entire event list to see
if any event needed to be clamped.  Most of the time, this is wasted
because there are no events to be clamped because they're all in the
future or because they've already been clamped.

Also removed unneeded member functions and variables.

Bug:  780125 
Test: 
Change-Id: I73b871d8fa87a68e482cb98d48af33e05d1f0cfb
Reviewed-on: https://chromium-review.googlesource.com/747071
Reviewed-by: Hongchan Choi <hongchan@chromium.org>
Commit-Queue: Raymond Toy <rtoy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#516336}
[modify] https://crrev.com/aa260864abeb2898f711578e864673a5ec7bc43a/third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.cpp
[modify] https://crrev.com/aa260864abeb2898f711578e864673a5ec7bc43a/third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.h

Comment 6 by rtoy@chromium.org, Nov 15 2017

Status: Fixed (was: Started)

Sign in to add a comment