Make computeDuration and getFirstTimestamp have the same implementations across the board

This commit is contained in:
Vanilagy
2026-01-27 16:49:25 +01:00
parent 2ffa692fdd
commit 6004912f3d
13 changed files with 13 additions and 171 deletions
-16
View File
@@ -485,12 +485,6 @@ export class MpegTsDemuxer extends Demuxer {
return {}; // Nothing for now
}
async computeDuration() {
const tracks = await this.getTracks();
const trackDurations = await Promise.all(tracks.map(x => x.computeDuration()));
return Math.max(0, ...trackDurations);
}
async getMimeType(): Promise<string> {
await this.readMetadata();
@@ -846,16 +840,6 @@ export abstract class MpegTsTrackBacking implements InputTrackBacking {
return null;
}
async computeDuration(): Promise<number> {
const lastPacket = await this.getPacket(Infinity, { metadataOnly: true });
return (lastPacket?.timestamp ?? 0) + (lastPacket?.duration ?? 0);
}
async getFirstTimestamp(): Promise<number> {
const firstPacket = await this.getFirstPacket({ metadataOnly: true });
return firstPacket?.timestamp ?? 0;
}
abstract allPacketsAreKeyPackets(): boolean;
abstract getReorderSize(): number;