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: pass platform from video/gifExporter to FrameRenderer, skip readback also for canvas composition for non-linux
Theodor Peifer934f05cc800f
diff --git a/src/lib/exporter/frameRenderer.ts b/src/lib/exporter/frameRenderer.tsindex 7dd93b34f..9b1cf6d68 100644--- a/src/lib/exporter/frameRenderer.ts+++ b/src/lib/exporter/frameRenderer.ts@@ -78,6 +78,7 @@ interface FrameRenderConfig {previewWidth?: number;previewHeight?: number;cursorTelemetry?: import("@/components/video-editor/types").CursorTelemetryPoint[];+ platform: string;}interface AnimationState {@@ -124,9 +125,11 @@ export class FrameRenderer {private smoothedAutoFocus: { cx: number; cy: number } | null = null;private prevAnimationTimeMs: number | null = null;private prevTargetProgress = 0;+ private isLinux = false;constructor(config: FrameRenderConfig) {this.config = config;+ this.isLinux = config.platform === "linux";this.animationState = {scale: 1,focusX: DEFAULT_FOCUS.cx,@@ -189,10 +192,8 @@ export class FrameRenderer {this.compositeCanvas.height = this.config.height;// On Linux, getImageData() is called frequently causing frequent CPU readback- const isLinux = (await window.electronAPI.getPlatform()) === "linux";-this.compositeCtx = this.compositeCanvas.getContext("2d", {- willReadFrequently: isLinux,+ willReadFrequently: this.isLinux,});if (!this.compositeCtx) {@@ -730,7 +731,10 @@ export class FrameRenderer {private compositeWithShadows(webcamFrame?: VideoFrame | null): void {if (!this.compositeCanvas || !this.compositeCtx || !this.app) return;- const videoCanvas = this.readbackVideoCanvas();+ const videoCanvas = this.isLinux+ ? this.readbackVideoCanvas()+ : (this.app.canvas as HTMLCanvasElement);+const ctx = this.compositeCtx;const w = this.compositeCanvas.width;const h = this.compositeCanvas.height;diff --git a/src/lib/exporter/gifExporter.ts b/src/lib/exporter/gifExporter.tsindex 58ed693d7..81c540ec1 100644--- a/src/lib/exporter/gifExporter.ts+++ b/src/lib/exporter/gifExporter.ts@@ -115,7 +115,10 @@ export class GifExporter {async export(): Promise<ExportResult> {let webcamFrameQueue: AsyncVideoFrameQueue | null = null;+try {+ const platform = await window.electronAPI.getPlatform();+this.cleanup();this.cancelled = false;@@ -153,6 +156,7 @@ export class GifExporter {previewWidth: this.config.previewWidth,previewHeight: this.config.previewHeight,cursorTelemetry: this.config.cursorTelemetry,+ platform,});await this.renderer.initialize();diff --git a/src/lib/exporter/videoExporter.ts b/src/lib/exporter/videoExporter.tsindex 61ad727ab..13c0696b2 100644--- a/src/lib/exporter/videoExporter.ts+++ b/src/lib/exporter/videoExporter.ts@@ -111,9 +111,9 @@ export class VideoExporter {this.cancelled = false;this.fatalEncoderError = null;- const platform = await window.electronAPI.getPlatform();-try {+ const platform = await window.electronAPI.getPlatform();+const streamingDecoder = new StreamingVideoDecoder();this.streamingDecoder = streamingDecoder;const videoInfo = await streamingDecoder.loadMetadata(this.config.videoUrl);@@ -148,6 +148,7 @@ export class VideoExporter {previewWidth: this.config.previewWidth,previewHeight: this.config.previewHeight,cursorTelemetry: this.config.cursorTelemetry,+ platform,});this.renderer = renderer;await renderer.initialize();