Bug 61830 - Add AudioParam parameter scheduling implementation
Summary: Add AudioParam parameter scheduling implementation
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Rogers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-31 17:57 PDT by Chris Rogers
Modified: 2011-06-03 20:09 PDT (History)
2 users (show)

See Also:


Attachments
Patch (34.60 KB, patch)
2011-05-31 18:13 PDT, Chris Rogers
kbr: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Rogers 2011-05-31 17:57:23 PDT
Add AudioParam parameter scheduling implementation
Comment 1 Chris Rogers 2011-05-31 18:13:33 PDT
Created attachment 95525 [details]
Patch
Comment 2 Kenneth Russell 2011-06-01 17:20:46 PDT
Comment on attachment 95525 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=95525&action=review

This generally looks good though I do have a few questions, one high-level. Still, I'll mark this r+ to avoid blocking you.

> Source/WebCore/webaudio/AudioParamTimeline.cpp:145
> +    if (!m_eventsLock.tryLock()) {

I know that similar trylocks are used elsewhere on the audio thread, but won't this lock have a pretty high chance of contention if the application is requesting animation of a lot of parameters? It seems to me that there will be a high risk of dropouts specifically due to this new mechanism.

> Source/WebCore/webaudio/AudioParamTimeline.cpp:174
> +    ASSERT(values);

Can you add some assert about m_eventsLock being held here?

> Source/WebCore/webaudio/AudioParamTimeline.cpp:221
> +        float time2 = nextEvent ? nextEvent->time() : endTime + 1.0;

".0" suffix is probably unneeded here and in several places below and should be removed per style guide.
Comment 3 Chris Rogers 2011-06-03 12:17:42 PDT
Committed r88037: <http://trac.webkit.org/changeset/88037>
Comment 4 Chris Rogers 2011-06-03 12:22:38 PDT
Comment on attachment 95525 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=95525&action=review

>> Source/WebCore/webaudio/AudioParamTimeline.cpp:145
>> +    if (!m_eventsLock.tryLock()) {
> 
> I know that similar trylocks are used elsewhere on the audio thread, but won't this lock have a pretty high chance of contention if the application is requesting animation of a lot of parameters? It seems to me that there will be a high risk of dropouts specifically due to this new mechanism.

Each parameter has its own lock, so having many parameters won't increase the risk.  Also, the result of failing the tryLock will not be a "dropout" but simply a smooth continuation of using the previous parameter value.  Any param change will happen the next render quantum delayed by only a few milliseconds.  But even this will be a somewhat rare occurrence.

>> Source/WebCore/webaudio/AudioParamTimeline.cpp:174
>> +    ASSERT(values);
> 
> Can you add some assert about m_eventsLock being held here?

Not sure how to assert a Mutex being held.  I'd rather not call tryLock() just to make sure it fails...

>> Source/WebCore/webaudio/AudioParamTimeline.cpp:221
>> +        float time2 = nextEvent ? nextEvent->time() : endTime + 1.0;
> 
> ".0" suffix is probably unneeded here and in several places below and should be removed per style guide.

FIXED
Comment 5 Nico Weber 2011-06-03 19:36:34 PDT
Hi this breaks the clang build thusly:

clang:warning: argument unused during compilation: '-fobjc-exceptions'
/b/build/slave/Mac_Clang__dbg_/build/src/third_party/WebKit/Source/WebCore/WebCore.gyp/../webaudio/AudioParamTimeline.cpp:231:39:error: operands of ? are integers of different signs: 'unsigned int' and 'int' [-Werror,-Wsign-compare]
        int nextEventType = nextEvent ? nextEvent->type() : -1 /* unknown */;

Can you fix?
Comment 6 Chris Rogers 2011-06-03 19:41:36 PDT
Ok, I'll try to fix this.
Comment 7 Chris Rogers 2011-06-03 20:09:10 PDT
should be fixed now in:
http://trac.webkit.org/changeset/88089