From 3c4f4c27a37984054c8a71b7ce3bd2c0ed6508ad Mon Sep 17 00:00:00 2001 From: Vanilagy <1696106+Vanilagy@users.noreply.github.com> Date: Fri, 21 Aug 2026 20:06:28 +0200 Subject: [PATCH] Slightly restructure code --- .gitignore | 2 +- dev/demux.html | 2 +- src/isobmff/isobmff-demuxer.ts | 16 ++++++++++++---- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 211662d..1043866 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,7 @@ node_modules /dist /dist-docs .DS_Store -.vitepress/cache +docs/.vitepress/cache /docs/api *.tsbuildinfo diff --git a/dev/demux.html b/dev/demux.html index 3afb290..5354400 100644 --- a/dev/demux.html +++ b/dev/demux.html @@ -18,7 +18,7 @@ }); const track = await input.getPrimaryVideoTrack(); - console.log(await track.computeFrameRateMetrics()); + console.log(await track.getDecoderConfig()); /* diff --git a/src/isobmff/isobmff-demuxer.ts b/src/isobmff/isobmff-demuxer.ts index 866d6b3..814dc8e 100644 --- a/src/isobmff/isobmff-demuxer.ts +++ b/src/isobmff/isobmff-demuxer.ts @@ -1387,23 +1387,31 @@ export class IsobmffDemuxer extends Demuxer { case 'avcC': { const track = this.currentTrack; - if (!track || boxInfo.contentSize === 0) { - // FFmpeg will sometimes generate an empty avcC chunk if provided no headers + if (!track) { break; } 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); }; break; case 'hvcC': { const track = this.currentTrack; - if (!track || boxInfo.contentSize === 0) { - // FFmpeg will sometimes generate an empty hvcC chunk if provided no headers + if (!track) { break; } 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); }; break;