Skip to content

Create polished demo videos without editing skills. Mac/Windows/Linux

fix(recording): fail cleanly on WGC resize errors

wiiiii123d302bea66dae
diff --git a/electron/native/bin/win32-x64/helpers-manifest.json b/electron/native/bin/win32-x64/helpers-manifest.json
index 896af05e..bbcef557 100644
--- a/electron/native/bin/win32-x64/helpers-manifest.json
+++ b/electron/native/bin/win32-x64/helpers-manifest.json
@@ -5,10 +5,10 @@
"helpers": {
"wgc-capture": {
"binaryName": "wgc-capture.exe",
- "binarySha256": "ee24c7ce2fcd86eb513663416ad0aca673ac2a9b90b73532bc457e021b7b78a6",
+ "binarySha256": "4f8873abbff58add37672114184c154dee838939ee8f2b7df45d658d078af28c",
"sourceDir": "electron/native/wgc-capture",
- "sourceFingerprint": "c5a28a1999758f5b98dc79c247507eacb672a188d81d19aedc2dd656ee92a737",
- "updatedAt": "2026-05-08T16:48:17.850Z"
+ "sourceFingerprint": "6f725fad6eb515d81b2d553ec45ddbf7c681d2725bba48f0c0722ce00166d967",
+ "updatedAt": "2026-05-09T00:49:28.306Z"
},
"cursor-monitor": {
"binaryName": "cursor-monitor.exe",
diff --git a/electron/native/bin/win32-x64/wgc-capture.exe b/electron/native/bin/win32-x64/wgc-capture.exe
index add5c5db..37de4c9c 100644
Binary files a/electron/native/bin/win32-x64/wgc-capture.exe and b/electron/native/bin/win32-x64/wgc-capture.exe differ
diff --git a/electron/native/wgc-capture/src/main.cpp b/electron/native/wgc-capture/src/main.cpp
index d037fa75..0f007826 100644
--- a/electron/native/wgc-capture/src/main.cpp
+++ b/electron/native/wgc-capture/src/main.cpp
@@ -420,6 +420,18 @@ int main(int argc, char* argv[]) {
std::cerr << "ERROR: WGC capture session failed during recording" << std::endl;
encoder.finalize();
DeleteFileW(outputPathW.c_str());
+ if (!config.audioOutputPath.empty()) {
+ const std::wstring audioPathW = utf8ToWide(config.audioOutputPath);
+ const std::wstring audioMetadataPathW = utf8ToWide(config.audioOutputPath + ".json");
+ DeleteFileW(audioPathW.c_str());
+ DeleteFileW(audioMetadataPathW.c_str());
+ }
+ if (!config.micOutputPath.empty()) {
+ const std::wstring micPathW = utf8ToWide(config.micOutputPath);
+ const std::wstring micMetadataPathW = utf8ToWide(config.micOutputPath + ".json");
+ DeleteFileW(micPathW.c_str());
+ DeleteFileW(micMetadataPathW.c_str());
+ }
return 1;
}
diff --git a/electron/native/wgc-capture/src/wgc_session.cpp b/electron/native/wgc-capture/src/wgc_session.cpp
index c9fb0040..898a9fdc 100644
--- a/electron/native/wgc-capture/src/wgc_session.cpp
+++ b/electron/native/wgc-capture/src/wgc_session.cpp
@@ -136,7 +136,7 @@ bool WgcSession::initializeWithItem(int fps) {
// IsBorderRequired is only available on Windows 11+ (build 22000). propagating an hresult_error results in Native Windows capture failure
try {
session_.IsBorderRequired(false);
- } catch (winrt::hresult_error const& e) {
+ } catch (winrt::hresult_error const&) {
}
return true;
@@ -169,6 +169,7 @@ bool WgcSession::recreateFramePoolIfNeeded(
<< framePoolWidth_ << "x" << framePoolHeight_ << std::endl;
} catch (winrt::hresult_error const& e) {
fatalError_ = true;
+ capturing_ = false;
std::cerr << "ERROR: Failed to recreate WGC frame pool after resize: 0x"
<< std::hex << e.code() << std::dec << std::endl;
}
@@ -248,7 +249,7 @@ void WgcSession::onFrameArrived(
winrt::Windows::Graphics::Capture::Direct3D11CaptureFramePool const& sender,
winrt::Windows::Foundation::IInspectable const&) {
- if (!capturing_) return;
+ if (!capturing_ || fatalError_) return;
auto frame = sender.TryGetNextFrame();
if (!frame) return;