Title: [117404] trunk
Revision
117404
Author
commit-qu...@webkit.org
Date
2012-05-16 23:53:07 -0700 (Wed, 16 May 2012)

Log Message

Unreviewed, rolling out r117372.
http://trac.webkit.org/changeset/117372
https://bugs.webkit.org/show_bug.cgi?id=86710

"triggerring crashes" (Requested by morrita on #webkit).

Patch by Sheriff Bot <webkit.review....@gmail.com> on 2012-05-16

Source/WebCore:

* Modules/webaudio/AudioParam.cpp:
(WebCore::AudioParam::calculateSampleAccurateValues):
(WebCore::AudioParam::calculateAudioRateSignalValues):
(WebCore::AudioParam::connect):
(WebCore::AudioParam::disconnect):
* Modules/webaudio/AudioParam.h:
(WebCore::AudioParam::context):
(WebCore::AudioParam::hasSampleAccurateValues):
(WebCore::AudioParam::AudioParam):
(AudioParam):

LayoutTests:

* webaudio/audioparam-connect-audioratesignal.html:
* webaudio/audioparam-summingjunction-expected.txt: Removed.
* webaudio/audioparam-summingjunction.html: Removed.

Modified Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (117403 => 117404)


--- trunk/LayoutTests/ChangeLog	2012-05-17 06:40:13 UTC (rev 117403)
+++ trunk/LayoutTests/ChangeLog	2012-05-17 06:53:07 UTC (rev 117404)
@@ -1,3 +1,15 @@
+2012-05-16  Sheriff Bot  <webkit.review....@gmail.com>
+
+        Unreviewed, rolling out r117372.
+        http://trac.webkit.org/changeset/117372
+        https://bugs.webkit.org/show_bug.cgi?id=86710
+
+        "triggerring crashes" (Requested by morrita on #webkit).
+
+        * webaudio/audioparam-connect-audioratesignal.html:
+        * webaudio/audioparam-summingjunction-expected.txt: Removed.
+        * webaudio/audioparam-summingjunction.html: Removed.
+
 2012-05-16  Zan Dobersek  <zandober...@gmail.com>
 
         Unreviewed GTK gardening after r117373.

Modified: trunk/LayoutTests/webaudio/audioparam-connect-audioratesignal.html (117403 => 117404)


--- trunk/LayoutTests/webaudio/audioparam-connect-audioratesignal.html	2012-05-17 06:40:13 UTC (rev 117403)
+++ trunk/LayoutTests/webaudio/audioparam-connect-audioratesignal.html	2012-05-17 06:53:07 UTC (rev 117404)
@@ -87,10 +87,6 @@
 
     // Create a gain node controlling the gain of constantSource and make the connections.
     var gainNode = context.createGainNode();
-
-    // Intrinsic baseline gain of zero.
-    gainNode.gain.value = 0;
-
     constantSource.connect(gainNode);
     gainNode.connect(context.destination);
 

Deleted: trunk/LayoutTests/webaudio/audioparam-summingjunction-expected.txt (117403 => 117404)


--- trunk/LayoutTests/webaudio/audioparam-summingjunction-expected.txt	2012-05-17 06:40:13 UTC (rev 117403)
+++ trunk/LayoutTests/webaudio/audioparam-summingjunction-expected.txt	2012-05-17 06:53:07 UTC (rev 117404)
@@ -1,6 +0,0 @@
-PASS Rendered signal is of correct length.
-PASS Rendered signal matches sum of two audio-rate gain changing signals plus baseline gain.
-PASS successfullyParsed is true
-
-TEST COMPLETE
-

Deleted: trunk/LayoutTests/webaudio/audioparam-summingjunction.html (117403 => 117404)


--- trunk/LayoutTests/webaudio/audioparam-summingjunction.html	2012-05-17 06:40:13 UTC (rev 117403)
+++ trunk/LayoutTests/webaudio/audioparam-summingjunction.html	2012-05-17 06:53:07 UTC (rev 117404)
@@ -1,132 +0,0 @@
-<!DOCTYPE html>
-
-<!--
-Tests that multiple audio-rate signals (AudioNode outputs) can be connected to an AudioParam
-and that these signals are summed, along with the AudioParams intrinsic value.
--->
-
-<html>
-<head>
-<link rel="stylesheet" href=""
-<script src=""
-<script src=""
-<script src=""
-
-</head>
-<body>
-
-<script>
-
-var sampleRate = 44100.0;
-var lengthInSeconds = 1;
-
-var context = 0;
-
-// Buffers used by the two gain controlling sources.
-var linearRampBuffer;
-var toneBuffer;
-var toneFrequency = 440;
-
-// Arbitrary non-zero value.
-var baselineGain = 5;
-
-// Allow for a small round-off error.
-var maxAllowedError = 1e-6;
-
-function checkResult(event) {
-    var renderedBuffer = event.renderedBuffer;
-    var renderedData = renderedBuffer.getChannelData(0);
-
-    // Get buffer data from the two sources used to control gain.
-    var linearRampData = linearRampBuffer.getChannelData(0);
-    var toneData = toneBuffer.getChannelData(0);
-
-    var n = renderedBuffer.length;
-
-    if (n == linearRampBuffer.length) {
-        testPassed("Rendered signal is of correct length.");
-    } else {
-        testFailed("Rendered signal is not of correct length.");
-    }
-
-    // Check that the rendered result exactly matches the sum of the intrinsic gain plus the two sources used to control gain.
-    // This is because we're changing the gain of a signal having constant value 1.
-    var success = true;
-    for (var i = 0; i < n; ++i) {
-        var expectedValue = baselineGain + linearRampData[i] + toneData[i];
-        var error = Math.abs(expectedValue - renderedData[i]);
-
-        if (error > maxAllowedError) {
-            success = false;
-            break;
-        }
-    }
-
-    if (success) {
-        testPassed("Rendered signal matches sum of two audio-rate gain changing signals plus baseline gain.");
-    } else {
-        testFailed("Rendered signal differs from the sum of two audio-rate gain changing signals plus baseline gain.");
-    }
-
-    finishJSTest();
-}
-
-function runTest() {
-    if (window.layoutTestController) {
-        layoutTestController.dumpAsText();
-        layoutTestController.waitUntilDone();
-    }
-
-    window.jsTestIsAsync = true;
-
-    var sampleFrameLength = sampleRate * lengthInSeconds;
-
-    // Create offline audio context.
-    context = new webkitAudioContext(1, sampleFrameLength, sampleRate);
-
-    // Create buffer used by the source which will have its gain controlled.
-    var constantOneBuffer = createConstantBuffer(context, sampleFrameLength, 1);
-    var constantSource = context.createBufferSource();
-    constantSource.buffer = constantOneBuffer;
-
-    // Create 1st buffer used to control gain (a linear ramp).
-    linearRampBuffer = createLinearRampBuffer(context, sampleFrameLength);
-    var gainSource1 = context.createBufferSource();
-    gainSource1.buffer = linearRampBuffer;
-
-    // Create 2nd buffer used to control gain (a simple sine wave tone).
-    toneBuffer = createToneBuffer(context, toneFrequency, lengthInSeconds, 1);
-    var gainSource2 = context.createBufferSource();
-    gainSource2.buffer = toneBuffer;
-
-    // Create a gain node controlling the gain of constantSource and make the connections.
-    var gainNode = context.createGainNode();
-
-    // Intrinsic baseline gain.
-    // This gain value should be summed with gainSource1 and gainSource2.
-    gainNode.gain.value = baselineGain;
-
-    constantSource.connect(gainNode);
-    gainNode.connect(context.destination);
-
-    // Connect two audio-rate signals to control the .gain AudioParam.
-    gainSource1.connect(gainNode.gain);
-    gainSource2.connect(gainNode.gain);
-
-    // Start all sources at time 0.
-    constantSource.noteOn(0);
-    gainSource1.noteOn(0);
-    gainSource2.noteOn(0);
-
-    context._oncomplete_ = checkResult;
-    context.startRendering();
-}
-
-runTest();
-successfullyParsed = true;
-
-</script>
-<script src=""
-
-</body>
-</html>

Modified: trunk/Source/WebCore/ChangeLog (117403 => 117404)


--- trunk/Source/WebCore/ChangeLog	2012-05-17 06:40:13 UTC (rev 117403)
+++ trunk/Source/WebCore/ChangeLog	2012-05-17 06:53:07 UTC (rev 117404)
@@ -1,3 +1,22 @@
+2012-05-16  Sheriff Bot  <webkit.review....@gmail.com>
+
+        Unreviewed, rolling out r117372.
+        http://trac.webkit.org/changeset/117372
+        https://bugs.webkit.org/show_bug.cgi?id=86710
+
+        "triggerring crashes" (Requested by morrita on #webkit).
+
+        * Modules/webaudio/AudioParam.cpp:
+        (WebCore::AudioParam::calculateSampleAccurateValues):
+        (WebCore::AudioParam::calculateAudioRateSignalValues):
+        (WebCore::AudioParam::connect):
+        (WebCore::AudioParam::disconnect):
+        * Modules/webaudio/AudioParam.h:
+        (WebCore::AudioParam::context):
+        (WebCore::AudioParam::hasSampleAccurateValues):
+        (WebCore::AudioParam::AudioParam):
+        (AudioParam):
+
 2012-05-16  Hayato Ito  <hay...@chromium.org>
 
         Implement a Shadow DOM spec's section 6 'Events'.

Modified: trunk/Source/WebCore/Modules/webaudio/AudioParam.cpp (117403 => 117404)


--- trunk/Source/WebCore/Modules/webaudio/AudioParam.cpp	2012-05-17 06:40:13 UTC (rev 117403)
+++ trunk/Source/WebCore/Modules/webaudio/AudioParam.cpp	2012-05-17 06:53:07 UTC (rev 117404)
@@ -101,7 +101,7 @@
     if (!isSafe)
         return;
 
-    if (numberOfRenderingConnections())
+    if (m_audioRateSignal)
         calculateAudioRateSignalValues(values, numberOfValues);
     else
         calculateTimelineValues(values, numberOfValues);
@@ -109,40 +109,26 @@
 
 void AudioParam::calculateAudioRateSignalValues(float* values, unsigned numberOfValues)
 {
-    bool isGood = numberOfRenderingConnections() && numberOfValues;
-    ASSERT(isGood);
-    if (!isGood)
+    // FIXME: support fan-in (multiple audio connections to this parameter with unity-gain summing).
+    // https://bugs.webkit.org/show_bug.cgi?id=83610
+    ASSERT(m_audioRateSignal);
+
+    AudioBus* bus = m_audioRateSignal->pull(0, numberOfValues);
+    bool isBusGood = bus && bus->numberOfChannels() && bus->length() >= numberOfValues;
+    ASSERT(isBusGood);
+    if (!isBusGood)
         return;
 
-    // The calculated result will be the "intrinsic" value summed with all audio-rate connections.
-
-    if (m_timeline.hasValues()) {
-        // Calculate regular timeline values, if we have any.
-        calculateTimelineValues(values, numberOfValues);
+    if (bus->numberOfChannels() == 1) {
+        // The normal case is to deal with a mono audio-rate signal.
+        memcpy(values, bus->channel(0)->data(), sizeof(float) * numberOfValues);
     } else {
-        // Otherwise set values array to our constant value.
-        float value = m_value; // Cache in local.
-
-        // FIXME: can be optimized if we create a new VectorMath function.
-        for (unsigned i = 0; i < numberOfValues; ++i)
-            values[i] = value;
+        // Do a standard mixdown to one channel if necessary.
+        AudioBus wrapperBus(1, numberOfValues, false);
+        wrapperBus.setChannelMemory(0, values, numberOfValues);
+        wrapperBus.copyFrom(*bus); // Mixdown.
     }
-
-    // Now sum all of the audio-rate connections together (unity-gain summing junction).
-    // Note that connections would normally be mono, but we mix down to mono if necessary.
-    AudioBus summingBus(1, numberOfValues, false);
-    summingBus.setChannelMemory(0, values, numberOfValues);
-
-    for (unsigned i = 0; i < numberOfRenderingConnections(); ++i) {
-        AudioNodeOutput* output = renderingOutput(i);
-        ASSERT(output);
-
-        // Render audio from this output.
-        AudioBus* connectionBus = output->pull(0, numberOfValues);
-
-        // Sum, with unity-gain.
-        summingBus.sumFrom(*connectionBus);
-    }
+    m_value = values[0]; // Update to first value.
 }
 
 void AudioParam::calculateTimelineValues(float* values, unsigned numberOfValues)
@@ -158,35 +144,33 @@
     m_value = m_timeline.valuesForTimeRange(startTime, endTime, narrowPrecisionToFloat(m_value), values, numberOfValues, sampleRate, sampleRate);
 }
 
-void AudioParam::connect(AudioNodeOutput* output)
+void AudioParam::connect(AudioNodeOutput* audioRateSignal)
 {
     ASSERT(context()->isGraphOwner());
-
-    ASSERT(output);
-    if (!output)
+    ASSERT(audioRateSignal);
+    if (!audioRateSignal)
         return;
 
-    if (m_outputs.contains(output))
-        return;
+    if (m_audioRateSignal && m_audioRateSignal != audioRateSignal) {
+        // Because we don't currently support fan-in we must explicitly disconnect from an old output.
+        m_audioRateSignal->removeParam(this);
+    }
 
-    output->addParam(this);
-    m_outputs.add(output);
-    changedOutputs();
+    audioRateSignal->addParam(this);
+    m_audioRateSignal = audioRateSignal;
 }
 
-void AudioParam::disconnect(AudioNodeOutput* output)
+void AudioParam::disconnect(AudioNodeOutput* audioRateSignal)
 {
     ASSERT(context()->isGraphOwner());
-
-    ASSERT(output);
-    if (!output)
+    ASSERT(audioRateSignal);
+    if (!audioRateSignal)
         return;
 
-    if (m_outputs.contains(output)) {
-        m_outputs.remove(output);
-        changedOutputs();
-        output->removeParam(this);
-    }
+    // FIXME: support fan-in (multiple audio connections to this parameter with unity-gain summing).
+    // https://bugs.webkit.org/show_bug.cgi?id=83610
+    if (m_audioRateSignal == audioRateSignal)
+        m_audioRateSignal = 0;
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/Modules/webaudio/AudioParam.h (117403 => 117404)


--- trunk/Source/WebCore/Modules/webaudio/AudioParam.h	2012-05-17 06:40:13 UTC (rev 117403)
+++ trunk/Source/WebCore/Modules/webaudio/AudioParam.h	2012-05-17 06:53:07 UTC (rev 117404)
@@ -31,7 +31,6 @@
 
 #include "AudioContext.h"
 #include "AudioParamTimeline.h"
-#include "AudioSummingJunction.h"
 #include "PlatformString.h"
 #include <sys/types.h>
 #include <wtf/Float32Array.h>
@@ -42,7 +41,7 @@
 
 class AudioNodeOutput;
 
-class AudioParam : public AudioSummingJunction, public RefCounted<AudioParam> {
+class AudioParam : public RefCounted<AudioParam> {
 public:
     static const double DefaultSmoothingConstant;
     static const double SnapThreshold;
@@ -52,9 +51,7 @@
         return adoptRef(new AudioParam(context, name, defaultValue, minValue, maxValue, units));
     }
 
-    // AudioSummingJunction
-    virtual bool canUpdateState() OVERRIDE { return true; }
-    virtual void didUpdate() OVERRIDE { }
+    AudioContext* context() { return m_context.get(); }
 
     float value();
     void setValue(float);
@@ -87,7 +84,7 @@
     void setValueCurveAtTime(Float32Array* curve, float time, float duration) { m_timeline.setValueCurveAtTime(curve, time, duration); }
     void cancelScheduledValues(float startTime) { m_timeline.cancelScheduledValues(startTime); }
 
-    bool hasSampleAccurateValues() { return m_timeline.hasValues() || numberOfRenderingConnections(); }
+    bool hasSampleAccurateValues() { return m_timeline.hasValues() || m_audioRateSignal; }
     
     // Calculates numberOfValues parameter values starting at the context's current time.
     // Must be called in the context's render thread.
@@ -99,7 +96,7 @@
 
 protected:
     AudioParam(AudioContext* context, const String& name, double defaultValue, double minValue, double maxValue, unsigned units = 0)
-        : AudioSummingJunction(context)
+        : m_context(context)
         , m_name(name)
         , m_value(defaultValue)
         , m_defaultValue(defaultValue)
@@ -108,6 +105,7 @@
         , m_units(units)
         , m_smoothedValue(defaultValue)
         , m_smoothingConstant(DefaultSmoothingConstant)
+        , m_audioRateSignal(0)
     {
     }
 
@@ -115,6 +113,7 @@
     void calculateAudioRateSignalValues(float* values, unsigned numberOfValues);
     void calculateTimelineValues(float* values, unsigned numberOfValues);
 
+    RefPtr<AudioContext> m_context;
     String m_name;
     double m_value;
     double m_defaultValue;
@@ -127,6 +126,11 @@
     double m_smoothingConstant;
     
     AudioParamTimeline m_timeline;
+
+    // An audio-rate signal directly providing parameter values.
+    // FIXME: support fan-in (multiple audio connections to this parameter with unity-gain summing).
+    // https://bugs.webkit.org/show_bug.cgi?id=83610
+    AudioNodeOutput* m_audioRateSignal;
 };
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to