fix(subtitle-prefetch): reuse startup runs and prefetch overlap lines

- Warm combined text for overlapping subtitle cues.
- Preserve valid in-flight tokenization across startup restarts while rejecting invalidated cache results.
This commit is contained in:
sudacode committed 2026-09-28 01:17:59 -07:00
1 parent 4648c5e5a1
commit a4325740b7
9 files changed
+274 -6

No files matched your search

@@ -43,6 +43,8 @@ export interface SubtitleProcessingController {
*/
notePlainSubtitleEmitted: (text: string) => void;
invalidateTokenizationCache: () => void;
/** Incremented by invalidateTokenizationCache; lets async writers detect stale results. */
getCacheGeneration: () => number;
preCacheTokenization: (text: string, data: SubtitleData) => void;
consumeCachedSubtitle: (text: string) => SubtitleData | null;
hasCachedSubtitle: (text: string) => boolean;
@@ -253,6 +255,7 @@ export function createSubtitleProcessingController(
tokenizationCache.clear();
cacheGeneration += 1;
},
getCacheGeneration: () => cacheGeneration,
preCacheTokenization: (text: string, data: SubtitleData) => {
setCachedTokenization(text, data);
},