Add support for unsized sources, add ReadableStreamSource, fix WAVE packet lookup

This commit is contained in:
Vanilagy
2025-09-02 16:39:38 +02:00
parent 4b3fb34a95
commit ef95960e13
14 changed files with 792 additions and 172 deletions
+5 -2
View File
@@ -47,7 +47,7 @@ export class Mp3Demuxer extends Demuxer {
async readMetadata() {
return this.metadataPromise ??= (async () => {
// Keep loading until we find the first frame header
while (!this.firstFrameHeader && this.lastLoadedPos < this.reader.fileSize) {
while (!this.firstFrameHeader && !this.lastSampleLoaded) {
await this.advanceReader();
}
@@ -211,7 +211,10 @@ class Mp3AudioTrackBacking implements InputAudioTrackBacking {
} else {
let slice = this.demuxer.reader.requestSlice(rawSample.dataStart, rawSample.dataSize);
if (slice instanceof Promise) slice = await slice;
assert(slice);
if (!slice) {
return null; // Data didn't fit into the rest of the file
}
data = readBytes(slice, rawSample.dataSize);
}