Title: [109532] trunk
Revision
109532
Author
[email protected]
Date
2012-03-02 01:32:05 -0800 (Fri, 02 Mar 2012)

Log Message

[Chromium] Layout Test webaudio/audiobuffersource-channels.html is failing
https://bugs.webkit.org/show_bug.cgi?id=79765

Patch by Wei James <[email protected]> on 2012-03-02
Reviewed by Chris Rogers.

Source/WebCore:

* webaudio/AudioBuffer.cpp:
(WebCore::AudioBuffer::create):
* webaudio/AudioBufferSourceNode.cpp:
(WebCore::AudioBufferSourceNode::setBuffer):
* webaudio/AudioContext.h:
(WebCore):
(AudioContext):
(WebCore::AudioContext::maxNumberOfChannels):
* webaudio/AudioNodeOutput.cpp:
(WebCore::AudioNodeOutput::AudioNodeOutput):
(WebCore::AudioNodeOutput::setNumberOfChannels):

LayoutTests:

* platform/chromium/test_expectations.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (109531 => 109532)


--- trunk/LayoutTests/ChangeLog	2012-03-02 09:30:00 UTC (rev 109531)
+++ trunk/LayoutTests/ChangeLog	2012-03-02 09:32:05 UTC (rev 109532)
@@ -1,3 +1,12 @@
+2012-03-02  Wei James  <[email protected]>
+
+        [Chromium] Layout Test webaudio/audiobuffersource-channels.html is failing
+        https://bugs.webkit.org/show_bug.cgi?id=79765
+
+        Reviewed by Chris Rogers.
+
+        * platform/chromium/test_expectations.txt:
+
 2012-03-02  Kentaro Hara  <[email protected]>
 
         Unreviewed, gardening.

Modified: trunk/LayoutTests/platform/chromium/test_expectations.txt (109531 => 109532)


--- trunk/LayoutTests/platform/chromium/test_expectations.txt	2012-03-02 09:30:00 UTC (rev 109531)
+++ trunk/LayoutTests/platform/chromium/test_expectations.txt	2012-03-02 09:32:05 UTC (rev 109532)
@@ -4315,8 +4315,6 @@
 BUGWK79702 : fast/regex/lastIndex.html = TEXT
 BUGWK79703 : fast/regex/overflow.html = TEXT
 
-BUGWK79765 DEBUG : webaudio/audiobuffersource-channels.html = CRASH
-
 BUGWK79823 : compositing/repaint/opacity-between-absolute.html = PASS IMAGE
 BUGWK79823 : compositing/reflections/masked-reflection-on-composited.html = PASS IMAGE
 // Already associated with bug 47949 on Mac.

Modified: trunk/Source/WebCore/ChangeLog (109531 => 109532)


--- trunk/Source/WebCore/ChangeLog	2012-03-02 09:30:00 UTC (rev 109531)
+++ trunk/Source/WebCore/ChangeLog	2012-03-02 09:32:05 UTC (rev 109532)
@@ -1,3 +1,22 @@
+2012-03-02  Wei James  <[email protected]>
+
+        [Chromium] Layout Test webaudio/audiobuffersource-channels.html is failing
+        https://bugs.webkit.org/show_bug.cgi?id=79765
+
+        Reviewed by Chris Rogers.
+
+        * webaudio/AudioBuffer.cpp:
+        (WebCore::AudioBuffer::create):
+        * webaudio/AudioBufferSourceNode.cpp:
+        (WebCore::AudioBufferSourceNode::setBuffer):
+        * webaudio/AudioContext.h:
+        (WebCore):
+        (AudioContext):
+        (WebCore::AudioContext::maxNumberOfChannels):
+        * webaudio/AudioNodeOutput.cpp:
+        (WebCore::AudioNodeOutput::AudioNodeOutput):
+        (WebCore::AudioNodeOutput::setNumberOfChannels):
+
 2012-03-02  Luke Macpherson   <[email protected]>
 
         Handle CSSPropertyWebkitRegionBreakAfter, CSSPropertyWebkitRegionBreakBefore and CSSPropertyWebkitRegionBreakInside in CSSStyleApplyProperty.

Modified: trunk/Source/WebCore/webaudio/AudioBuffer.cpp (109531 => 109532)


--- trunk/Source/WebCore/webaudio/AudioBuffer.cpp	2012-03-02 09:30:00 UTC (rev 109531)
+++ trunk/Source/WebCore/webaudio/AudioBuffer.cpp	2012-03-02 09:32:05 UTC (rev 109532)
@@ -33,6 +33,7 @@
 #include "AudioBuffer.h"
 
 #include "AudioBus.h"
