Skip to content

Commit

Permalink
Fix occasional-crash bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
mutexlox-signal authored Dec 9, 2024
1 parent 9eec8cf commit 517e1c9
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/rust/src/webrtc/peer_connection_factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,17 +205,20 @@ impl AudioConfig {
};

#[cfg(all(not(feature = "sim"), feature = "native"))]
let (adm_borrowed, backend_name) = {
let mut adm = AudioDeviceModule::new();
// Initialize the ADM here. This isn't strictly necessary, but allows
// us to log the backend name (e.g. audiounit vs audiounit-rust).
adm.init();
let backend_name = adm.backend_name();
(
webrtc::ptr::Borrowed::from_ptr(Box::into_raw(Box::new(adm))).to_void(),
backend_name,
)
};
let (adm_borrowed, backend_name) =
if self.audio_device_module_type == RffiAudioDeviceModuleType::RingRtc {
let mut adm = AudioDeviceModule::new();
// Initialize the ADM here. This isn't strictly necessary, but allows
// us to log the backend name (e.g. audiounit vs audiounit-rust).
adm.init();
let backend_name = adm.backend_name();
(
webrtc::ptr::Borrowed::from_ptr(Box::into_raw(Box::new(adm))).to_void(),
backend_name,
)
} else {
(webrtc::ptr::Borrowed::null(), None)
};
#[cfg(any(feature = "sim", not(feature = "native")))]
let backend_name = None;

Expand Down

0 comments on commit 517e1c9

Please sign in to comment.