Skip to content

Commit c8317a7

Browse files
ringrtc: Add support for switching to Ringrtc ADM
To enable add `RINGRTC_ADM=y` before the make invocation
1 parent a230750 commit c8317a7

File tree

5 files changed

+11
-5
lines changed

5 files changed

+11
-5
lines changed

bin/build-cli

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,10 @@ export MACOSX_DEPLOYMENT_TARGET="10.15"
100100
(
101101
if [ "${BUILD_TYPE}" = "debug" ]
102102
then
103-
OUTPUT_DIR="${OUTPUT_DIR}" cargo build --package ringrtc --bin direct --features=native,simnet
103+
OUTPUT_DIR="${OUTPUT_DIR}" cargo build --package ringrtc --bin direct --features=native,simnet${RINGRTC_ADM:+",ringrtc_adm"}
104104
echo "Can run with target/debug/direct"
105105
else
106-
OUTPUT_DIR="${OUTPUT_DIR}" cargo build --package ringrtc --bin direct --features=native,simnet --release
106+
OUTPUT_DIR="${OUTPUT_DIR}" cargo build --package ringrtc --bin direct --features=native,simnet${RINGRTC_ADM:+",ringrtc_adm"} --release
107107
echo "Can run with target/release/direct"
108108
fi
109109
)

bin/build-electron

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ then
219219
exit 1 # unreachable
220220
fi
221221

222-
RUSTFLAGS="${RUSTFLAGS}" OUTPUT_DIR="${OUTPUT_DIR}" cargo rustc --package ringrtc --target ${CARGO_TARGET} --features electron ${INCLUDE_RELEASE_FLAG:+"--release"} --crate-type cdylib
222+
RUSTFLAGS="${RUSTFLAGS}" OUTPUT_DIR="${OUTPUT_DIR}" cargo rustc --package ringrtc --target ${CARGO_TARGET} --features electron${RINGRTC_ADM:+",ringrtc_adm"} ${INCLUDE_RELEASE_FLAG:+"--release"} --crate-type cdylib
223223

224224
mkdir -p src/node/build/${DEFAULT_PLATFORM}
225225
copy_to_node target/${CARGO_TARGET}/${BUILD_TYPE}/${OUTPUT_LIBRARY} src/node/build/${DEFAULT_PLATFORM}/libringrtc-"${TARGET_ARCH}".node

bin/build-gctc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,10 @@ export MACOSX_DEPLOYMENT_TARGET="10.15"
100100
(
101101
if [ "${BUILD_TYPE}" = "debug" ]
102102
then
103-
OUTPUT_DIR="${OUTPUT_DIR}" cargo build --package ringrtc --bin group_call --features=native,sim_http
103+
OUTPUT_DIR="${OUTPUT_DIR}" cargo build --package ringrtc --bin group_call --features=native,sim_http${RINGRTC_ADM:+",ringrtc_adm"}
104104
echo "Can run with target/debug/group_call"
105105
else
106-
OUTPUT_DIR="${OUTPUT_DIR}" cargo build --package ringrtc --bin group_call --features=native,sim_http --release
106+
OUTPUT_DIR="${OUTPUT_DIR}" cargo build --package ringrtc --bin group_call --features=native,sim_http${RINGRTC_ADM:+",ringrtc_adm"} --release
107107
echo "Can run with target/release/group_call"
108108
fi
109109
)

src/rust/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ injectable_network = []
107107
sim_http = ["ureq", "rustls"]
108108
check-all = ["electron", "jni"]
109109
call_sim = ["call_protobuf/call_sim", "native", "injectable_network", "bitvec", "chrono", "clap", "fern", "tokio", "tonic", "tower"]
110+
ringrtc_adm = []
110111

111112
[[test]]
112113
name = "incoming"

src/rust/src/webrtc/peer_connection_factory.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ pub enum RffiAudioDeviceModuleType {
131131
Default,
132132
/// Use a file-based ADM for testing and simulation.
133133
File,
134+
/// Use RingRTC's ADM implementation.
135+
RingRtc,
134136
}
135137

136138
/// Stays in sync with RffiAudioConfig in peer_connection_factory.h.
@@ -164,7 +166,10 @@ pub struct AudioConfig {
164166
impl Default for AudioConfig {
165167
fn default() -> Self {
166168
Self {
169+
#[cfg(not(feature = "ringrtc_adm"))]
167170
audio_device_module_type: Default::default(),
171+
#[cfg(feature = "ringrtc_adm")]
172+
audio_device_module_type: RffiAudioDeviceModuleType::RingRtc,
168173
file_based_adm_config: None,
169174
high_pass_filter_enabled: true,
170175
aec_enabled: true,

0 commit comments

Comments
 (0)