feat: add ffi datachannel & mute events (#88)

This commit is contained in:
Théo Monnom
2023-06-18 22:45:05 +02:00
committed by GitHub
parent 33dfcb27b0
commit 25f4c9a075
69 changed files with 1934 additions and 1546 deletions
+2 -119
View File
@@ -841,7 +841,7 @@ dependencies = [
"futures-sink",
"nanorand",
"pin-project",
"spin 0.9.8",
"spin",
]
[[package]]
@@ -1481,15 +1481,14 @@ dependencies = [
"lazy_static",
"livekit-protocol",
"livekit-webrtc",
"log",
"parking_lot",
"prost",
"serde",
"serde_json",
"thiserror",
"tokio",
"tokio-stream",
"tokio-tungstenite",
"tracing",
"url",
]
@@ -2352,21 +2351,6 @@ dependencies = [
"winreg",
]
[[package]]
name = "ring"
version = "0.16.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc"
dependencies = [
"cc",
"libc",
"once_cell",
"spin 0.5.2",
"untrusted",
"web-sys",
"winapi",
]
[[package]]
name = "rustc-demangle"
version = "0.1.23"
@@ -2393,49 +2377,6 @@ dependencies = [
"windows-sys 0.48.0",
]
[[package]]
name = "rustls"
version = "0.21.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c911ba11bc8433e811ce56fde130ccf32f5127cab0e0194e9c68c5a5b671791e"
dependencies = [
"log",
"ring",
"rustls-webpki",
"sct",
]
[[package]]
name = "rustls-native-certs"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0167bac7a9f490495f3c33013e7722b53cb087ecbe082fb0c6387c96f634ea50"
dependencies = [
"openssl-probe",
"rustls-pemfile",
"schannel",
"security-framework",
]
[[package]]
name = "rustls-pemfile"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b"
dependencies = [
"base64",
]
[[package]]
name = "rustls-webpki"
version = "0.100.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6207cd5ed3d8dca7816f8f3725513a34609c0c765bf652b8c3cb4cfd87db46b"
dependencies = [
"ring",
"untrusted",
]
[[package]]
name = "ryu"
version = "1.0.13"
@@ -2489,16 +2430,6 @@ version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1"
[[package]]
name = "sct"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4"
dependencies = [
"ring",
"untrusted",
]
[[package]]
name = "sctk-adwaita"
version = "0.5.4"
@@ -2687,12 +2618,6 @@ dependencies = [
"winapi",
]
[[package]]
name = "spin"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
[[package]]
name = "spin"
version = "0.9.8"
@@ -2928,27 +2853,6 @@ dependencies = [
"tokio",
]
[[package]]
name = "tokio-rustls"
version = "0.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e0d409377ff5b1e3ca6437aa86c1eb7d40c134bfec254e44c830defa92669db5"
dependencies = [
"rustls",
"tokio",
]
[[package]]
name = "tokio-stream"
version = "0.1.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842"
dependencies = [
"futures-core",
"pin-project-lite",
"tokio",
]
[[package]]
name = "tokio-tungstenite"
version = "0.19.0"
@@ -2957,10 +2861,7 @@ checksum = "ec509ac96e9a0c43427c74f003127d953a265737636129424288d27cb5c4b12c"
dependencies = [
"futures-util",
"log",
"rustls",
"rustls-native-certs",
"tokio",
"tokio-rustls",
"tungstenite",
]
@@ -3084,12 +2985,10 @@ dependencies = [
"httparse",
"log",
"rand",
"rustls",
"sha1",
"thiserror",
"url",
"utf-8",
"webpki",
]
[[package]]
@@ -3140,12 +3039,6 @@ version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
[[package]]
name = "untrusted"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"
[[package]]
name = "url"
version = "2.3.1"
@@ -3379,16 +3272,6 @@ dependencies = [
"web-sys",
]
[[package]]
name = "webpki"
version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd"
dependencies = [
"ring",
"untrusted",
]
[[package]]
name = "webrtc-sys"
version = "0.1.1"
+1 -1
View File
@@ -11,7 +11,7 @@ async fn main() {
let url = env::var("LIVEKIT_URL").expect("LIVEKIT_URL is not set");
let token = env::var("LIVEKIT_TOKEN").expect("LIVEKIT_TOKEN is not set");
let (room, mut rx) = Room::connect(&url, &token).await.unwrap();
let (room, mut rx) = Room::connect(&url, &token, RoomOptions::default()).await.unwrap();
log::info!("Connected to room: {} - {}", room.name(), room.sid());
while let Some(msg) = rx.recv().await {
+3 -1
View File
@@ -89,7 +89,9 @@ async fn main() {
let url = env::var("LIVEKIT_URL").expect("LIVEKIT_URL is not set");
let token = env::var("LIVEKIT_TOKEN").expect("LIVEKIT_TOKEN is not set");
let (room, mut rx) = Room::connect(&url, &token).await.unwrap();
let (room, mut rx) = Room::connect(&url, &token, RoomOptions::default())
.await
.unwrap();
println!("Connected to room: {} - {}", room.name(), room.sid());
while let Some(msg) = rx.recv().await {
+1 -1
View File
@@ -11,7 +11,7 @@ livekit = { path = "../../livekit", version = "0.1.1" }
futures = "0.3"
wgpu = "0.16"
winit = "0.28"
parking_lot = "0.12.1"
parking_lot = { version = "0.12.1", features=["send_guard"] }
image = "0.24"
egui = { git = "https://github.com/emilk/egui" }
egui-wgpu = { git = "https://github.com/emilk/egui", features = ["winit"] }
+1 -1
View File
@@ -106,7 +106,7 @@ pub fn run(rt: tokio::runtime::Runtime) {
AsyncCmd::RoomConnect { url, token } => {
state.connecting.store(true, Ordering::SeqCst);
let res = Room::connect(&url, &token).await;
let res = Room::connect(&url, &token, RoomOptions::default()).await;
if let Ok((room, room_events)) = res {
let room = Arc::new(room);
let (close_tx, close_rx) = oneshot::channel();
+4 -4
View File
@@ -1,7 +1,8 @@
use image::ImageFormat;
use image::RgbaImage;
use livekit::options::{TrackPublishOptions, VideoCaptureOptions};
use livekit::options::TrackPublishOptions;
use livekit::prelude::*;
use livekit::webrtc::video_source::RtcVideoSource;
use livekit::webrtc::{
native::yuv_helper,
video_frame::native::I420BufferExt,
@@ -61,8 +62,7 @@ impl LogoTrack {
let (close_tx, close_rx) = oneshot::channel();
let track = LocalVideoTrack::create_video_track(
"livekit_logo",
VideoCaptureOptions::default(),
self.rtc_source.clone(),
RtcVideoSource::Native(self.rtc_source.clone()),
);
let task = tokio::spawn(Self::track_task(close_rx, self.rtc_source.clone()));
@@ -118,7 +118,7 @@ impl LogoTrack {
video_frame: Arc::new(Mutex::new(VideoFrame {
rotation: VideoRotation::VideoRotation0,
buffer: I420Buffer::new(FB_WIDTH as u32, FB_HEIGHT as u32),
timestamp: 0,
timestamp_us: 0,
})),
pos: (0, 0),
direction: (1, 1),
+3 -7
View File
@@ -1,5 +1,6 @@
use livekit::options::{AudioCaptureOptions, TrackPublishOptions};
use livekit::options::TrackPublishOptions;
use livekit::webrtc::audio_frame::AudioFrame;
use livekit::webrtc::audio_source::RtcAudioSource;
use livekit::{prelude::*, webrtc::audio_source::native::NativeAudioSource};
use std::sync::Arc;
use std::time::Duration;
@@ -54,12 +55,7 @@ impl SineTrack {
let (close_tx, close_rx) = oneshot::channel();
let track = LocalAudioTrack::create_audio_track(
"sine_wave",
AudioCaptureOptions {
auto_gain_control: false,
echo_cancellation: false,
noise_suppression: false,
},
self.rtc_source.clone(),
RtcAudioSource::Native(self.rtc_source.clone()),
);
let task = tokio::spawn(Self::track_task(close_rx, self.rtc_source.clone()));