@@ -11,6 +11,7 @@ const extractionCalls = vi.hoisted(
1111 ( ) => new Array < { timelineEnd : number | undefined ; durationSeconds : number } > ( ) ,
1212) ;
1313const toneMapHdrToSdrCalls = vi . hoisted ( ( ) => new Array < boolean | undefined > ( ) ) ;
14+ const contentKeyedDirsCalls = vi . hoisted ( ( ) => new Array < readonly string [ ] | undefined > ( ) ) ;
1415const fixtureState = vi . hoisted ( ( ) => ( { sourceDurationSeconds : 60 } ) ) ;
1516
1617vi . mock ( "@hyperframes/engine" , async ( importOriginal ) => {
@@ -20,7 +21,11 @@ vi.mock("@hyperframes/engine", async (importOriginal) => {
2021 extractAllVideoFrames : async (
2122 videos : VideoElement [ ] ,
2223 _baseDir : string ,
23- options : { timelineEnd ?: number ; toneMapHdrToSdr ?: boolean } ,
24+ options : {
25+ timelineEnd ?: number ;
26+ toneMapHdrToSdr ?: boolean ;
27+ contentKeyedDirs ?: readonly string [ ] ;
28+ } ,
2429 ) : Promise < ExtractionResult > => {
2530 const sourceDurationSeconds = fixtureState . sourceDurationSeconds ;
2631 const video = videos [ 0 ] ;
@@ -38,6 +43,7 @@ vi.mock("@hyperframes/engine", async (importOriginal) => {
3843 video . end = video . start + durationSeconds ;
3944 extractionCalls . push ( { timelineEnd : options . timelineEnd , durationSeconds } ) ;
4045 toneMapHdrToSdrCalls . push ( options . toneMapHdrToSdr ) ;
46+ contentKeyedDirsCalls . push ( options . contentKeyedDirs ) ;
4147 return {
4248 success : true ,
4349 extracted : [ ] ,
@@ -66,6 +72,8 @@ vi.mock("@hyperframes/engine", async (importOriginal) => {
6672 } ;
6773} ) ;
6874
75+ import { join } from "node:path" ;
76+ import { REMOTE_MEDIA_SUBDIR } from "../../htmlCompiler.js" ;
6977import { createRenderJob } from "../../renderOrchestrator.js" ;
7078import { runExtractVideosStage } from "./extractVideosStage.js" ;
7179
@@ -141,6 +149,16 @@ describe.each([
141149
142150 expect ( toneMapHdrToSdrCalls ) . toEqual ( [ true ] ) ;
143151 } ) ;
152+
153+ it ( "caches the compiled remote-media copies by content" , async ( ) => {
154+ contentKeyedDirsCalls . splice ( 0 ) ;
155+
156+ await runStage ( 2 , materializeSymlinks ) ;
157+
158+ expect ( contentKeyedDirsCalls ) . toEqual ( [
159+ [ join ( "/tmp/hf-timeline-bound-compiled" , REMOTE_MEDIA_SUBDIR ) ] ,
160+ ] ) ;
161+ } ) ;
144162} ) ;
145163
146164describe ( "video extraction source logging" , ( ) => {
0 commit comments