1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
//! Options for [`super::WindowsWindowCapture::open_with`] — compiled on every target so the
//! Windows API reads the same off Windows.
/// Per-session WGC options that have no meaning outside Windows window capture, hence not
/// fields on the cross-platform [`crate::desktop::DesktopVideoCaptureConfig`].
///
/// Built from [`Default`] and then assigned, since new options may be added:
///
/// ```
/// use mediaway_device::windows_desktop::{CaptureBorder, FrameDimensions, WindowCaptureOptions};
///
/// let mut options = WindowCaptureOptions::default();
/// options.border = CaptureBorder::Hidden;
/// options.dimensions = FrameDimensions::EvenCropped;
/// ```
/// Whether Windows draws its yellow capture border around the window being captured.
///
/// The border is drawn by the compositor **on screen**, over the captured window. It never
/// appears in captured frames, so, unlike [`crate::desktop::CursorCapture`], this does not
/// change what gets recorded, only what the person in front of the window sees while it is
/// recorded.
///
/// Windows-only, because only WGC draws one.
/// How captured frame dimensions relate to the window's.
///
/// # Why `EvenCropped` exists
///
/// Every hardware video encoder rejects an odd width or height: 4:2:0 chroma is subsampled
/// 2×2, and there is no half chroma sample. Windows are resized to arbitrary sizes, so an
/// encoder fed straight from WGC fails on roughly three windows in four — measured on a live
/// Unity editor at 1137×636 on 2026-09-19, where no hardware HEVC or H.264 encoder would open.
///
/// # Why it is free
///
/// WGC **crops** a frame to its frame pool rather than scaling it. Measured 2026-09-19 against a
/// 2560×1392 window: with the pool at 2459×1341 the texture came back 2459×1341, and all
/// 3 297 519 overlapping pixels were identical to the full-size capture's top-left region.
/// So sizing the pool one pixel smaller on an odd axis drops that column or row with no copy
/// and no shader: the compositor simply writes less.
///
/// Cropping rather than padding is deliberate. A padded frame contains pixels the source never
/// drew, which in a recording used as evidence can be mistaken for a rendering bug.