From 10ba1d34ed1576baa2a6fe15de8e0957e8e60486 Mon Sep 17 00:00:00 2001 From: OlympusM Date: Thu, 9 Jul 2026 12:32:48 -0400 Subject: [PATCH 1/4] cleanup libwebrtc compiler warnings --- libwebrtc/src/audio_source.rs | 7 +++---- libwebrtc/src/native/apm.rs | 5 ++--- libwebrtc/src/native/audio_mixer.rs | 2 +- libwebrtc/src/native/desktop_capturer.rs | 20 ++++++++++++++------ 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/libwebrtc/src/audio_source.rs b/libwebrtc/src/audio_source.rs index 2d3a0c245..bc395e569 100644 --- a/libwebrtc/src/audio_source.rs +++ b/libwebrtc/src/audio_source.rs @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -use crate::{enum_dispatch, imp::audio_source as imp_as}; - /// Default sample rate used by WebRTC audio pipelines (48kHz). pub const DEFAULT_SAMPLE_RATE: u32 = 48000; @@ -166,10 +164,11 @@ pub mod native { use super::*; use crate::{audio_frame::AudioFrame, RtcError}; + use crate::imp::audio_source::NativeAudioSource as ImpAudioSource; #[derive(Clone)] pub struct NativeAudioSource { - pub(crate) handle: imp_as::NativeAudioSource, + pub(crate) handle: ImpAudioSource, } impl Debug for NativeAudioSource { @@ -186,7 +185,7 @@ pub mod native { queue_size_ms: u32, ) -> NativeAudioSource { Self { - handle: imp_as::NativeAudioSource::new( + handle: ImpAudioSource::new( options, sample_rate, num_channels, diff --git a/libwebrtc/src/native/apm.rs b/libwebrtc/src/native/apm.rs index 17ba03375..816e68174 100644 --- a/libwebrtc/src/native/apm.rs +++ b/libwebrtc/src/native/apm.rs @@ -29,16 +29,15 @@ impl AudioProcessingModule { noise_suppression_enabled: bool, ) -> Self { Self { - sys_handle: unsafe { + sys_handle: sys_apm::create_apm( echo_canceller_enabled, gain_controller_enabled, high_pass_filter_enabled, noise_suppression_enabled, ) - }, + } } - } pub fn process_stream( &mut self, diff --git a/libwebrtc/src/native/audio_mixer.rs b/libwebrtc/src/native/audio_mixer.rs index eed6e077a..eff05ec8c 100644 --- a/libwebrtc/src/native/audio_mixer.rs +++ b/libwebrtc/src/native/audio_mixer.rs @@ -27,7 +27,7 @@ pub use ffi::AudioFrameInfo; pub trait AudioMixerSource { fn ssrc(&self) -> i32; fn preferred_sample_rate(&self) -> u32; - fn get_audio_frame_with_info(&self, target_sample_rate: u32) -> Option; + fn get_audio_frame_with_info(&self, target_sample_rate: u32) -> Option>; } struct AudioMixerSourceImpl { diff --git a/libwebrtc/src/native/desktop_capturer.rs b/libwebrtc/src/native/desktop_capturer.rs index 942c22aa5..42426e407 100644 --- a/libwebrtc/src/native/desktop_capturer.rs +++ b/libwebrtc/src/native/desktop_capturer.rs @@ -19,6 +19,7 @@ use webrtc_sys::desktop_capturer::{self as sys_dc, ffi::new_desktop_capturer}; pub(crate) enum SourceType { Screen, Window, + #[cfg(any(target_os = "macos", target_os = "linux"))] Generic, } @@ -61,17 +62,24 @@ impl DesktopCapturerOptions { let source_type = match self.source_type { SourceType::Screen => sys_dc::ffi::SourceType::Screen, SourceType::Window => sys_dc::ffi::SourceType::Window, + #[cfg(any(target_os = "macos", target_os = "linux"))] SourceType::Generic => sys_dc::ffi::SourceType::Generic, }; - let mut sys_handle = sys_dc::ffi::DesktopCapturerOptions { + let sys_handle = sys_dc::ffi::DesktopCapturerOptions { source_type, include_cursor: self.include_cursor, - allow_sck_system_picker: false, + allow_sck_system_picker: { + #[cfg(target_os = "macos")] + { + self.allow_sck_system_picker + } + #[cfg(not(target_os = "macos"))] + { + false + } + }, }; - #[cfg(target_os = "macos")] - { - sys_handle.allow_sck_system_picker = self.allow_sck_system_picker; - } + sys_handle } } From 124fcfd8716f50018c9ec04406c834eaa46d4fc5 Mon Sep 17 00:00:00 2001 From: OlympusM Date: Thu, 9 Jul 2026 13:13:10 -0400 Subject: [PATCH 2/4] fix formatting --- libwebrtc/src/audio_source.rs | 11 ++--------- libwebrtc/src/native/apm.rs | 15 +++++++-------- libwebrtc/src/native/desktop_capturer.rs | 2 +- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/libwebrtc/src/audio_source.rs b/libwebrtc/src/audio_source.rs index bc395e569..aadf7e63f 100644 --- a/libwebrtc/src/audio_source.rs +++ b/libwebrtc/src/audio_source.rs @@ -163,8 +163,8 @@ pub mod native { use std::fmt::{Debug, Formatter}; use super::*; - use crate::{audio_frame::AudioFrame, RtcError}; use crate::imp::audio_source::NativeAudioSource as ImpAudioSource; + use crate::{audio_frame::AudioFrame, RtcError}; #[derive(Clone)] pub struct NativeAudioSource { @@ -184,14 +184,7 @@ pub mod native { num_channels: u32, queue_size_ms: u32, ) -> NativeAudioSource { - Self { - handle: ImpAudioSource::new( - options, - sample_rate, - num_channels, - queue_size_ms, - ), - } + Self { handle: ImpAudioSource::new(options, sample_rate, num_channels, queue_size_ms) } } pub fn clear_buffer(&self) { diff --git a/libwebrtc/src/native/apm.rs b/libwebrtc/src/native/apm.rs index 816e68174..a5c53fb94 100644 --- a/libwebrtc/src/native/apm.rs +++ b/libwebrtc/src/native/apm.rs @@ -29,15 +29,14 @@ impl AudioProcessingModule { noise_suppression_enabled: bool, ) -> Self { Self { - sys_handle: - sys_apm::create_apm( - echo_canceller_enabled, - gain_controller_enabled, - high_pass_filter_enabled, - noise_suppression_enabled, - ) - } + sys_handle: sys_apm::create_apm( + echo_canceller_enabled, + gain_controller_enabled, + high_pass_filter_enabled, + noise_suppression_enabled, + ), } + } pub fn process_stream( &mut self, diff --git a/libwebrtc/src/native/desktop_capturer.rs b/libwebrtc/src/native/desktop_capturer.rs index 42426e407..800c53453 100644 --- a/libwebrtc/src/native/desktop_capturer.rs +++ b/libwebrtc/src/native/desktop_capturer.rs @@ -79,7 +79,7 @@ impl DesktopCapturerOptions { } }, }; - + sys_handle } } From 44f99c9875c9aa22ba59dab50d31a7004133c3b2 Mon Sep 17 00:00:00 2001 From: OlympusM Date: Thu, 9 Jul 2026 13:20:51 -0400 Subject: [PATCH 3/4] add changeset --- .changeset/cleanup-libwebrtc-warnings.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/cleanup-libwebrtc-warnings.md diff --git a/.changeset/cleanup-libwebrtc-warnings.md b/.changeset/cleanup-libwebrtc-warnings.md new file mode 100644 index 000000000..3fa980da7 --- /dev/null +++ b/.changeset/cleanup-libwebrtc-warnings.md @@ -0,0 +1,5 @@ +--- +"libwebrtc": patch +--- + +fix compiler warnings in libwebrtc \ No newline at end of file From 4dddf6c54bb5cadd70aba34f9eb99819cbb47686 Mon Sep 17 00:00:00 2001 From: OlympusM Date: Thu, 9 Jul 2026 18:40:43 -0400 Subject: [PATCH 4/4] updated changeset --- .changeset/cleanup-libwebrtc-warnings.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/cleanup-libwebrtc-warnings.md b/.changeset/cleanup-libwebrtc-warnings.md index 3fa980da7..cc11d2fc4 100644 --- a/.changeset/cleanup-libwebrtc-warnings.md +++ b/.changeset/cleanup-libwebrtc-warnings.md @@ -1,5 +1,5 @@ --- -"libwebrtc": patch +"libwebrtc": minor --- fix compiler warnings in libwebrtc \ No newline at end of file