Changeset 267060 in webkit


Ignore:
Timestamp:
Sep 14, 2020 5:41:47 PM (4 years ago)
Author:
Chris Dumez
Message:

Drop smoothing logic from DelayDSPKernel::process()
https://bugs.webkit.org/show_bug.cgi?id=216504

Reviewed by Eric Carlson.

LayoutTests/imported/w3c:

Rebaseline WPT tests that are now passing or whose output has slightly changed.

  • web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-delay-connections-expected.txt:
  • web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-delay-expected.txt:

Source/WebCore:

Drop smoothing logic from DelayDSPKernel::process(). This is not as per specification and does not
match the behavior of Chromium. This is causing us to fail a WPT test.

No new tests, rebaselined existing test.

  • Modules/webaudio/DelayDSPKernel.cpp:

(WebCore::DelayDSPKernel::DelayDSPKernel):
(WebCore::DelayDSPKernel::process):
(WebCore::DelayDSPKernel::reset):

  • Modules/webaudio/DelayDSPKernel.h:
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r267036 r267060  
     12020-09-14  Chris Dumez  <cdumez@apple.com>
     2
     3        Drop smoothing logic from DelayDSPKernel::process()
     4        https://bugs.webkit.org/show_bug.cgi?id=216504
     5
     6        Reviewed by Eric Carlson.
     7
     8        Rebaseline WPT tests that are now passing or whose output has slightly changed.
     9
     10        * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-delay-connections-expected.txt:
     11        * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-delay-expected.txt:
     12
    1132020-09-14  Chris Dumez  <cdumez@apple.com>
    214
  • trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-delay-connections-expected.txt

    r266754 r267060  
    1414PASS   testMod.offset.linearRampToValueAtTime(1.125, 1) did not throw an exception.
    1515PASS   testMod.connect(testNode.delayTime) did not throw an exception.
    16 PASS   Expected k-rate delayTime AudioParam with input is not constantly 0 (contains 6159 different values).
    17 PASS   Actual k-rate delayTime AudioParam with input is not constantly 0 (contains 6159 different values).
    18 FAIL X output[128, 143]: Expected 0 for all values but found 16 unexpected values:
    19         Index   Actual
    20         [0]     -0.8773074150085449
    21         [1]     -0.8522303104400635
    22         [2]     -0.826123833656311
    23         [3]     -0.7989943027496338
    24         ...and 12 more errors. assert_true: expected true got false
    25 PASS   output[144, 255] is not constantly 0 (contains 112 different values).
     16PASS   Expected k-rate delayTime AudioParam with input is not constantly 0 (contains 4656 different values).
     17PASS   Actual k-rate delayTime AudioParam with input is not constantly 0 (contains 4656 different values).
     18PASS   output[128, 143] contains only the constant 0.
     19PASS   output[144, 255] is not constantly 0 (contains 111 different values).
    2620PASS   k-rate delayTime AudioParam with input equals [0,0.3311063051223755,0.6248595118522644,0.8481203317642212,0.9757022261619568,0.9932120442390442,0.898674488067627,0.7027547955513,0.4275550842285156,0.10412158071994781,-0.23105812072753906,-0.5401715040206909,-0.7883464097976685,-0.9475855827331543,-0.9999247193336487,-0.9394593238830566...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}.
    27 FAIL < [delayTime] 1 out of 15 assertions were failed. assert_true: expected true got false
    28 FAIL # AUDIT TASK RUNNER FINISHED: 1 out of 1 tasks were failed. assert_true: expected true got false
     21PASS < [delayTime] All assertions passed. (total 15 assertions)
     22PASS # AUDIT TASK RUNNER FINISHED: 1 tasks ran successfully.
    2923
  • trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-delay-expected.txt

    r266754 r267060  
    1111PASS   DelayNode: Output of k-rate DelayNode is identical to the array [0,0.3387378752231598,0.6374238133430481,0.860741913318634,0.9822871088981628,0.9876880049705505,0.8763063549995422,0.6613117456436157,0.3681243062019348,0.03141050040721893,-0.3090170621871948,-0.6129071116447449,-0.8443278670310974,-0.9759165644645691,-0.9921145439147949,-0.8910062313079834...].
    1212PASS   DelayNode: Output of a-rate DelayNode is identical to the array [0,0.1693689227104187,0.3387378454208374,0.48808082938194275,0.6374238133430481,0.7490828633308411,0.860741913318634,0.9215145111083984,0.9822871088981628,0.9849875569343567,0.9876880049705505,0.9319971799850464,0.8763063549995422,0.7688090801239014,0.6613118052482605,0.5147179961204529...].
    13 PASS   DelayNode: Difference between a-rate and k-rate DelayNode is not constantly 0 (contains 7999 different values).
     13PASS   DelayNode: Difference between a-rate and k-rate DelayNode is not constantly 0 (contains 7937 different values).
    1414PASS < [Test k-rate DelayNode] All assertions passed. (total 8 assertions)
    1515PASS # AUDIT TASK RUNNER FINISHED: 1 tasks ran successfully.
  • trunk/Source/WebCore/ChangeLog

    r267059 r267060  
     12020-09-14  Chris Dumez  <cdumez@apple.com>
     2
     3        Drop smoothing logic from DelayDSPKernel::process()
     4        https://bugs.webkit.org/show_bug.cgi?id=216504
     5
     6        Reviewed by Eric Carlson.
     7
     8        Drop smoothing logic from DelayDSPKernel::process(). This is not as per specification and does not
     9        match the behavior of Chromium. This is causing us to fail a WPT test.
     10
     11        No new tests, rebaselined existing test.
     12
     13        * Modules/webaudio/DelayDSPKernel.cpp:
     14        (WebCore::DelayDSPKernel::DelayDSPKernel):
     15        (WebCore::DelayDSPKernel::process):
     16        (WebCore::DelayDSPKernel::reset):
     17        * Modules/webaudio/DelayDSPKernel.h:
     18
    1192020-09-14  Zalan Bujtas  <zalan@apple.com>
    220
  • trunk/Source/WebCore/Modules/webaudio/DelayDSPKernel.cpp

    r266491 r267060  
    3434namespace WebCore {
    3535
    36 const float SmoothingTimeConstant = 0.020f; // 20ms
    37 
    3836DelayDSPKernel::DelayDSPKernel(DelayProcessor* processor)
    3937    : AudioDSPKernel(processor)
    40     , m_writeIndex(0)
    41     , m_firstTime(true)
    4238    , m_delayTimes(AudioNode::ProcessingSizeInFrames)
    4339{
     
    5349    m_buffer.allocate(bufferLengthForDelay(m_maxDelayTime, processor->sampleRate()));
    5450    m_buffer.zero();
    55 
    56     m_smoothingRate = AudioUtilities::discreteTimeConstantForSampleRate(SmoothingTimeConstant, processor->sampleRate());
    5751}
    5852
     
    6054    : AudioDSPKernel(sampleRate)
    6155    , m_maxDelayTime(maxDelayTime)
    62     , m_writeIndex(0)
    63     , m_firstTime(true)
    6456{
    6557    ASSERT(maxDelayTime > 0.0);
     
    7466    m_buffer.allocate(bufferLength);
    7567    m_buffer.zero();
    76 
    77     m_smoothingRate = AudioUtilities::discreteTimeConstantForSampleRate(SmoothingTimeConstant, sampleRate);
    7868}
    7969
     
    110100    else {
    111101        delayTime = delayProcessor() ? delayProcessor()->delayTime().finalValue() : m_desiredDelayFrames / sampleRate;
    112 
    113102        // Make sure the delay time is in a valid range.
    114         delayTime = std::min(maxTime, delayTime);
    115         delayTime = std::max(0.0, delayTime);
    116 
    117         if (m_firstTime) {
    118             m_currentDelayTime = delayTime;
    119             m_firstTime = false;
    120         }
     103        delayTime = std::clamp(delayTime, 0.0, maxTime);
    121104    }
    122105
     
    124107        if (sampleAccurate && shouldUseARate) {
    125108            delayTime = delayTimes[i];
    126             delayTime = std::min(maxTime, delayTime);
    127             delayTime = std::max(0.0, delayTime);
    128             m_currentDelayTime = delayTime;
    129         } else {
    130             // Approach desired delay time.
    131             m_currentDelayTime += (delayTime - m_currentDelayTime) * m_smoothingRate;
     109            delayTime = std::clamp(delayTime, 0.0, maxTime);
    132110        }
    133111
    134         double desiredDelayFrames = m_currentDelayTime * sampleRate;
     112        double desiredDelayFrames = delayTime * sampleRate;
    135113
    136114        double readPosition = m_writeIndex + bufferLength - desiredDelayFrames;
     
    158136void DelayDSPKernel::reset()
    159137{
    160     m_firstTime = true;
    161138    m_buffer.zero();
    162139}
  • trunk/Source/WebCore/Modules/webaudio/DelayDSPKernel.h

    r266417 r267060  
    5252    AudioFloatArray m_buffer;
    5353    double m_maxDelayTime;
    54     int m_writeIndex;
    55     double m_currentDelayTime;
    56     double m_smoothingRate;
    57     bool m_firstTime;
     54    int m_writeIndex { 0 };
    5855    double m_desiredDelayFrames;
    5956
Note: See TracChangeset for help on using the changeset viewer.