Skip to content

Commit

Permalink
Skip building ringrtc ADM on linux aarch64
Browse files Browse the repository at this point in the history
  • Loading branch information
mutexlox-signal authored and jim-signal committed Sep 27, 2024
1 parent 32acde7 commit be737c3
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 12 deletions.
3 changes: 3 additions & 0 deletions src/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,12 @@ chrono = {version = "0.4.38", optional = true }
call_protobuf = { path = "../../protobuf", package = "protobuf"}
mrp = { path = "../../mrp" }

[target.'cfg(not(all(target_os="linux", target_arch="aarch64")))'.dependencies]
# Optional, needed by "native" feature
cubeb = { version = "0.14.0", optional = true }
cubeb-core = { version = "0.14.0", optional = true }

[target.'cfg(windows)'.dependencies]
# Only needed by native feature on windows
windows = { version = "0.58.0", optional = true, features = ["Win32_System_Com"] }

Expand Down
17 changes: 14 additions & 3 deletions src/rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,17 @@ pub mod native;
pub mod webrtc {
pub mod arc;
pub use arc::Arc;
#[cfg(all(not(feature = "sim"), feature = "native"))]
#[cfg(all(
not(feature = "sim"),
feature = "native",
not(all(target_os = "linux", target_arch = "aarch64"))
))]
pub mod audio_device_module;
#[cfg(all(not(feature = "sim"), feature = "native"))]
#[cfg(all(
not(feature = "sim"),
feature = "native",
not(all(target_os = "linux", target_arch = "aarch64"))
))]
pub mod audio_device_module_utils;
pub mod field_trial;
pub mod ice_gatherer;
Expand All @@ -111,7 +119,10 @@ pub mod webrtc {
pub mod stats_observer;
#[cfg(not(feature = "sim"))]
mod ffi {
#[cfg(feature = "native")]
#[cfg(all(
feature = "native",
not(all(target_os = "linux", target_arch = "aarch64"))
))]
pub mod audio_device_module;
pub mod field_trial;
pub mod ice_gatherer;
Expand Down
53 changes: 44 additions & 9 deletions src/rust/src/webrtc/peer_connection_factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,17 @@ use std::os::raw::c_char;
use crate::common::Result;
use crate::error::RingRtcError;
use crate::webrtc;
#[cfg(all(not(feature = "sim"), feature = "native"))]
#[cfg(all(
not(feature = "sim"),
feature = "native",
not(all(target_os = "linux", target_arch = "aarch64"))
))]
use crate::webrtc::audio_device_module::AudioDeviceModule;
#[cfg(all(not(feature = "sim"), feature = "native"))]
#[cfg(all(
not(feature = "sim"),
feature = "native",
not(all(target_os = "linux", target_arch = "aarch64"))
))]
use crate::webrtc::ffi::audio_device_module::AUDIO_DEVICE_CBS_PTR;
#[cfg(feature = "injectable_network")]
use crate::webrtc::injectable_network::InjectableNetwork;
Expand Down Expand Up @@ -202,22 +210,49 @@ impl AudioConfig {
(std::ptr::null(), std::ptr::null())
};

#[cfg(not(all(target_os = "linux", target_arch = "aarch64")))]
let audio_device_module_type = self.audio_device_module_type;
#[cfg(all(target_os = "linux", target_arch = "aarch64"))]
let audio_device_module_type =
if self.audio_device_module_type == RffiAudioDeviceModuleType::RingRtc {
RffiAudioDeviceModuleType::Default
} else {
self.audio_device_module_type
};

#[cfg(all(
not(feature = "sim"),
feature = "native",
not(all(target_os = "linux", target_arch = "aarch64"))
))]
let adm_borrowed =
webrtc::ptr::Borrowed::from_ptr(Box::into_raw(Box::new(AudioDeviceModule::new())))
.to_void();
#[cfg(all(target_os = "linux", target_arch = "aarch64"))]
let adm_borrowed = webrtc::ptr::Borrowed::null();

#[cfg(all(
not(feature = "sim"),
feature = "native",
not(all(target_os = "linux", target_arch = "aarch64"))
))]
let rust_audio_device_callbacks =
webrtc::ptr::Borrowed::from_ptr(AUDIO_DEVICE_CBS_PTR).to_void();
#[cfg(all(target_os = "linux", target_arch = "aarch64"))]
let rust_audio_device_callbacks = webrtc::ptr::Borrowed::null();

Ok(RffiAudioConfig {
audio_device_module_type: self.audio_device_module_type,
audio_device_module_type,
input_file: webrtc::ptr::Borrowed::from_ptr(input_file),
output_file: webrtc::ptr::Borrowed::from_ptr(output_file),
high_pass_filter_enabled: self.high_pass_filter_enabled,
aec_enabled: self.aec_enabled,
ns_enabled: self.ns_enabled,
agc_enabled: self.agc_enabled,
#[cfg(all(not(feature = "sim"), feature = "native"))]
adm_borrowed: webrtc::ptr::Borrowed::from_ptr(Box::into_raw(Box::new(
AudioDeviceModule::new(),
)))
.to_void(),
adm_borrowed,
#[cfg(all(not(feature = "sim"), feature = "native"))]
rust_audio_device_callbacks: webrtc::ptr::Borrowed::from_ptr(AUDIO_DEVICE_CBS_PTR)
.to_void(),
rust_audio_device_callbacks,
})
}
}
Expand Down

0 comments on commit be737c3

Please sign in to comment.