mirror of
https://github.com/webadderallorg/Recordly.git
synced 2026-09-25 15:25:44 +00:00
Record captured frames with BT.709 conversion and explicit limited-range metadata. Share the Windows conversion code between capture engines and apply matching colour metadata on macOS and FFmpeg fallbacks.
52 lines
1.9 KiB
TypeScript
52 lines
1.9 KiB
TypeScript
import { readFileSync } from "node:fs";
|
|
import { fileURLToPath } from "node:url";
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
const recorderSource = readFileSync(
|
|
fileURLToPath(new URL("./ScreenCaptureKitRecorder.swift", import.meta.url)),
|
|
"utf8",
|
|
);
|
|
|
|
describe("ScreenCaptureKitRecorder finalization coordination", () => {
|
|
it("marks manual stops as participants in the shared finalization", () => {
|
|
expect(recorderSource).toContain("finalizeCapture(interactive: true)");
|
|
expect(recorderSource).toContain("finalization.outputResult.get()");
|
|
expect(recorderSource).toContain(
|
|
"self.interactiveStopParticipated = self.interactiveStopParticipated || interactive",
|
|
);
|
|
});
|
|
|
|
it("does not let automatic window-close exit preempt a joined manual stop", () => {
|
|
expect(recorderSource).toContain("self.finalizeCapture(interactive: false)");
|
|
expect(recorderSource).toMatch(
|
|
/if finalization\.interactiveStopParticipated\s*\{\s*return\s*\}/,
|
|
);
|
|
});
|
|
});
|
|
|
|
describe("ScreenCaptureKitRecorder resume timing", () => {
|
|
it("anchors warm-start resume timing to video before accepting audio", () => {
|
|
expect(recorderSource).toContain(
|
|
"guard outputType == .screen, let pauseStartedHostTime else",
|
|
);
|
|
});
|
|
|
|
it("drops non-monotonic video and audio samples", () => {
|
|
expect(recorderSource).toContain(
|
|
"CMTimeCompare(presentationTime, lastVideoPresentationTime) <= 0",
|
|
);
|
|
expect(recorderSource).toContain(
|
|
"CMTimeCompare(presentationTime, lastPresentationTime) > 0",
|
|
);
|
|
});
|
|
});
|
|
|
|
describe("ScreenCaptureKitRecorder colour metadata", () => {
|
|
it("tags recordings as BT.709", () => {
|
|
expect(recorderSource).toContain("AVVideoColorPropertiesKey");
|
|
expect(recorderSource).toContain("AVVideoColorPrimaries_ITU_R_709_2");
|
|
expect(recorderSource).toContain("AVVideoTransferFunction_ITU_R_709_2");
|
|
expect(recorderSource).toContain("AVVideoYCbCrMatrix_ITU_R_709_2");
|
|
});
|
|
});
|