Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
fix(recording): the WGC frame mutex, even dimensions, a writer hang net, HUD drag and Wayland
Etienne Lescot754e7f211776
diff --git a/electron/native/wgc-capture/src/main.cpp b/electron/native/wgc-capture/src/main.cppindex 6c092347d..f8036c24a 100644--- a/electron/native/wgc-capture/src/main.cpp+++ b/electron/native/wgc-capture/src/main.cpp@@ -624,8 +624,8 @@ int main(int argc, char* argv[]) {// SampleTime we attach (confirmed empirically -- varying, correctly// increasing input timestamps still produced perfectly even output// spacing). Since we cannot make the encoder respect real capture- // time, we instead make the encoder's assumption true: call- // writeBgraFrame() on a real-time-paced cadence (duplicating the+ // time, we instead make the encoder's assumption true: feed the+ // webcam encoder on a real-time-paced cadence (duplicating the// latest available camera frame when the camera hasn't produced a// newer one yet), so "sample N is at N/fps" is actually correct.int64_t nextWebcamWriteDueHns = 0;@@ -696,7 +696,7 @@ int main(int argc, char* argv[]) {// sequentially at its configured nominal rate regardless of the// SampleTime attached to each input sample. So the only way to// keep the encoded webcam file in sync with real elapsed time is- // to call writeBgraFrame() *at* that nominal cadence, duplicating+ // to feed the encoder *at* that nominal cadence, duplicating// the latest available camera frame when the camera hasn't// produced a newer one yet (VFR capture -> CFR encode resampling).if (targetElapsedHns >= nextWebcamWriteDueHns) {@@ -704,11 +704,16 @@ int main(int argc, char* argv[]) {if (lastWebcamTimestampHns >= 0 && webcamTimestampHns <= lastWebcamTimestampHns) {webcamTimestampHns = lastWebcamTimestampHns + nominalWebcamIntervalHns;}- if (!webcamEncoder.writeBgraFrame(webcamFrame, webcamTimestampHns)) {+ // Capture the sample under `mutex` (the frame copy), but+ // submit it to the sink writer OUTSIDE the mutex below+ // (issue #115) so a slow WriteSample can't starve the main+ // thread's stop-wait.+ hasWebcamSample = webcamEncoder.captureBgraSample(webcamFrame, webcamTimestampHns, webcamSample);+ if (!hasWebcamSample) {encodeFailed = true;control.stopRequested = true;control.cv.notify_all();- return;+ break;}lastWebcamTimestampHns = webcamTimestampHns;nextWebcamWriteDueHns += nominalWebcamIntervalHns;diff --git a/src/components/launch/LaunchWindow.tsx b/src/components/launch/LaunchWindow.tsxindex e4bb7cec7..9f8f164c9 100644--- a/src/components/launch/LaunchWindow.tsx+++ b/src/components/launch/LaunchWindow.tsx@@ -453,6 +453,7 @@ export function LaunchWindow() {// (instant, GPU-composited, no native resize at all), and only a genuinely new maximum// triggers the animated resize -- rare enough that its motion is acceptable.const hudAllocatedSizeRef = useRef({ width: 0, height: 0, orientation: trayLayout });+ const isDraggingHudRef = useRef(false);const measureHudSize = useCallback(() => {const barEl = hudBarRef.current;if (!barEl || !window.electronAPI?.setHudOverlaySize) return;@@ -1046,6 +1047,7 @@ export function LaunchWindow() {>{/* Drag handle */}<div+ data-testid="hud-drag-handle"className={`flex ${trayLayout === "vertical" ? "h-6 w-8" : "h-8 w-7"} shrink-0 cursor-grab items-center justify-center active:cursor-grabbing ${styles.electronNoDrag}`}onPointerDown={handleHudDragPointerDown}onPointerMove={handleHudDragPointerMove}