Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix(media-server): put the time base and first packet difference ahead of tag differences
Richie McIlroy5d92e7abf9c1
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 9a7eda1f6..b1f11f815 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@@ -800,6 +800,30 @@ describe("encoded recording preservation", () => {),).toBe("time base 1/15000 vs 1/90000");});+ test("keeps the time bases when many tags differ", () => {+ const summary = (value: string) => ({+ configuration: {+ codec_type: "video" as const,+ start: "0/1",+ tags: Object.fromEntries(+ Array.from({ length: 20 }, (_, index) => [+ `tag_${index}`,+ `${value}-${"x".repeat(30)}`,+ ]),+ ),+ },+ count: 2,+ packets: value,+ startTime: 0,+ tail: undefined,+ });+ const explanation = describeTrackDifference(+ { summary: summary("a"), log: undefined, timeBase: "1/15000" },+ { summary: summary("b"), log: undefined, timeBase: "1/90000" },+ );+ expect(explanation.length).toBeLessThanOrEqual(400);+ expect(explanation).toStartWith("time base 1/15000 vs 1/90000; tags.tag_0");+ });test("does not start cancelled packet verification", async () => {const controller = new AbortController();controller.abort();diff --git a/apps/media-server/src/lib/recording-packet-proof.ts b/apps/media-server/src/lib/recording-packet-proof.tsindex 233de879c..39283a687 100644--- a/apps/media-server/src/lib/recording-packet-proof.ts+++ b/apps/media-server/src/lib/recording-packet-proof.ts@@ -352,24 +352,28 @@ export function describeTrackDifference("summary" | "log" | "timeBase">,): string {- const parts = configurationDifferences(- source.summary.configuration as Record<string, unknown>,- output.summary.configuration as Record<string, unknown>,- );- if (source.summary.count !== output.summary.count)- parts.push(`packets ${source.summary.count} vs ${output.summary.count}`);- if (source.summary.startTime !== output.summary.startTime)- parts.push(- `start ${source.summary.startTime} vs ${output.summary.startTime}`,- );+ // Short, specific details go first so many changed tags cannot push them past the length cap.+ const parts: string[] = [];+ if (source.timeBase !== output.timeBase)+ parts.push(`time base ${source.timeBase} vs ${output.timeBase}`);if (source.summary.packets !== output.summary.packets &&source.log &&output.log)parts.push(firstPacketDifference(source.log, output.log));- if (source.timeBase !== output.timeBase)- parts.push(`time base ${source.timeBase} vs ${output.timeBase}`);+ if (source.summary.count !== output.summary.count)+ parts.push(`packets ${source.summary.count} vs ${output.summary.count}`);+ if (source.summary.startTime !== output.summary.startTime)+ parts.push(+ `start ${source.summary.startTime} vs ${output.summary.startTime}`,+ );+ parts.push(+ ...configurationDifferences(+ source.summary.configuration as Record<string, unknown>,+ output.summary.configuration as Record<string, unknown>,+ ),+ );return parts.join("; ").slice(0, 400) || "track summaries differ";}