// THE STREAM COPY (lane browser-clip): a part of the visitor's own file, cut // in the browser with Mediabunny (MPL-2.0; export/THIRD-PARTY-NOTICES.md). // // Loaded ONLY through lib/localClipLoader.ts's dynamic import, when a clip is // asked for, so the site's first load does not carry the library. // // Why not Mediabunny's Conversion API: in 1.45.3 any trim start after a // track's first timestamp forces a re-encode (conversion.ts, needsTranscode / // needsResample). So the copy is done here with the packet API: // - the start is the verified key packet at or before the in mark (T0), and // every track is shifted by the same T0, so A/V keep their timing; // - video: every packet, in decode order, up to the last one presented // before the out mark (the frames it depends on come before it in decode // order), stopping at the first key packet past the mark or after a // bounded reorder window (HELD_PAST_OUT_MAX packets) past it; packets // presented before T0 (open-GOP leading pictures) are dropped; // - audio: from the packet at T0 to the out mark, nothing before T0; // - the two are fed to the muxer interleaved by timestamp, so it never holds // a whole track in memory. // The file is read by ranges (BlobSource: File.slice, an 8 MiB cache), never // whole. Times are the container's own, which is the