* Create README.md * add example * crates & examples * fix syntax * add LICENSE * thirdparty LICENSE * rearrange repo * fix build * egui versions * prepare publish * fix demo compilation * add test ci * Update rust.yml * forgot runs-on * install protoc before building * avoid rate limit * include submodules * updates to readme * cache rust builds Co-authored-by: David Zhao <[email protected]> Co-authored-by: David Zhao <[email protected]>
38 lines
903 B
Rust
38 lines
903 B
Rust
use std::fmt::{Debug, Formatter};
|
|
|
|
use tracing::trace;
|
|
|
|
use livekit_webrtc::peer_connection_factory::PeerConnectionFactory;
|
|
use livekit_webrtc::webrtc::RTCRuntime;
|
|
|
|
/// SAFETY: The order of initialization and deletion is important for LKRuntime.
|
|
/// See the C++ constructors & destructors of these fields
|
|
|
|
pub struct LKRuntime {
|
|
pub pc_factory: PeerConnectionFactory,
|
|
pub rtc_runtime: RTCRuntime,
|
|
}
|
|
|
|
impl Debug for LKRuntime {
|
|
fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
|
|
write!(f, "LKRuntime")
|
|
}
|
|
}
|
|
|
|
impl Default for LKRuntime {
|
|
fn default() -> Self {
|
|
trace!("LKRuntime::default()");
|
|
let rtc_runtime = RTCRuntime::new();
|
|
Self {
|
|
pc_factory: PeerConnectionFactory::new(rtc_runtime.clone()),
|
|
rtc_runtime,
|
|
}
|
|
}
|
|
}
|
|
|
|
impl Drop for LKRuntime {
|
|
fn drop(&mut self) {
|
|
trace!("LKRuntime::drop()");
|
|
}
|
|
}
|