mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-09-27 10:53:50 +02:00
Slightly adjust validated key packet retrieval logic
This commit is contained in:
+5
-6
@@ -201,9 +201,10 @@ export class EncodedPacketSink {
|
||||
}
|
||||
|
||||
const packet = await this._track._backing.getKeyPacket(timestamp, options);
|
||||
if (!packet || packet.type === 'delta') {
|
||||
if (!packet) {
|
||||
return packet;
|
||||
}
|
||||
assert(packet.type === 'key');
|
||||
|
||||
const determinedType = await this._track.determinePacketType(packet);
|
||||
if (determinedType === 'delta') {
|
||||
@@ -235,9 +236,10 @@ export class EncodedPacketSink {
|
||||
}
|
||||
|
||||
const nextPacket = await this._track._backing.getNextKeyPacket(packet, options);
|
||||
if (!nextPacket || nextPacket.type === 'delta') {
|
||||
if (!nextPacket) {
|
||||
return nextPacket;
|
||||
}
|
||||
assert(nextPacket.type === 'key');
|
||||
|
||||
const determinedType = await this._track.determinePacketType(nextPacket);
|
||||
if (determinedType === 'delta') {
|
||||
@@ -474,9 +476,6 @@ export abstract class BaseMediaSampleSink<
|
||||
const packetSink = this._createPacketSink();
|
||||
const keyPacket = await packetSink.getKeyPacket(startTimestamp, { verifyKeyPackets: true })
|
||||
?? await packetSink.getFirstPacket();
|
||||
if (!keyPacket) {
|
||||
return;
|
||||
}
|
||||
|
||||
let currentPacket: EncodedPacket | null = keyPacket;
|
||||
|
||||
@@ -498,7 +497,7 @@ export abstract class BaseMediaSampleSink<
|
||||
}
|
||||
}
|
||||
|
||||
const packets = packetSink.packets(keyPacket, endPacket);
|
||||
const packets = packetSink.packets(keyPacket ?? undefined, endPacket);
|
||||
await packets.next(); // Skip the start packet as we already have it
|
||||
|
||||
while (currentPacket && !ended && !this._track.input._disposed) {
|
||||
|
||||
Reference in New Issue
Block a user