fix: AC9 seek fine re-sync + deterministic decoder drain (WebCodecs Opus)

Seek now trims the lead-in so playback lands at the requested time, not the page start; decoder drain polls decodeQueueSize (bounded) instead of a single timeout. Minor cleanups.
This commit is contained in:
daniel-c-harvey
2026-06-23 20:57:05 -04:00
parent 7f3fb74126
commit 5a75da1769
6 changed files with 186 additions and 42 deletions
@@ -50,8 +50,13 @@ export interface IStreamingDecoder {
* Reinitialize for a Range-continuation after seek-beyond-buffer. The 206 body begins on an Ogg page
* boundary and carries no setup pages — the decoder reuses the cached config and resets demux/codec
* state so inter-frame continuity restarts cleanly from the new offset.
*
* @param landingTimeSeconds The actual presentation time of the resolved seek page (t_page ≤ target).
* @param targetTimeSeconds The user-requested seek position. The decoder trims the leading
* `(target - landing) * sampleRate` frames so playback lands at target
* (AC9 fine re-sync, §3.4a step 4).
*/
reinitializeForRangeContinuation(): void;
reinitializeForRangeContinuation(landingTimeSeconds: number, targetTimeSeconds: number): void;
/** Tear down the underlying WebCodecs decoder and release resources. */
dispose(): void;