fix(app): reject stale window frames before encoder reconfiguration

This commit is contained in:
AAA committed 2026-10-19 23:15:32 +08:00
1 parent e06a065c82
commit 392c1ff352
6 files changed
+34 -26

No files matched your search

+7 -3
View File
@@ -781,6 +781,9 @@ async function main(): Promise<void> {
`document.querySelector('button[aria-controls="host-advanced-door"]')?.click()`,
Date.now() + 5_000,
);
await clickHostControl(cdp, host,
`document.querySelector('#host-advanced-door .lr-sharing-picture-details > summary')`,
);
result.preSharePreferenceEnabled = await waitForValue(
(deadline) => evaluate<boolean>(
cdp!,
@@ -799,10 +802,8 @@ async function main(): Promise<void> {
// ceilings. Native capture no longer pads/upscales every source to 16:9.
await clickHostControl(cdp, host, `document.querySelector('button.lr-chip[aria-label="1440p"]')`);
await clickHostControl(cdp, host, `document.querySelector('button[name="degradationPreference"][value="maintain-resolution"]')`);
await clickHostControl(cdp, host, `document.querySelector('.lr-sharing-technical > summary')`);
await clickHostControl(cdp, host,
`([...document.querySelectorAll('button.lr-chip')].find((button) =>
button.textContent?.trim() === ${JSON.stringify(requestedCodec.toUpperCase())}))`,
`document.querySelector('button[name="videoCodec"][value="${requestedCodec}"]')`,
);
await evaluate<void>(
cdp,
@@ -972,6 +973,9 @@ async function main(): Promise<void> {
result.livePresetChanges += 1;
}
stage = "native-quality-controls";
await clickHostControl(cdp, host,
`document.querySelector('#host-advanced-door .lr-sharing-picture-details > summary')`,
);
await waitForValue(
(deadline) => evaluate<boolean>(
cdp!,
+4 -8
View File
@@ -2545,15 +2545,13 @@ async function startHost(
5_000, "sharing settings", signal);
if (codecMode !== "auto") {
await evaluate(cdp, page, `(() => {
const technical = document.querySelector('#host-advanced-door .lr-sharing-technical');
if (technical instanceof HTMLDetailsElement && !technical.open) technical.querySelector('summary')?.click();
const picture = document.querySelector('#host-advanced-door .lr-sharing-picture-details');
if (picture instanceof HTMLDetailsElement && !picture.open) picture.querySelector('summary')?.click();
})()`);
await waitForPage(
cdp,
page,
`Array.from(document.querySelectorAll('#host-advanced-door button')).some(
(button) => button instanceof HTMLButtonElement && button.getAttribute('aria-label')?.startsWith('${codecMode.toUpperCase()}')
)`,
`document.querySelector('#host-advanced-door button[name="videoCodec"][value="${codecMode}"]') instanceof HTMLButtonElement`,
5_000,
`${codecMode} codec control`,
signal,
@@ -2562,9 +2560,7 @@ async function startHost(
cdp,
page,
`(() => {
const button = Array.from(document.querySelectorAll('#host-advanced-door button')).find(
(candidate) => candidate instanceof HTMLButtonElement && candidate.getAttribute('aria-label')?.startsWith('${codecMode.toUpperCase()}')
);
const button = document.querySelector('#host-advanced-door button[name="videoCodec"][value="${codecMode}"]');
if (!(button instanceof HTMLButtonElement)) throw new Error('Codec mode button missing');
button.click();
return true;