Bug 66830 - AudioPannerNode::setPanningModel() does not update m_panningModel properly
Summary: AudioPannerNode::setPanningModel() does not update m_panningModel properly
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Audio (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Raymond Toy
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-23 17:51 PDT by Chris Rogers
Modified: 2012-01-27 19:12 PST (History)
4 users (show)

See Also:


Attachments
Patch (5.57 KB, patch)
2012-01-23 13:52 PST, Raymond Toy
no flags Details | Formatted Diff | Diff
Patch (5.58 KB, patch)
2012-01-23 14:32 PST, Raymond Toy
no flags Details | Formatted Diff | Diff
Patch (4.85 KB, patch)
2012-01-25 16:13 PST, Raymond Toy
no flags Details | Formatted Diff | Diff
Patch (5.34 KB, patch)
2012-01-26 16:06 PST, Raymond Toy
no flags Details | Formatted Diff | Diff
Patch (6.35 KB, patch)
2012-01-26 18:59 PST, Raymond Toy
no flags Details | Formatted Diff | Diff
Patch (6.36 KB, patch)
2012-01-26 19:35 PST, Raymond Toy
no flags Details | Formatted Diff | Diff
Patch (6.38 KB, patch)
2012-01-27 12:42 PST, Raymond Toy
no flags Details | Formatted Diff | Diff
Patch (6.46 KB, patch)
2012-01-27 15:20 PST, Raymond Toy
no flags 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-08-23 17:51:32 PDT
AudioPannerNode::setPanningModel() correctly creates a new panner object of the correct type, but does not update m_panningModel properly.
So the .panningModel attribute will not show the new model.
Comment 1 Raymond Toy 2011-11-18 14:10:41 PST
Is the fix as simple as adding m_panningModel = model in AudioPannerNode::setPanningModel in AudioPannerNode.cpp?
Comment 2 Chris Rogers 2012-01-05 22:00:58 PST
(In reply to comment #1)
> Is the fix as simple as adding m_panningModel = model in AudioPannerNode::setPanningModel in AudioPannerNode.cpp?

It seems as simple as that :)
Comment 3 Raymond Toy 2012-01-23 13:52:04 PST
Created attachment 123615 [details]
Patch
Comment 4 WebKit Review Bot 2012-01-23 13:59:15 PST
Attachment 123615 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/weba..." exit_code: 1

Source/WebCore/ChangeLog:12:  Line contains tab character.  [whitespace/tab] [5]
Total errors found: 1 in 5 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 5 Raymond Toy 2012-01-23 14:32:13 PST
Created attachment 123622 [details]
Patch
Comment 6 Chris Rogers 2012-01-25 15:08:12 PST
Comment on attachment 123622 [details]
Patch

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

> LayoutTests/webaudio/panner-set-model.html:77
> +          createTestAndRun(context);

This test seems more complicated than necessary.  Can't we just create a single AudioPannerNode and then set the panningModel attribute for each of the constant values, then check that the attribute returns the same value?

Then we can get rid of createTestAndRun() and all of the associated testing machinery around.
Comment 7 Raymond Toy 2012-01-25 16:12:53 PST
Comment on attachment 123622 [details]
Patch

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

>> LayoutTests/webaudio/panner-set-model.html:77
>> +          createTestAndRun(context);
> 
> This test seems more complicated than necessary.  Can't we just create a single AudioPannerNode and then set the panningModel attribute for each of the constant values, then check that the attribute returns the same value?
> 
> Then we can get rid of createTestAndRun() and all of the associated testing machinery around.

Simplified test as suggested.
Comment 8 Raymond Toy 2012-01-25 16:13:13 PST
Created attachment 124031 [details]
Patch
Comment 9 Chris Rogers 2012-01-25 16:44:20 PST
Comment on attachment 124031 [details]
Patch

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

> Source/WebCore/webaudio/AudioPannerNode.cpp:155
>      if (!m_panner.get() || model != m_panningModel) {

I just noticed that we should do bounds checking on "model" and reject illegal values

> LayoutTests/webaudio/panner-set-model.html:18
> +      var renderLengthSeconds = 0.001;

We don't need these two variables since we don't need to use an offline audio context.

> LayoutTests/webaudio/panner-set-model.html:30
> +          var context = new webkitAudioContext(2, sampleRate * renderLengthSeconds, sampleRate);

I think we can use a "regular" AudioContext here (no constructor arguments)

> LayoutTests/webaudio/panner-set-model.html:36
> +          // correctly.

We should add a comment describing the "magic" number 3, describing the existing panning constant values...

> LayoutTests/webaudio/panner-set-model.html:43
> +                   success = false;

nit: extra space before "success"

> LayoutTests/webaudio/panner-set-model.html:45
> +          }

We can add a test case where we try to set the panning model to an illegal value, and make sure it doesn't get set to that value.

> LayoutTests/webaudio/panner-set-model.html:54
> +                  

nit: extra blank line
Comment 10 Raymond Toy 2012-01-26 08:17:38 PST
Comment on attachment 124031 [details]
Patch

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

>> LayoutTests/webaudio/panner-set-model.html:36
>> +          // correctly.
> 
> We should add a comment describing the "magic" number 3, describing the existing panning constant values...

Do you want to say something more than that there are currently 3 panner models numbered 0 to 2?

>> LayoutTests/webaudio/panner-set-model.html:45
>> +          }
> 
> We can add a test case where we try to set the panning model to an illegal value, and make sure it doesn't get set to that value.

