Slightly restructure code

This commit is contained in:
Vanilagy
2026-08-21 20:06:28 +02:00
parent fdfab4660f
commit 3c4f4c27a3
3 changed files with 14 additions and 6 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ node_modules
/dist /dist
/dist-docs /dist-docs
.DS_Store .DS_Store
.vitepress/cache docs/.vitepress/cache
/docs/api /docs/api
*.tsbuildinfo *.tsbuildinfo
+1 -1
View File
@@ -18,7 +18,7 @@
}); });
const track = await input.getPrimaryVideoTrack(); const track = await input.getPrimaryVideoTrack();
console.log(await track.computeFrameRateMetrics()); console.log(await track.getDecoderConfig());
/* /*
+12 -4
View File
@@ -1387,23 +1387,31 @@ export class IsobmffDemuxer extends Demuxer {
case 'avcC': { case 'avcC': {
const track = this.currentTrack; const track = this.currentTrack;
if (!track || boxInfo.contentSize === 0) { if (!track) {
// FFmpeg will sometimes generate an empty avcC chunk if provided no headers
break; break;
} }
assert(track.info); assert(track.info);
if (boxInfo.contentSize === 0) {
// avcC box is empty, let's treat this like an Annex B stream
break;
}
track.info.codecDescription = readBytes(slice, boxInfo.contentSize); track.info.codecDescription = readBytes(slice, boxInfo.contentSize);
}; break; }; break;
case 'hvcC': { case 'hvcC': {
const track = this.currentTrack; const track = this.currentTrack;
if (!track || boxInfo.contentSize === 0) { if (!track) {
// FFmpeg will sometimes generate an empty hvcC chunk if provided no headers
break; break;
} }
assert(track.info); assert(track.info);
if (boxInfo.contentSize === 0) {
// hvcC box is empty, let's treat this like an Annex B stream
break;
}
track.info.codecDescription = readBytes(slice, boxInfo.contentSize); track.info.codecDescription = readBytes(slice, boxInfo.contentSize);
}; break; }; break;