Files
mediabunny/test/node/read-wav.test.ts
2876197631 Fix WaveDemuxer reading too far in corrupted ID3 chunk (#301)
* Update read-mp4.test.ts

* Fix the bug

* Delete read-wav.test.ts

* Submit test file

* Small adjustments

---------

Co-authored-by: Vanilagy <[email protected]>
2026-02-16 10:48:07 +00:00

25 lines
680 B
TypeScript

import { test } from 'vitest';
import path from 'node:path';
import { ALL_FORMATS, EncodedPacketSink, Input, FilePathSource } from '../../src/index.js';
const __dirname = new URL('.', import.meta.url).pathname;
test('Should handle WAV file with oversized ID3 chunk', async () => {
const filePath = path.join(__dirname, '..', 'public/oversized-id3.wav');
using input = new Input({
source: new FilePathSource(filePath),
formats: ALL_FORMATS,
});
const track = await input.getPrimaryAudioTrack();
if (!track) {
throw new Error('No audio track found');
}
const sink = new EncodedPacketSink(track);
for await (const packet of sink.packets()) {
void packet;
}
});