diff --git a/.changeset/cleanup-libwebrtc-warnings.md b/.changeset/cleanup-libwebrtc-warnings.md new file mode 100644 index 000000000..cc11d2fc4 --- /dev/null +++ b/.changeset/cleanup-libwebrtc-warnings.md @@ -0,0 +1,5 @@ +--- +"libwebrtc": minor +--- + +fix compiler warnings in libwebrtc \ No newline at end of file diff --git a/libwebrtc/src/audio_source.rs b/libwebrtc/src/audio_source.rs index 2d3a0c245..aadf7e63f 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; @@ -165,11 +163,12 @@ pub mod native { use std::fmt::{Debug, Formatter}; use super::*; + use crate::imp::audio_source::NativeAudioSource as ImpAudioSource; use crate::{audio_frame::AudioFrame, RtcError}; #[derive(Clone)] pub struct NativeAudioSource { - pub(crate) handle: imp_as::NativeAudioSource, + pub(crate) handle: ImpAudioSource, } impl Debug for NativeAudioSource { @@ -185,14 +184,7 @@ pub mod native { num_channels: u32, queue_size_ms: u32, ) -> NativeAudioSource { - Self { - handle: imp_as::NativeAudioSource::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 17ba03375..a5c53fb94 100644 --- a/libwebrtc/src/native/apm.rs +++ b/libwebrtc/src/native/apm.rs @@ -29,14 +29,12 @@ impl AudioProcessingModule { noise_suppression_enabled: bool, ) -> Self { Self { - sys_handle: unsafe { - 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, + ), } } 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..800c53453 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 } }