Issue metadata
Sign in to add a comment
|
Web Audio API setValueCurveAtTime generates error if the Float32 array is too long since Chrome 59.0.3071.86
Reported by
hadrienj...@gmail.com,
Sep 26 2017
|
||||||||||||||||||
Issue descriptionUserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3223.8 Safari/537.36 Steps to reproduce the problem: See this github repo for more details: https://github.com/hadrienj/testSetValueCurveAtTime 1. Create multiple loops that use the Chris Willson technique to schedule sounds. Hundreds of sounds are playing together. 2. Use setValueCurveAtTime() with a big Float32 array as a first argument What is the expected behavior? The use of long Float32 arrays in setValueCurveAtTime() should not impact the performance especially because it was not the case in latter versions and could crash some applications. What went wrong? The error seems to come up at random (hence the need to have a lot of playing tones): Uncaught DOMException: Failed to execute 'setValueCurveAtTime' on 'AudioParam': setValueAtTime(0, 0.2119423349114291) overlaps setValueCurveAtTime(..., 0.2031746031746032, 0.01) 1. The test case should work with Chrome 58.0.3029.81 but not on 59.0.3071.86 or earlier. 2. The length of the Float32 array does matter and big arrays will not work in 59.0.3071.86 or earlier. Did this work before? Yes 58.0.3029.81 Does this work in other browsers? Yes Chrome version: 63.0.3223.8 Channel: canary OS Version: OS X 10.12.6 Flash Version: Shockwave Flash 27.0 r0
,
Sep 26 2017
Thanks for your comment! Yes the error is clear but the problem is that the event ends up to be scheduled at a time that is already passed because the whole application slows down when the array is too long.
,
Sep 26 2017
On my pretty fast Linux Z840, your test case uses up 85% CPU. So you could possibly be running out of CPU for the render quantum, causing your timing to be messed up. I'll need to take a closer look at this, though.
,
Sep 26 2017
Oh, and for the record, is it really crashing for you? That is, a sad tab? Or is it actually producing a console error message about setValueAtTime overlapping a setValueCurve? The distinction matters a lot.
,
Sep 26 2017
Ok, so it would be possible that the delay comes from a too high CPU. Is it the case with older version of Chrome as well? As for the crash, in some cases it freezes and I have to quit Chrome and restart it. Sometimes I can refresh the page. In any case, I have hundreds of error message in the console.
,
Oct 19 2017
Ok. Couple of things here. First, there is a cost for long curves because we produce a warning if any curve value is outside the nominal range and because we have to copy the curve to an internal storage area. Second, I can reproduce this on my mac. We probably shouldn't be generating this error. On my mac (after adding some logs to toneCloud.js), I see this: setValueCurve(..., 0.005333333333333333, 0.01) setvalueCurve(..., 0.04533333333333334, 0.01) Failed to execute setValueCurveAtTime on AudioParam: setValueAtTime(0,0.005333333333333333) overlaps setValueCurveAtTime(..., 0.04533333333333334, 0.01) You never call setValueAtTime, so this setValueAtTime is an internally generated event that is placed at the end of a setValueCurveAtTime. This needs to be fixed.
,
Oct 19 2017
Oh, and it's not a crash. It's a Javascript error. That's a big difference.
,
Oct 20 2017
Oops. The actual error message on OSX is: Failed to execute 'setValueCurveAtTime' on 'AudioParam': setValueAtTime(0, 0.05533333333333334) overlaps setValueCurveAtTime(..., 0.05333333333333334, 0.01) so the setValueCurveAtTiem is starting at the same time as the setValueAtTime.
,
Nov 22 2017
I have a new warning in Chrome 64.0.3275.0 (Canary). Maybe this is related: `Gain.gain.value setter called at time 0 overlaps event setValueCurveAtTime(..., 0, 0.01) to setValueAtTime(0.1, 0.01)` You can try to reproduce it from the file `target.js` in the same github repo (https://github.com/hadrienj/testSetValueCurveAtTime). There is no warning in Chrome 62.0.3202.94. Thanks!
,
Jan 5 2018
Sorry for the delay. The new warning is a note that you're setting the gain.value at the same time as when you've scheduled a setValueCurveAtTime. In the very near future, this is going to cause an error because the value setter will be come exactly equivalent to setValueAtTime and you can't do a setValueAtTime that overlaps a setValueCurveAtTime.
,
Feb 7 2018
Hi, I still have this error with newer version of Chrome and now even with a smaller amount of values in `setValueCurveAtTime`. Any update about this? Thanks!
,
Feb 7 2018
Please send us the error message that you're getting the in dev console.
,
Feb 7 2018
It is still the same error (like `Uncaught DOMException: Failed to execute 'setValueCurveAtTime' on 'AudioParam': setValueAtTime(0, 0.2119423349114291) overlaps setValueCurveAtTime(..., 0.2031746031746032, 0.01)`)
,
Feb 7 2018
This message says that you've scheduled (probably) multiple setValueCurveAtTime() automations that overlap. The error message is not very clear. I am working to clarify the message so it's more obvious exactly what the problem is. It's not going to help you though. I think you need to change how you schedule the automations so that they occur a little further into the future.
,
Feb 8 2018
Yes I see thank you for your time! It is indeed very frustrating because it was working well on older versions of Chrome (until Chrome 58.0.3029.81)!
,
Feb 8 2018
Hmm. It's possible we regressed how setValueCurveAtTime is done between Chrome 58 and now. One change is that we now have to copy the curve array into internal storage; this wasn't done before. I'll need to investigate when this change is made.
,
Feb 8 2018
Not sure what's going on. We've been doing a copy since at least Chrome 57. Using ToT chrome with my patch for better messages. I still get messages like: Uncaught DOMException: Failed to execute 'setValueCurveAtTime' on 'AudioParam': setValueCurveAtTime(..., 187.3888700599857, 0.01) overlaps setValueAtTime(0.0166667, 187.3966439909297) So it seems you are actually scheduling setValueCurve that overlaps setValueAtTime (or vice versa). I also run perf on this. Very little time is spent on running the timeline including the time to process setValueCurveAtTime which include the time to do the overlap check and the array copy: 0.12% chrome libblink_modules.so [.] blink::AudioParam::setValueCurveAtTime 0.04% AudioOutputDevi libblink_modules.so [.] blink::AudioParamTimeline::ValuesForFrameRange 0.03% AudioOutputDevi libblink_modules.so [.] blink::AudioParamTimeline::ValuesForFrameRangeImpl 0.01% AudioOutputDevi libblink_modules.so [.] blink::AudioParamTimeline::ProcessSetValueCurve 0.01% AudioOutputDevi libblink_modules.so [.] blink::AudioParamTimeline::HandleAllEventsInThePast 0.01% AudioOutputDevi libblink_modules.so [.] blink::AudioParamHandler::CalculateFinalValues 0.01% AudioOutputDevi libblink_modules.so [.] blink::AudioParamTimeline::HandleFirstEvent 0.01% AudioOutputDevi libblink_modules.so [.] blink::AudioParamTimeline::HasValues 0.01% chrome libblink_modules.so [.] blink::AudioParamHandler::AudioParamHandler 0.00% chrome libblink_modules.so [.] blink::AudioParamTimeline::SetValueCurveAtTime 0.00% AudioOutputDevi libblink_modules.so [.] blink::AudioParam::value 0.00% AudioOutputDevi libblink_modules.so [.] blink::AudioParamHandler::CalculateSampleAccurateValues 0.00% chrome libblink_modules.so [.] blink::AudioParamTimeline::InsertEvent 0.00% AudioOutputDevi libblink_modules.so [.] blink::AudioParamTimeline::ClampNewEventsToCurrentTime 0.00% AudioOutputDevi libblink_modules.so [.] blink::AudioParamHandler::Value
,
Feb 12 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/9390f8e06d90465c467c8c72138bf4c3cd327206 commit 9390f8e06d90465c467c8c72138bf4c3cd327206 Author: Raymond Toy <rtoy@chromium.org> Date: Mon Feb 12 19:05:20 2018 Use special internal event for marking the end of a curve Previously, creation of a SetValueCurve event would automatically insert a SetValue event at the end of the SetValueCurve to establish an end value for the curve so that following events would start from the end of the curve instead of the beginning. However, this causes incorrect errors about overlapping SetValueCurve events if a SetValueCurve is scheduled to start at the very end of a preceeding SetValueCurve. The implicitly inserted SetValue would overlap the new SetValueCurve. Using an internal event avoids this conflict, but still establishes the appropriate event needed to manage the timeline. Bug: 768740 Test: Change-Id: Ibc798e0427bb49c3e163f5a7535f26c49b166303 Reviewed-on: https://chromium-review.googlesource.com/731186 Reviewed-by: Hongchan Choi <hongchan@chromium.org> Commit-Queue: Raymond Toy <rtoy@chromium.org> Cr-Commit-Position: refs/heads/master@{#536150} [modify] https://crrev.com/9390f8e06d90465c467c8c72138bf4c3cd327206/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setValueCurve-exceptions-expected.txt [modify] https://crrev.com/9390f8e06d90465c467c8c72138bf4c3cd327206/third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.cpp [modify] https://crrev.com/9390f8e06d90465c467c8c72138bf4c3cd327206/third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.h
,
Mar 19 2018
hadrianjean@: Can you retry with Chrome canary? There have been a few changes to make the messages clearer (and a few minor speed-ups in some cases).
,
Mar 20 2018
Hi rtoy, Thanks for your help! Unfortunately, the problem remains with the last Canary version. Do you have the same problem when you copy and paste the content of the `toneCloud.js` file into the console ? It works on Chrome 58 and older but not yet on the last Canary. Thanks again
,
Mar 20 2018
I haven't tried it yet. I still think it's because you don't schedule the events far enough in advance. but I will test again locally. |
|||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||
Comment 1 by rtoy@chromium.org
, Sep 26 2017