Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

fix(capture): log which node each audio source was linked to

Etienne Lescot91b3849ad021
diff --git a/electron/native-bridge/capture/linuxNativeCaptureSession.ts b/electron/native-bridge/capture/linuxNativeCaptureSession.ts
index 6a7a1a0dc..96c5917cf 100644
--- a/electron/native-bridge/capture/linuxNativeCaptureSession.ts
+++ b/electron/native-bridge/capture/linuxNativeCaptureSession.ts
@@ -293,6 +293,25 @@ export class LinuxNativeCaptureSession {
);
return;
+ case "audio-source":
+ // Logged unconditionally: when someone reports "that is not my
+ // microphone", this line is the answer.
+ console.info(
+ "[capture-linux] audio source",
+ JSON.stringify({
+ role: payload.role,
+ requested: payload.requested ?? null,
+ node: payload.node ?? null,
+ }),
+ );
+ if (payload.requested && !payload.node) {
+ console.warn(
+ `[capture-linux] no PipeWire node matched ${JSON.stringify(payload.requested)}; ` +
+ "the session default source was recorded instead",
+ );
+ }
+ return;
+
case "encoder-selection":
this.videoEncoder = payload.video;
console.info(
diff --git a/electron/native-bridge/cursor/recording/pipeWireCursorAccumulator.ts b/electron/native-bridge/cursor/recording/pipeWireCursorAccumulator.ts
index 2cbe197be..6cbeb9ee1 100644
--- a/electron/native-bridge/cursor/recording/pipeWireCursorAccumulator.ts
+++ b/electron/native-bridge/cursor/recording/pipeWireCursorAccumulator.ts
@@ -47,6 +47,14 @@ export type PipeWireHelperEvent =
assetId?: string;
asset?: PipeWireCursorAssetPayload;
}
+ | {
+ event: "audio-source";
+ role: string;
+ requested?: string | null;
+ /** The PipeWire node the stream was linked to. `null` means the session
+ * default was used, which is often NOT the device the user picked. */
+ node?: string | null;
+ }
| { event: "encoder-selection"; video: string; rejected?: string[] }
| {
event: "capture-started";
diff --git a/electron/native/pipewire-capture/src/events.rs b/electron/native/pipewire-capture/src/events.rs
index edb37c5d4..ee2fb8127 100644
--- a/electron/native/pipewire-capture/src/events.rs
+++ b/electron/native/pipewire-capture/src/events.rs
@@ -77,6 +77,25 @@ pub enum Event {
#[serde(skip_serializing_if = "Option::is_none")]
asset: Option<CursorAsset>,
},
+ /// Which capture node each audio source was linked to.
+ ///
+ /// NOT a debug event, deliberately. This started life as one and was
+ /// therefore suppressed unless OPENSCREEN_PIPEWIRE_DEBUG was set — so when
+ /// a user reported "that is not my microphone", the one line that would
+ /// have answered it was missing from their log. The resolved node is the
+ /// first thing anyone needs when audio comes from the wrong device.
+ #[serde(rename_all = "camelCase")]
+ AudioSource {
+ /// "system" or "microphone".
+ role: String,
+ /// What the app asked for: a device label from the picker, or absent
+ /// when it did not name one.
+ requested: Option<String>,
+ /// The PipeWire `node.name` the stream was pointed at. `None` means no
+ /// target was set, so PipeWire linked to the session default — which is
+ /// often NOT the device the user selected.
+ node: Option<String>,
+ },
/// Which rung of the encoder ladder won, and why the ones above it did not.
/// Emitted before `capture-started` so a helper that then fails to start
/// still leaves the selection in the log.
diff --git a/electron/native/pipewire-capture/src/main.rs b/electron/native/pipewire-capture/src/main.rs
index 7f120d1bf..a87e088de 100644
--- a/electron/native/pipewire-capture/src/main.rs
+++ b/electron/native/pipewire-capture/src/main.rs
@@ -346,15 +346,12 @@ fn start_audio<W: Write>(
.target
.as_deref()
.and_then(|wanted| resolve_microphone_node(wanted, &graph));
+ let _ = emitter.emit(&Event::AudioSource {
+ role: label.to_owned(),
+ requested: config.target.clone(),
+ node: resolved.clone(),
+ });
if let Some(wanted) = config.target.as_deref() {
- let _ = emitter.emit(&Event::Debug {
- code: "audio-target".to_owned(),
- data: json_map([
- ("label", wanted.into()),
- ("resolvedNode", resolved.clone().into()),
- ("graphSize", graph.len().into()),
- ]),
- });
if resolved.is_none() {
let _ = emitter.emit(&Event::Warning {
code: "microphone-not-found".to_owned(),