Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/cleanup-libwebrtc-warnings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"libwebrtc": minor
---

fix compiler warnings in libwebrtc
14 changes: 3 additions & 11 deletions libwebrtc/src/audio_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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 {
Expand All @@ -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) {
Expand Down
14 changes: 6 additions & 8 deletions libwebrtc/src/native/apm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
),
}
}

Expand Down
2 changes: 1 addition & 1 deletion libwebrtc/src/native/audio_mixer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<AudioFrame>;
fn get_audio_frame_with_info(&self, target_sample_rate: u32) -> Option<AudioFrame<'_>>;
}

struct AudioMixerSourceImpl<T> {
Expand Down
20 changes: 14 additions & 6 deletions libwebrtc/src/native/desktop_capturer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Comment thread
OlympusM marked this conversation as resolved.
}

Expand Down Expand Up @@ -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
}
}
Expand Down
Loading