Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ee619ccd authored by Robert Wu's avatar Robert Wu
Browse files

AAudio: More sample rates in resampler tests

Resampler tests can be reenabled for higher sample rates.

Fix in Oboe is here: https://github.com/google/oboe/pull/1824

Bug: 285360027
Test: atest test_resampler
Change-Id: I219613277b748bc407be4c928dd77acab1335b24
parent ceffbfea
Loading
Loading
Loading
Loading
+10 −5
Original line number Original line Diff line number Diff line
@@ -101,14 +101,20 @@ static void checkResampler(int32_t sourceRate, int32_t sinkRate,
        }
        }
    }
    }


    // Flush out remaining frames from the flowgraph
    while (!mcResampler->isWriteNeeded()) {
        mcResampler->readNextFrame(output);
        output++;
        numRead++;
    }

    ASSERT_LE(numRead, kNumOutputSamples);
    ASSERT_LE(numRead, kNumOutputSamples);
    // Some frames are lost priming the FIR filter.
    // Some frames are lost priming the FIR filter.
    const int kMaxAlgorithmicFrameLoss = 16;
    const int kMaxAlgorithmicFrameLoss = 5;
    EXPECT_GT(numRead, kNumOutputSamples - kMaxAlgorithmicFrameLoss);
    EXPECT_GT(numRead, kNumOutputSamples - kMaxAlgorithmicFrameLoss);


    int sinkZeroCrossingCount = countZeroCrossingsWithHysteresis(outputBuffer.get(), numRead);
    int sinkZeroCrossingCount = countZeroCrossingsWithHysteresis(outputBuffer.get(), numRead);
    // Some cycles may get chopped off at the end.
    const int kMaxZeroCrossingDelta = std::max(sinkRate / sourceRate / 2, 1);
    const int kMaxZeroCrossingDelta = 3;
    EXPECT_LE(abs(sourceZeroCrossingCount - sinkZeroCrossingCount), kMaxZeroCrossingDelta);
    EXPECT_LE(abs(sourceZeroCrossingCount - sinkZeroCrossingCount), kMaxZeroCrossingDelta);


    // Detect glitches by looking for spikes in the second derivative.
    // Detect glitches by looking for spikes in the second derivative.
@@ -136,8 +142,7 @@ static void checkResampler(int32_t sourceRate, int32_t sinkRate,




TEST(test_resampler, resampler_scan_all) {
TEST(test_resampler, resampler_scan_all) {
    // TODO Add 64000, 88200, 96000 when they work. Failing now.
    const int rates[] = {8000, 11025, 22050, 32000, 44100, 48000, 64000, 88200, 96000};
    const int rates[] = {8000, 11025, 22050, 32000, 44100, 48000};
    const MultiChannelResampler::Quality qualities[] =
    const MultiChannelResampler::Quality qualities[] =
    {
    {
        MultiChannelResampler::Quality::Fastest,
        MultiChannelResampler::Quality::Fastest,