mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-09-27 19:03:46 +02:00
Fix tests some more
This commit is contained in:
@@ -88,6 +88,7 @@ const encodeAndDecodeFirstSample = async (audioSample: AudioSample) => {
|
||||
|
||||
await output.start();
|
||||
await audioSource.add(audioSample);
|
||||
audioSample.close();
|
||||
audioSource.close();
|
||||
await output.finalize();
|
||||
|
||||
|
||||
@@ -51,13 +51,15 @@ test('AAC encoding', async () => {
|
||||
output.addAudioTrack(audioSource);
|
||||
|
||||
await output.start();
|
||||
await audioSource.add(new AudioSample({
|
||||
const sample = new AudioSample({
|
||||
data,
|
||||
format: 'f32',
|
||||
numberOfChannels: channels,
|
||||
sampleRate,
|
||||
timestamp: 0,
|
||||
}));
|
||||
});
|
||||
await audioSource.add(sample);
|
||||
sample.close();
|
||||
audioSource.close();
|
||||
await output.finalize();
|
||||
|
||||
@@ -100,13 +102,15 @@ test('AAC with huge timestamps', async () => {
|
||||
output.addAudioTrack(audioSource);
|
||||
|
||||
await output.start();
|
||||
await audioSource.add(new AudioSample({
|
||||
const sample = new AudioSample({
|
||||
data,
|
||||
format: 'f32',
|
||||
numberOfChannels: channels,
|
||||
sampleRate,
|
||||
timestamp,
|
||||
}));
|
||||
});
|
||||
await audioSource.add(sample);
|
||||
sample.close();
|
||||
audioSource.close();
|
||||
await output.finalize();
|
||||
|
||||
|
||||
+16
-8
@@ -252,13 +252,15 @@ test('AC-3 encoding', async () => {
|
||||
output.addAudioTrack(audioSource);
|
||||
|
||||
await output.start();
|
||||
await audioSource.add(new AudioSample({
|
||||
const sample = new AudioSample({
|
||||
data,
|
||||
format: 'f32',
|
||||
numberOfChannels: channels,
|
||||
sampleRate,
|
||||
timestamp: 0,
|
||||
}));
|
||||
});
|
||||
await audioSource.add(sample);
|
||||
sample.close();
|
||||
audioSource.close();
|
||||
await output.finalize();
|
||||
|
||||
@@ -300,13 +302,15 @@ test('E-AC-3 encoding', async () => {
|
||||
output.addAudioTrack(audioSource);
|
||||
|
||||
await output.start();
|
||||
await audioSource.add(new AudioSample({
|
||||
const sample = new AudioSample({
|
||||
data,
|
||||
format: 'f32',
|
||||
numberOfChannels: channels,
|
||||
sampleRate,
|
||||
timestamp: 0,
|
||||
}));
|
||||
});
|
||||
await audioSource.add(sample);
|
||||
sample.close();
|
||||
audioSource.close();
|
||||
await output.finalize();
|
||||
|
||||
@@ -350,13 +354,15 @@ test('AC-3 with huge timestamps', async () => {
|
||||
output.addAudioTrack(audioSource);
|
||||
|
||||
await output.start();
|
||||
await audioSource.add(new AudioSample({
|
||||
const sample = new AudioSample({
|
||||
data,
|
||||
format: 'f32',
|
||||
numberOfChannels: channels,
|
||||
sampleRate,
|
||||
timestamp,
|
||||
}));
|
||||
});
|
||||
await audioSource.add(sample);
|
||||
sample.close();
|
||||
audioSource.close();
|
||||
await output.finalize();
|
||||
|
||||
@@ -399,13 +405,15 @@ test('E-AC-3 with huge timestamps', async () => {
|
||||
output.addAudioTrack(audioSource);
|
||||
|
||||
await output.start();
|
||||
await audioSource.add(new AudioSample({
|
||||
const sample = new AudioSample({
|
||||
data,
|
||||
format: 'f32',
|
||||
numberOfChannels: channels,
|
||||
sampleRate,
|
||||
timestamp,
|
||||
}));
|
||||
});
|
||||
await audioSource.add(sample);
|
||||
sample.close();
|
||||
audioSource.close();
|
||||
await output.finalize();
|
||||
|
||||
|
||||
@@ -51,13 +51,15 @@ test('FLAC encoding', async () => {
|
||||
output.addAudioTrack(audioSource);
|
||||
|
||||
await output.start();
|
||||
await audioSource.add(new AudioSample({
|
||||
const sample = new AudioSample({
|
||||
data,
|
||||
format: 'f32',
|
||||
numberOfChannels: channels,
|
||||
sampleRate,
|
||||
timestamp: 0,
|
||||
}));
|
||||
});
|
||||
await audioSource.add(sample);
|
||||
sample.close();
|
||||
audioSource.close();
|
||||
await output.finalize();
|
||||
|
||||
@@ -101,13 +103,15 @@ test('FLAC with huge timestamps', async () => {
|
||||
output.addAudioTrack(audioSource);
|
||||
|
||||
await output.start();
|
||||
await audioSource.add(new AudioSample({
|
||||
const sample = new AudioSample({
|
||||
data,
|
||||
format: 'f32',
|
||||
numberOfChannels: channels,
|
||||
sampleRate,
|
||||
timestamp,
|
||||
}));
|
||||
});
|
||||
await audioSource.add(sample);
|
||||
sample.close();
|
||||
audioSource.close();
|
||||
await output.finalize();
|
||||
|
||||
|
||||
@@ -51,13 +51,15 @@ test('MP3 encoding', async () => {
|
||||
output.addAudioTrack(audioSource);
|
||||
|
||||
await output.start();
|
||||
await audioSource.add(new AudioSample({
|
||||
const sample = new AudioSample({
|
||||
data,
|
||||
format: 'f32',
|
||||
numberOfChannels: channels,
|
||||
sampleRate,
|
||||
timestamp: 0,
|
||||
}));
|
||||
});
|
||||
await audioSource.add(sample);
|
||||
sample.close();
|
||||
audioSource.close();
|
||||
await output.finalize();
|
||||
|
||||
@@ -101,13 +103,15 @@ test('MP3 with huge timestamps', async () => {
|
||||
output.addAudioTrack(audioSource);
|
||||
|
||||
await output.start();
|
||||
await audioSource.add(new AudioSample({
|
||||
const sample = new AudioSample({
|
||||
data,
|
||||
format: 'f32',
|
||||
numberOfChannels: channels,
|
||||
sampleRate,
|
||||
timestamp,
|
||||
}));
|
||||
});
|
||||
await audioSource.add(sample);
|
||||
sample.close();
|
||||
audioSource.close();
|
||||
await output.finalize();
|
||||
|
||||
|
||||
@@ -626,6 +626,10 @@ describe('Video', async () => {
|
||||
const packetSink = new EncodedPacketSink(inputTrack);
|
||||
|
||||
for await (const packet of packetSink.packets()) {
|
||||
if (duration !== undefined && packet.timestamp >= duration) {
|
||||
break;
|
||||
}
|
||||
|
||||
packetTimestamps.push(packet.timestamp);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user