Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix(media-server): stop chunk copies on cancellation and assert the verification fallback
Richie McIlroy237b874d5e3d
diff --git a/apps/media-server/src/__tests__/lib/recording-verification.integration.test.ts b/apps/media-server/src/__tests__/lib/recording-verification.integration.test.tsindex cdac180b2..618cfa779 100644--- a/apps/media-server/src/__tests__/lib/recording-verification.integration.test.ts+++ b/apps/media-server/src/__tests__/lib/recording-verification.integration.test.ts@@ -2614,7 +2614,8 @@ describe("chunked packet-proven verification", () => {test("falls back to one full decode when fragments do not start on keyframes", async () => {const recording = await misalignedRecording("chunk-misaligned");expect(recording.segments.length).toBeGreaterThanOrEqual(6);- const { single, chunked } = await both(recording);+ const { single, chunked, fallbacks } = await both(recording);+ expect(fallbacks).toHaveLength(1);expect(chunked).toEqual(single);expect(chunked.video.frameCount).toBe(120);});@@ -2695,7 +2696,7 @@ describe("ranged remote byte verification", () => {return { server, ranges };}- async function verify(port: number) {+ async function verify(port: number | undefined) {return verifyRemoteRecordingBytes(`http://127.0.0.1:${port}/recording.mp4`,{diff --git a/apps/media-server/src/lib/recording-verification.ts b/apps/media-server/src/lib/recording-verification.tsindex 7941d5fec..dcd7c5346 100644--- a/apps/media-server/src/lib/recording-verification.ts+++ b/apps/media-server/src/lib/recording-verification.ts@@ -718,11 +718,19 @@ async function collectDecoderLines(take(pending + decoder.decode());}-async function concatFiles(paths: string[], target: string): Promise<void> {+async function concatFiles(+ paths: string[],+ target: string,+ signal?: AbortSignal,+): Promise<void> {const output = createWriteStream(target);try {for (const path of paths) {- await pipeline(createReadStream(path), output, { end: false });+ signal?.throwIfAborted();+ await pipeline(createReadStream(path), output, {+ end: false,+ ...(signal ? { signal } : {}),+ });}} finally {await new Promise<void>((resolve, reject) =>@@ -971,7 +979,11 @@ async function decodePacketProvenChunks(try {await Promise.all(groups.map((group, index) =>- concatFiles([source.init, ...group], chunkPaths[index]),+ concatFiles(+ [source.init, ...group],+ chunkPaths[index],+ options.abortSignal,+ ),),);const jobs = [