mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-10-03 05:43:50 +02:00
Merge branch 'main' into v2
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import { expect, test } from 'vitest';
|
||||
import { Input } from '../../src/input.js';
|
||||
import { UrlSource } from '../../src/source.js';
|
||||
import { ALL_FORMATS } from '../../src/input-format.js';
|
||||
import { AudioSampleCursor } from '../../src/cursors.js';
|
||||
import { assert } from '../../src/misc.js';
|
||||
|
||||
// VLC creates OGG files with an empty EOS page, which previously caused decoding errors
|
||||
test('can decode OGG Vorbis file with empty EOS page', async () => {
|
||||
using input = new Input({
|
||||
source: new UrlSource('/vorbis-eos.ogg'),
|
||||
formats: ALL_FORMATS,
|
||||
});
|
||||
|
||||
const track = await input.getPrimaryAudioTrack();
|
||||
assert(track);
|
||||
|
||||
await using cursor = new AudioSampleCursor(track);
|
||||
const buffers: AudioBuffer[] = [];
|
||||
|
||||
await cursor.seekTo(4);
|
||||
|
||||
for await (const sample of cursor) {
|
||||
if (sample.timestamp >= 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
buffers.push(sample.toAudioBuffer());
|
||||
}
|
||||
|
||||
expect(buffers.length).toBeGreaterThan(0);
|
||||
});
|
||||
Reference in New Issue
Block a user