Migrate fragmented MP4 reading to new packet system, add tests for it, add packet internal data, and various other fixes prob

This commit is contained in:
Vanilagy
2025-12-21 19:11:46 +01:00
parent 00efb69a7d
commit 6722592e27
10 changed files with 327 additions and 267 deletions
+5 -8
View File
@@ -64,8 +64,7 @@ test('Packet cursor seeking', async () => {
});
const videoTrack = (await input.getPrimaryVideoTrack())!;
const reader = new PacketReader(videoTrack);
const cursor = new PacketCursor(reader);
const cursor = new PacketCursor(videoTrack);
expect(cursor.current).toBe(null);
@@ -102,8 +101,7 @@ test('Packet cursor iteration', async () => {
});
const videoTrack = (await input.getPrimaryVideoTrack())!;
const reader = new PacketReader(videoTrack);
const cursor = new PacketCursor(reader);
const cursor = new PacketCursor(videoTrack);
const packet0 = (await cursor.seekToFirst())!;
expect(cursor.current!.timestamp).toBe(0);
@@ -211,7 +209,7 @@ test('Packet cursor iteration', async () => {
expect(total).toBe(121);
const cursor2 = new PacketCursor(reader);
const cursor2 = new PacketCursor(videoTrack);
const packet9 = (await cursor2.next())!; // Without any prior seeks
expect(packet9.sequenceNumber).toBe(packet0.sequenceNumber);
});
@@ -224,7 +222,7 @@ test('Synchronous packet reading', async () => {
const videoTrack = (await input.getPrimaryVideoTrack())!;
const reader = new PacketReader(videoTrack);
const cursor = new PacketCursor(reader);
const cursor = new PacketCursor(videoTrack);
expect(reader.readFirst()).not.toBeInstanceOf(Promise);
@@ -249,8 +247,7 @@ test('Command queuing', async () => {
});
const videoTrack = (await input.getPrimaryVideoTrack())!;
const reader = new PacketReader(videoTrack);
const cursor = new PacketCursor(reader);
const cursor = new PacketCursor(videoTrack);
expect(cursor.waitUntilIdle()).toBe(null);