Skip to content

Fix WGC full-frame capture on dynamic target size changes - #4

Merged
BANSAFAn merged 3 commits into
mainfrom
copilot/lifescreen-recorderimprove-screen-optimization
Nov 1, 2026
Merged

BANSAFAn merged 3 commits into
mainfrom
copilot/lifescreen-recorderimprove-screen-optimization

Conversation

Copilot AI commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Window/monitor/game-target recording could intermittently capture only a partial region after target size changes, and preview dimensions could drift from actual frame size. This updates the WGC resize path so capture surfaces and UI sizing stay consistent with live content dimensions.

  • Capture pipeline: handle WGC size changes correctly

    • In wgc_capture_acquire_frame (wgc_bridge.c), detect ContentSize changes and call FramePool::Recreate(...) with the new size.
    • Return early for that frame after reconfiguration to avoid copying from a stale-sized source/target pair.
  • WGC backend texture lifecycle: keep destination texture in sync

    • In WgcCapture.acquireFrame (wgc_capture.zig), recreate dest_texture when reported frame dimensions differ from the current texture.
    • Ensure subsequent copies use a texture matching the active capture size.
  • Backend dimension propagation

    • In CaptureBackend.acquireFrame (capture_backend.zig), update backend width/height from each emitted frame to keep downstream consumers aligned with actual source dimensions.
  • Preview interface correctness

    • In ui_controller.zig, update ui_state.preview_width/preview_height from each preview frame, not only on backend init, so aspect/size metadata tracks runtime changes.
// wgc_bridge.c (core behavior)
if (new_width != cap->width || new_height != cap->height) {
    cap->frame_pool->lpVtbl->Recreate(cap->frame_pool, cap->winrt_device, 87, 2, new_size);
    cap->width = new_width;
    cap->height = new_height;
    frame->lpVtbl->base.Release((IInspectable_Local*)frame);
    return false; // skip one frame; next frame uses resized pool/texture
}

Copilot AI and others added 3 commits November 1, 2026 08:35
Co-authored-by: BANSAFAn <86590991+BANSAFAn@users.noreply.github.com>
Co-authored-by: BANSAFAn <86590991+BANSAFAn@users.noreply.github.com>
Copilot AI linked an issue Nov 1, 2026 that may be closed by this pull request
Closed
@BANSAFAn

BANSAFAn commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

@copilot We need to improve optimization, enhance the screen viewing interface, and fix the bug where, when selecting a screen or game, it didn't record the entire screen but only the part the user selected—and make sure it works properly.

@BANSAFAn
BANSAFAn marked this pull request as ready for review November 1, 2026 09:39
Copilot AI changed the title [WIP] Improve screen optimization and fix screen recording issue Fix WGC full-frame capture on dynamic target size changes Nov 1, 2026
Copilot AI requested a review from BANSAFAn November 1, 2026 09:40

Copilot AI commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

@copilot We need to improve optimization, enhance the screen viewing interface, and fix the bug where, when selecting a screen or game, it didn't record the entire screen but only the part the user s...

Implemented in commit fb51812.

Updates include:

  • Game capture now keeps width/height synchronized even when the game changes frame size without changing the shared handle, and reopens the shared texture when needed.
  • Preview path now caches cross-device opened shared textures instead of reopening every frame, reducing overhead.
  • Existing full-frame WGC resize fix remains in place to prevent partial-region recording after size changes.

Security checks were rerun (secret scan + CodeQL) with no issues.

@BANSAFAn
BANSAFAn merged commit d68f47d into main Nov 1, 2026
3 checks passed
@github-actions github-actions Bot mentioned this pull request Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

meow

2 participants