mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-23 11:29:54 +00:00
fix(studio): a video with no size of its own keeps its file's size while a lighter copy plays (#8233)
* fix(studio): a video with no size of its own keeps its file's size while a lighter copy plays The preview plays a smaller copy of a large video, and a video the film gives no size took the copy's size: a 1920x1080 file in a 1080p film drew at 456x257 at Quality 1/2 and 608x342 at Full, while a render draws it at 1920x1080. While a copy plays, a rule keyed by the copy's address now gives the video its file's shown size (its pixels' aspect and turn included), at zero specificity so any size the film's own CSS sets still wins. Studio's media facts now carry the pixel aspect and turn, read by the same code the engine uses. * fix(studio): size only a video the film leaves unsized while its copy plays, as Chromium lays it out A video whose box is its file's own size (300x150 before the file loads) gets a plain width and height at that size while a smaller copy plays, through a preview-only mark and a rule keyed by mark and copy address. A video the film sizes in either direction is left to the film's CSS, so authored aspect ratios, box sizing, containment and earlier rules lay out as before. The size is the original's decoded size when the browser has it, else its facts with narrow pixels stretching the height as Chromium does. ffprobe is asked for the side data list, which 4.x also knows, in Studio and in the CLI. A video shown with object-fit none or scale-down keeps its file. * fix(studio): an unsized video keeps its size when its copy is made cold behind a still * test(core): a held video gets its file back when waiting for its copy throws * fix(core): a copy wait that throws counts as not served, so a held video gets its file back * test(core): each proxy test resets its own runtime's copy reporting, so none reports into the next * test(core): the stale-runtime test runs past the report throttle, as a finished test does * test(core): a framed proxy test's runtime must not report its copies into the next test * test(core): every proxy test runtime loaded fresh has its copy reporting reset after the test
This commit is contained in:
@@ -6,7 +6,7 @@ import { chunkCrc32 } from "./crc32.js";
|
||||
import { StringDecoder } from "node:string_decoder";
|
||||
import { tmpdir } from "os";
|
||||
import { basename, join } from "path";
|
||||
import { redactTelemetryString } from "@hyperframes/core";
|
||||
import { parseSampleAspectRatio, redactTelemetryString, streamRotation } from "@hyperframes/core";
|
||||
import {
|
||||
alphaDecoderFor,
|
||||
pixelFormatHasAlpha,
|
||||
@@ -907,12 +907,8 @@ export function parseFrameRate(frameRateStr: string | undefined): number {
|
||||
}
|
||||
|
||||
function displayRotation(stream: FFProbeStream): { rotation?: number } {
|
||||
const turn = Number(
|
||||
stream.side_data_list?.find((data) => data.rotation !== undefined)?.rotation ??
|
||||
stream.tags?.rotate ??
|
||||
0,
|
||||
);
|
||||
return Number.isFinite(turn) && turn % 360 !== 0 ? { rotation: turn } : {};
|
||||
const rotation = streamRotation(stream);
|
||||
return rotation === undefined ? {} : { rotation };
|
||||
}
|
||||
|
||||
export function displaySize(
|
||||
@@ -924,12 +920,7 @@ export function displaySize(
|
||||
: { width, height: metadata.height };
|
||||
}
|
||||
|
||||
export function parseSampleAspectRatio(value: string | undefined): number | undefined {
|
||||
const [num, den] = (value ?? "").split(":").map(Number);
|
||||
if (!num || !den || !Number.isFinite(num) || !Number.isFinite(den)) return undefined;
|
||||
const ratio = num / den;
|
||||
return Math.abs(ratio - 1) < 1e-3 ? undefined : ratio;
|
||||
}
|
||||
export { parseSampleAspectRatio };
|
||||
|
||||
/**
|
||||
* Whether the first frame decoded with `decoder` (alpha-aware) has an alpha pixel format; undefined on any
|
||||
|
||||
Reference in New Issue
Block a user