I tried setting the model to 99.  .panningModel is 99.   Maybe we shouldn't add this test now and file a bug report about it and fix it there, updating this test appropriately?
Comment 11 Chris Rogers 2012-01-26 11:21:56 PST
(In reply to comment #10)
> (From update of attachment 124031 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=124031&action=review
> 
> >> LayoutTests/webaudio/panner-set-model.html:36
> >> +          // correctly.
> > 
> > We should add a comment describing the "magic" number 3, describing the existing panning constant values...
> 
> Do you want to say something more than that there are currently 3 panner models numbered 0 to 2?

Ideally, we wouldn't even have a loop and would create a testing function and do something like this:

testSet(panner.EQUALPOWER);
testSet(panner.HRTF);
testSet(panner.SOUNDFIELD);



> 
> >> LayoutTests/webaudio/panner-set-model.html:45
> >> +          }
> > 
> > We can add a test case where we try to set the panning model to an illegal value, and make sure it doesn't get set to that value.
> 
> I tried setting the model to 99.  .panningModel is 99.   Maybe we shouldn't add this test now and file a bug report about it and fix it there, updating this test appropriately?

In another comment about the C++ implementation, I mention we should be doing bounds checking...
Comment 12 Raymond Toy 2012-01-26 16:06:54 PST
Created attachment 124203 [details]
Patch
Comment 13 Chris Rogers 2012-01-26 17:09:09 PST
Comment on attachment 124203 [details]
Patch

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

> Source/WebCore/webaudio/AudioPannerNode.cpp:155
>      if (!m_panner.get() || model != m_panningModel) {

Please do bounds checking on "model" and silently fail if model is not valid

> LayoutTests/webaudio/panner-set-model.html:55
> +

Please add one additional test setting to an illegal value and validating that the value did *not* change.
Comment 14 Raymond Toy 2012-01-26 18:59:13 PST
Created attachment 124234 [details]
Patch
Comment 15 Raymond Toy 2012-01-26 19:01:25 PST
(In reply to comment #13)
> (From update of attachment 124203 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=124203&action=review
> 
> > Source/WebCore/webaudio/AudioPannerNode.cpp:155
> >      if (!m_panner.get() || model != m_panningModel) {
> 
> Please do bounds checking on "model" and silently fail if model is not valid

Done.  Not sure if this is how you want me to test for a valid model, though.
> 
> > LayoutTests/webaudio/panner-set-model.html:55
> > +
> 
> Please add one additional test setting to an illegal value and validating that the value did *not* change.

Done.
Comment 16 WebKit Review Bot 2012-01-26 19:04:01 PST
Attachment 124234 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/weba..." exit_code: 1

Source/WebCore/ChangeLog:13:  Line contains tab character.  [whitespace/tab] [5]
Total errors found: 1 in 5 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 17 Raymond Toy 2012-01-26 19:35:04 PST
Created attachment 124240 [details]
Patch
Comment 18 Chris Rogers 2012-01-27 10:31:41 PST
Comment on attachment 124240 [details]
Patch

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

Looks great if the comments are addressed.

> Source/WebCore/webaudio/AudioPannerNode.cpp:166
> +        // Silently fail, without doing anything.

I wouldn't use the word "fail" since it implies a defect in the implementation.  How about:

// Ignore illegal panner values.

Or, even better yet, no comment at all since it's quite obvious from the code itself.  WebKit style is to try to avoid obvious comments.

One thing we could consider is throwing an exception here, so another option is:

// FIXME: consider throwing exception for illegal model value.

> LayoutTests/webaudio/panner-set-model.html:62
> +              testFailed("Panner set to invalid model, but the panningModel changed fomr 2 to " + panner.panningModel);

typo: "fomr" -> "from"
Comment 19 Raymond Toy 2012-01-27 12:42:27 PST
Created attachment 124352 [details]
Patch
Comment 20 Raymond Toy 2012-01-27 12:43:48 PST
Comment on attachment 124240 [details]
Patch

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

>> Source/WebCore/webaudio/AudioPannerNode.cpp:166
>> +        // Silently fail, without doing anything.
> 
> I wouldn't use the word "fail" since it implies a defect in the implementation.  How about:
> 
> // Ignore illegal panner values.
> 
> Or, even better yet, no comment at all since it's quite obvious from the code itself.  WebKit style is to try to avoid obvious comments.
> 
> One thing we could consider is throwing an exception here, so another option is:
> 
> // FIXME: consider throwing exception for illegal model value.

Added FIXME comment.  Will file a bug on this so we don't forget.

>> LayoutTests/webaudio/panner-set-model.html:62
>> +              testFailed("Panner set to invalid model, but the panningModel changed fomr 2 to " + panner.panningModel);
> 
> typo: "fomr" -> "from"

Fixed.
Comment 21 Chris Rogers 2012-01-27 13:06:27 PST
Looks good.
Comment 22 Kenneth Russell 2012-01-27 13:54:08 PST
Comment on attachment 124352 [details]
Patch

rs=me
Comment 23 WebKit Review Bot 2012-01-27 15:06:42 PST
Comment on attachment 124352 [details]
Patch

Rejecting attachment 124352 [details] from commit-queue.

Failed to run "['/mnt/git/webkit-commit-queue/Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '-..." exit_code: 2

Last 500 characters of output:
t/git/webkit-commit-queue/Source/WebKit/chromium/v8 --revision 10507 --non-interactive --force --accept theirs-conflict --ignore-externals' in '/mnt/git/webkit-commit-queue/Source/WebKit/chromium'
46>At revision 10507.

________ running '/usr/bin/python tools/clang/scripts/update.py --mac-only' in '/mnt/git/webkit-commit-queue/Source/WebKit/chromium'

________ running '/usr/bin/python gyp_webkit' in '/mnt/git/webkit-commit-queue/Source/WebKit/chromium'
Updating webkit projects from gyp files...

Full output: http://queues.webkit.org/results/11360166
Comment 24 Raymond Toy 2012-01-27 15:20:01 PST
Created attachment 124380 [details]
Patch
Comment 25 Raymond Toy 2012-01-27 15:21:29 PST
Update patch to current sources.  Only changed the changelogs.
Comment 26 Kenneth Russell 2012-01-27 15:41:35 PST
Comment on attachment 124380 [details]
Patch

r=me again
Comment 27 WebKit Review Bot 2012-01-27 19:11:58 PST
Comment on attachment 124380 [details]
Patch

Clearing flags on attachment: 124380

Committed r106174: <http://trac.webkit.org/changeset/106174>
Comment 28 WebKit Review Bot 2012-01-27 19:12:03 PST
All reviewed patches have been landed.  Closing bug.