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
-18
View File
@@ -151,15 +151,6 @@ export class AdtsDemuxer extends Demuxer {
return this.tracks;
}
async computeDuration() {
await this.readMetadata();
const track = this.tracks[0];
assert(track);
return track.computeDuration();
}
async getMetadataTags() {
const release = await this.readingMutex.acquire();
@@ -210,20 +201,11 @@ class AdtsAudioTrackBacking implements InputAudioTrackBacking {
return 1;
}
async getFirstTimestamp() {
return 0;
}
getTimeResolution() {
const sampleRate = this.getSampleRate();
return sampleRate / SAMPLES_PER_AAC_FRAME;
}
async computeDuration() {
const lastPacket = await this.getPacket(Infinity, { metadataOnly: true });
return (lastPacket?.timestamp ?? 0) + (lastPacket?.duration ?? 0);
}
getName() {
return null;
}