Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 9b76654

Browse files
authored
Merge pull request #5957 from matrix-org/travis/voicemessages/resample
Don't recurse on arrayFastResample
2 parents 2ddc07e + 5dbe882 commit 9b76654

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/utils/arrays.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,12 @@ export function arrayFastResample(input: number[], points: number): number[] {
3636
}
3737
} else {
3838
// Smaller inputs mean we have to spread the values over the desired length. We
39-
// end up overshooting the target length in doing this, so we'll resample down
40-
// before returning. This recursion is risky, but mathematically should not go
41-
// further than 1 level deep.
39+
// end up overshooting the target length in doing this, but we're not looking to
40+
// be super accurate so we'll let the sanity trims do their job.
4241
const spreadFactor = Math.ceil(points / input.length);
4342
for (const val of input) {
4443
samples.push(...arraySeed(val, spreadFactor));
4544
}
46-
samples = arrayFastResample(samples, points);
4745
}
4846

4947
// Sanity fill, just in case

0 commit comments

Comments
 (0)