Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(desktop): a stalled capture no longer freezes picture-in-picture #24057

MergedBatuhan1999(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/24057/headmerged by maria-rcks View on GitHub

Showing 2 changed files with 49 additions and 7 deletions.

x
0 of 2 viewed, 2 left
42 additions and 0 deletionsapps/desktop/src/preview/Manager.test.tsModified
View file
@@ -2164,6 +2164,48 @@
+ effectIt.effect("shows picture-in-picture and keeps capturing after stalled captures", () =>
+ withManager((manager) =>
+ Effect.gen(function* () {
+ const image = {
+ toJPEG: () => Buffer.from("preview-frame"),
+ getSize: () => ({ width: 1280, height: 720 }),
+ };
+ const stalledInitial = Promise.withResolvers<typeof image>();
+ const stalledLoop = Promise.withResolvers<typeof image>();
+ const capturePage = vi
+ .fn<() => Promise<typeof image>>()
+ .mockImplementationOnce(() => stalledInitial.promise)
+ .mockImplementationOnce(() => stalledLoop.promise)
+ .mockResolvedValue(image);
+ fromId.mockReturnValue(makeTestPreviewWebContents(capturePage));
+ const { pictureInPictureWindow, send } = makeTestPictureInPictureWindow();
+ browserWindowConstructor.mockImplementation(function () {
+ return pictureInPictureWindow;
+ });
+ yield* manager.createTab("tab_pip_stalled_capture");
+ yield* manager.registerWebview("tab_pip_stalled_capture", 42);
+​
+ try {
+ const open = yield* manager
+ .openPictureInPicture("tab_pip_stalled_capture")
+ .pipe(Effect.forkChild({ startImmediately: true }));