Bug 83524

Summary: AudioParam must support connections from audio-rate signals
Product: WebKit Reporter: Chris Rogers <crogers>
Component: New BugsAssignee: Chris Rogers <crogers>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, eric.carlson, feature-media-reviews, kbr, ojan, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch eric.carlson: review+

Chris Rogers
Reported 2012-04-09 16:40:11 PDT
AudioParam must support connections from audio-rate signals
Attachments
Patch (29.27 KB, patch)
2012-04-09 16:47 PDT, Chris Rogers
no flags
Patch (31.21 KB, patch)
2012-04-10 13:37 PDT, Chris Rogers
eric.carlson: review+
Chris Rogers
Comment 1 2012-04-09 16:47:39 PDT
Eric Carlson
Comment 2 2012-04-10 09:12:12 PDT
Comment on attachment 136342 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=136342&action=review > Source/WebCore/Modules/webaudio/AudioNode.cpp:163 > + // Sanity check input and output indices. > + if (outputIndex >= numberOfOutputs()) { Nit: Input index? In any case, I am not sure that this comment adds much value. > Source/WebCore/Modules/webaudio/AudioNodeOutput.cpp:143 > + ASSERT(context()->isGraphOwner()); > + return m_inputs.size(); The header comment notes that this must be called with the context's graph lock. Is it possible to ASSERT that this is true? > Source/WebCore/Modules/webaudio/AudioNodeOutput.cpp:201 > + ASSERT(context()->isGraphOwner()); > + > + ASSERT(param); > + if (!param) > + return; Can an AudioParam have a different context from the AudioNodeOutput? > Source/WebCore/Modules/webaudio/AudioNodeOutput.cpp:210 > + ASSERT(context()->isGraphOwner()); > + > + ASSERT(param); Ditto. > Source/WebCore/Modules/webaudio/AudioParam.cpp:112 > + // FIXME: support fan-in (multiple audio connections to this parameter with unity-gain summing). Nit: Is there a bug for this FIXME? > Source/WebCore/Modules/webaudio/AudioParam.cpp:169 > + // FIXME: support fan-in (multiple audio connections to this parameter with unity-gain summing). Ditto.
Chris Rogers
Comment 3 2012-04-10 13:35:04 PDT
Comment on attachment 136342 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=136342&action=review Eric, thanks for having a look. I think I've addressed your comments and have also added some details in the ChangeLog. >> Source/WebCore/Modules/webaudio/AudioNode.cpp:163 >> + if (outputIndex >= numberOfOutputs()) { > > Nit: Input index? In any case, I am not sure that this comment adds much value. Fixed: removed comment >> Source/WebCore/Modules/webaudio/AudioNodeOutput.cpp:143 >> + return m_inputs.size(); > > The header comment notes that this must be called with the context's graph lock. Is it possible to ASSERT that this is true? Already have it on line 142 >> Source/WebCore/Modules/webaudio/AudioNodeOutput.cpp:201 >> + return; > > Can an AudioParam have a different context from the AudioNodeOutput? Yes, it's possible if there are several AudioContexts which have been created. We have a sanity check in the newer AudioNode::connect(AudioParam*) method which nips this in the bud very early on: if (context() != param->context()) { ec = SYNTAX_ERR; return; } By the way, we already have a similar sanity check for AudioNode::connect(AudioNode*) (connecting an AudioNode -> AudioNode) since the contexts may be different. >> Source/WebCore/Modules/webaudio/AudioNodeOutput.cpp:210 >> + ASSERT(param); > > Ditto. See response for addParam() above >> Source/WebCore/Modules/webaudio/AudioParam.cpp:112 >> + // FIXME: support fan-in (multiple audio connections to this parameter with unity-gain summing). > > Nit: Is there a bug for this FIXME? Created bug and added link in the comment. >> Source/WebCore/Modules/webaudio/AudioParam.cpp:169 >> + // FIXME: support fan-in (multiple audio connections to this parameter with unity-gain summing). > > Ditto. Added bug link.
Chris Rogers
Comment 4 2012-04-10 13:37:44 PDT
Eric Carlson
Comment 5 2012-04-10 14:01:55 PDT
Comment on attachment 136342 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=136342&action=review >>> Source/WebCore/Modules/webaudio/AudioNodeOutput.cpp:143 >>> + return m_inputs.size(); >> >> The header comment notes that this must be called with the context's graph lock. Is it possible to ASSERT that this is true? > > Already have it on line 142 Oops, so *that* is what "isGraphOwner" checks :-) >>> Source/WebCore/Modules/webaudio/AudioNodeOutput.cpp:201 >>> + return; >> >> Can an AudioParam have a different context from the AudioNodeOutput? > > Yes, it's possible if there are several AudioContexts which have been created. We have a sanity check in the newer AudioNode::connect(AudioParam*) method which nips this in the bud very early on: > > if (context() != param->context()) { > ec = SYNTAX_ERR; > return; > } > > By the way, we already have a similar sanity check for AudioNode::connect(AudioNode*) (connecting an AudioNode -> AudioNode) since the contexts may be different. I saw that, which is why I wondered about this. So you are saying that an AudioParam will always be connected to an AudioNode before it is added to a node output?
Chris Rogers
Comment 6 2012-04-10 14:29:09 PDT
Chris Rogers
Comment 7 2012-04-10 14:32:49 PDT
(In reply to comment #5) > (From update of attachment 136342 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=136342&action=review > > >>> Source/WebCore/Modules/webaudio/AudioNodeOutput.cpp:143 > >>> + return m_inputs.size(); > >> > >> The header comment notes that this must be called with the context's graph lock. Is it possible to ASSERT that this is true? > > > > Already have it on line 142 > > Oops, so *that* is what "isGraphOwner" checks :-) > > >>> Source/WebCore/Modules/webaudio/AudioNodeOutput.cpp:201 > >>> + return; > >> > >> Can an AudioParam have a different context from the AudioNodeOutput? > > > > Yes, it's possible if there are several AudioContexts which have been created. We have a sanity check in the newer AudioNode::connect(AudioParam*) method which nips this in the bud very early on: > > > > if (context() != param->context()) { > > ec = SYNTAX_ERR; > > return; > > } > > > > By the way, we already have a similar sanity check for AudioNode::connect(AudioNode*) (connecting an AudioNode -> AudioNode) since the contexts may be different. > > I saw that, which is why I wondered about this. So you are saying that an AudioParam will always be connected to an AudioNode before it is added to a node output? Eric, thanks for the review! Yes, the whole process is started with a JavaScript call to connect() which is implemented in the AudioNode::connect() method, so we're catching mis-matching contexts very early before any other of this lower-level code gets executed.
Note You need to log in before you can comment on or make changes to this bug.