Replace broken per-segment Opus decode with WebCodecs AudioDecoder streaming pipeline

This commit is contained in:
daniel-c-harvey
2026-06-23 17:42:06 -04:00
parent d0118997b6
commit 7f3fb74126
13 changed files with 1270 additions and 649 deletions
@@ -1,5 +1,3 @@
import { OpusSeekData } from './OpusSidecar.js';
/**
* FormatInfo: parsed header data needed to stream and seek an audio file.
* Populated by IFormatDecoder.tryParseHeader; used by StreamDecoder throughout playback.
@@ -38,10 +36,10 @@ export interface FormatInfo {
* MP3 VBR: Xing/VBRI TOC (100-entry Uint8Array, values are file-percentage * 255).
* FLAC: SeekTable (array of {sampleNumber: number, streamOffset: number} — stream_offset
* is bytes from the start of audio frames, i.e. after all metadata blocks).
* Opus: OpusSeekData — the precomputed granule->byte index + OpusHead/OpusTags setup bytes,
* parsed from the sidecar artifact (NOT byteRate math; see OpusFormatDecoder).
* Opus does NOT flow through this seam — it uses the WebCodecs IStreamingDecoder path and resolves
* seek offsets via OpusSidecar.resolveOpusByteOffset, not FormatInfo.seekData.
*/
seekData?: Mp3VbrSeekData | FlacSeekData | OpusSeekData | null;
seekData?: Mp3VbrSeekData | FlacSeekData | null;
}
export interface Mp3VbrSeekData {