From f48ba14f10d85614358257b5994984387a9cb2b3 Mon Sep 17 00:00:00 2001 From: Marcus Date: Thu, 27 Jun 2024 15:25:47 +0200 Subject: [PATCH 1/4] linux: fix compilation errors --- src/capturer/engine/linux/mod.rs | 11 +---------- src/targets/mod.rs | 10 +++++----- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/capturer/engine/linux/mod.rs b/src/capturer/engine/linux/mod.rs index fc4d32e..cabefbc 100644 --- a/src/capturer/engine/linux/mod.rs +++ b/src/capturer/engine/linux/mod.rs @@ -335,16 +335,7 @@ impl LinuxCapturer { .pw_node_id(); // TODO: Fix this hack - let options = Options { - fps: options.fps, - show_cursor: options.show_cursor, - show_highlight: options.show_highlight, - output_type: options.output_type, - targets: options.targets.clone(), - excluded_targets: None, - output_resolution: crate::capturer::Resolution::Captured, - source_rect: None, - }; + let options = options.clone(); let (ready_sender, ready_recv) = sync_channel(1); let capturer_join_handle = std::thread::spawn(move || { let res = pipewire_capturer(options, tx, &ready_sender, stream_id); diff --git a/src/targets/mod.rs b/src/targets/mod.rs index 836bc7c..930ab62 100644 --- a/src/targets/mod.rs +++ b/src/targets/mod.rs @@ -57,7 +57,7 @@ pub fn get_scale_factor(target: &Target) -> f64 { return win::get_scale_factor(target); #[cfg(target_os = "linux")] - return 1; + return 1.0; } pub fn get_main_display() -> Display { @@ -67,8 +67,8 @@ pub fn get_main_display() -> Display { #[cfg(target_os = "windows")] return win::get_main_display(); - // #[cfg(target_os = "linux")] - // return linux::get_main_display(); + #[cfg(target_os = "linux")] + unreachable!(); } pub fn get_target_dimensions(target: &Target) -> (u64, u64) { @@ -78,6 +78,6 @@ pub fn get_target_dimensions(target: &Target) -> (u64, u64) { #[cfg(target_os = "windows")] return win::get_target_dimensions(target); - // #[cfg(target_os = "linux")] - // return linux::get_target_dimensions(target); + #[cfg(target_os = "linux")] + unreachable!(); } From 1a01599b1aa7ea85da2a016dd745c853850e845d Mon Sep 17 00:00:00 2001 From: Marcus Date: Thu, 27 Jun 2024 15:36:57 +0200 Subject: [PATCH 2/4] linux: fix cursor mode logic error --- src/capturer/engine/linux/portal.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/capturer/engine/linux/portal.rs b/src/capturer/engine/linux/portal.rs index 97cde90..013d4dd 100644 --- a/src/capturer/engine/linux/portal.rs +++ b/src/capturer/engine/linux/portal.rs @@ -408,13 +408,14 @@ impl<'a> ScreenCastPortal<'a> { pub fn show_cursor(mut self, mode: bool) -> Result { let available_modes = self.proxy.available_cursor_modes()?; - if mode && available_modes & 1 == 1 { - self.cursor_mode = 1; - return Ok(self); - } else if !mode && available_modes & 2 == 1 { + if mode && available_modes & 2 == 2 { self.cursor_mode = 2; return Ok(self); } + if !mode && available_modes & 1 == 1 { + self.cursor_mode = 1; + return Ok(self); + } Err(LinCapError::new("Unsupported cursor mode".to_string())) } From 2681ef1b13ce2592a333cc119cb95ab527f48658 Mon Sep 17 00:00:00 2001 From: Bernd Schoolmann Date: Fri, 19 Jul 2024 01:28:57 +0200 Subject: [PATCH 3/4] Fix restart on pipewire capturer --- src/capturer/engine/linux/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/capturer/engine/linux/mod.rs b/src/capturer/engine/linux/mod.rs index fc4d32e..e539909 100644 --- a/src/capturer/engine/linux/mod.rs +++ b/src/capturer/engine/linux/mod.rs @@ -375,6 +375,7 @@ impl LinuxCapturer { eprintln!("Error occured capturing: {e}"); } } + CAPTURER_STATE.store(0, std::sync::atomic::Ordering::Relaxed); } } From 0973f45d85b7cccb7b2b9651760f8164a0a724bc Mon Sep 17 00:00:00 2001 From: Bernd Schoolmann Date: Sun, 21 Jul 2024 18:34:03 +0200 Subject: [PATCH 4/4] Make STREAM_STATE_CHANGED_TO_ERROR reset on stop_capture --- src/capturer/engine/linux/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/capturer/engine/linux/mod.rs b/src/capturer/engine/linux/mod.rs index e539909..d3dad43 100644 --- a/src/capturer/engine/linux/mod.rs +++ b/src/capturer/engine/linux/mod.rs @@ -376,6 +376,7 @@ impl LinuxCapturer { } } CAPTURER_STATE.store(0, std::sync::atomic::Ordering::Relaxed); + STREAM_STATE_CHANGED_TO_ERROR.store(false, std::sync::atomic::Ordering::Relaxed); } }