+#include "AudioContext.h"
 #include "AudioFileReader.h"
 #include "ExceptionCode.h"
 #include <wtf/OwnPtr.h>
@@ -41,7 +42,7 @@
 
 PassRefPtr<AudioBuffer> AudioBuffer::create(unsigned numberOfChannels, size_t numberOfFrames, float sampleRate)
 {
-    if (sampleRate < 22050 || sampleRate > 96000 || numberOfChannels > 10 || !numberOfFrames)
+    if (sampleRate < 22050 || sampleRate > 96000 || numberOfChannels > AudioContext::maxNumberOfChannels() || !numberOfFrames)
         return 0;
     
     return adoptRef(new AudioBuffer(numberOfChannels, numberOfFrames, sampleRate));

Modified: trunk/Source/WebCore/webaudio/AudioBufferSourceNode.cpp (109531 => 109532)


--- trunk/Source/WebCore/webaudio/AudioBufferSourceNode.cpp	2012-03-02 09:30:00 UTC (rev 109531)
+++ trunk/Source/WebCore/webaudio/AudioBufferSourceNode.cpp	2012-03-02 09:32:05 UTC (rev 109532)
@@ -363,6 +363,10 @@
     if (buffer) {
         // Do any necesssary re-configuration to the buffer's number of channels.
         unsigned numberOfChannels = buffer->numberOfChannels();
+
+        if (numberOfChannels > AudioContext::maxNumberOfChannels())
+            return false;
+
         output(0)->setNumberOfChannels(numberOfChannels);
 
         m_sourceChannels = adoptArrayPtr(new const float* [numberOfChannels]);

Modified: trunk/Source/WebCore/webaudio/AudioContext.h (109531 => 109532)


--- trunk/Source/WebCore/webaudio/AudioContext.h	2012-03-02 09:30:00 UTC (rev 109531)
+++ trunk/Source/WebCore/webaudio/AudioContext.h	2012-03-02 09:32:05 UTC (rev 109532)
@@ -172,6 +172,9 @@
     // Returns true if this thread owns the context's lock.
     bool isGraphOwner() const;
 
+    // Returns the maximum numuber of channels we can support.
+    static unsigned maxNumberOfChannels() { return MaxNumberOfChannels;}
+
     class AutoLocker {
     public:
         AutoLocker(AudioContext* context)
@@ -303,6 +306,11 @@
     bool m_isOfflineContext;
 
     AsyncAudioDecoder m_audioDecoder;
+
+    // This is considering 32 is large enough for multiple channels audio. 
+    // It is somewhat arbitrary and could be increased if necessary.
+    enum { MaxNumberOfChannels = 32 };
+
 };
 
 } // WebCore

Modified: trunk/Source/WebCore/webaudio/AudioNodeOutput.cpp (109531 => 109532)


--- trunk/Source/WebCore/webaudio/AudioNodeOutput.cpp	2012-03-02 09:30:00 UTC (rev 109531)
+++ trunk/Source/WebCore/webaudio/AudioNodeOutput.cpp	2012-03-02 09:32:05 UTC (rev 109532)
@@ -35,10 +35,6 @@
 
 namespace WebCore {
 
-// This is considering that 5.1 (6 channels) is the largest we'll ever deal with.
-// It can easily be increased to support more if the web audio specification is updated.
-const unsigned MaxNumberOfChannels = 6;
-
 AudioNodeOutput::AudioNodeOutput(AudioNode* node, unsigned numberOfChannels)
     : m_node(node)
     , m_numberOfChannels(numberOfChannels)
@@ -47,7 +43,7 @@
     , m_isEnabled(true)
     , m_renderingFanOutCount(0)
 {
-    ASSERT(numberOfChannels <= MaxNumberOfChannels);
+    ASSERT(numberOfChannels <= AudioContext::maxNumberOfChannels());
 
     m_internalBus = adoptPtr(new AudioBus(numberOfChannels, AudioNode::ProcessingSizeInFrames));
     m_actualDestinationBus = m_internalBus.get();
@@ -55,7 +51,7 @@
 
 void AudioNodeOutput::setNumberOfChannels(unsigned numberOfChannels)
 {
-    ASSERT(numberOfChannels <= MaxNumberOfChannels);
+    ASSERT(numberOfChannels <= AudioContext::maxNumberOfChannels());
     ASSERT(context()->isGraphOwner());
 
     m_desiredNumberOfChannels = numberOfChannels;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to