diff --git a/Cargo.lock b/Cargo.lock index fe5be1c..0dd70ea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -484,6 +484,7 @@ name = "livekit" version = "0.1.0" dependencies = [ "livekit-core", + "livekit-webrtc", ] [[package]] @@ -493,6 +494,7 @@ dependencies = [ "futures", "futures-util", "lazy_static", + "livekit-utils", "livekit-webrtc", "parking_lot", "prost", @@ -507,6 +509,10 @@ dependencies = [ "url", ] +[[package]] +name = "livekit-utils" +version = "0.1.0" + [[package]] name = "livekit-webrtc" version = "0.1.0" @@ -514,6 +520,7 @@ dependencies = [ "cxx", "env_logger", "libwebrtc-sys", + "livekit-utils", "log", "thiserror", "tokio", diff --git a/Cargo.toml b/Cargo.toml index 5e5d1fa..36613eb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,8 +9,10 @@ exclude = ["libwebrtc"] members = [ "crates/livekit-core", "crates/livekit-webrtc", + "crates/livekit-utils", "crates/livekit-webrtc/libwebrtc-sys" ] [dependencies] livekit-core = { path = "crates/livekit-core" } +livekit-webrtc = { path = "crates/livekit-webrtc" } diff --git a/crates/livekit-core/Cargo.toml b/crates/livekit-core/Cargo.toml index 3cf11f7..09f9c3a 100644 --- a/crates/livekit-core/Cargo.toml +++ b/crates/livekit-core/Cargo.toml @@ -5,6 +5,8 @@ edition = "2021" license = "Apache-2.0" [dependencies] +livekit-webrtc = { path = "../livekit-webrtc" } +livekit-utils = { path = "../livekit-utils" } serde = { version = "1", features = ["derive"] } serde_json = "1.0" tokio-tungstenite = { version = "0.17.2", features = ["native-tls"] } @@ -16,7 +18,6 @@ futures-util = "0.3.23" thiserror = "1.0" prost = "0.11.0" prost-types = "0.11.1" -livekit-webrtc = { path = "../livekit-webrtc" } lazy_static = "1.4.0" tracing = "0.1" diff --git a/crates/livekit-core/src/lib.rs b/crates/livekit-core/src/lib.rs index a9770a7..cbdb92a 100644 --- a/crates/livekit-core/src/lib.rs +++ b/crates/livekit-core/src/lib.rs @@ -7,6 +7,5 @@ pub mod proto { mod events; mod rtc_engine; mod signal_client; -mod utils; pub mod room; diff --git a/crates/livekit-core/src/room/participant/mod.rs b/crates/livekit-core/src/room/participant/mod.rs index 56c7da2..49b6f0d 100644 --- a/crates/livekit-core/src/room/participant/mod.rs +++ b/crates/livekit-core/src/room/participant/mod.rs @@ -4,8 +4,8 @@ use crate::room::id::{ParticipantIdentity, ParticipantSid, TrackSid}; use crate::room::participant::local_participant::LocalParticipant; use crate::room::participant::remote_participant::RemoteParticipant; use crate::room::publication::{TrackPublication, TrackPublicationTrait}; -use crate::utils::wrap_variants; use futures_util::future::BoxFuture; +use livekit_utils::enum_dispatch; use parking_lot::{Mutex, RwLock}; use std::collections::HashMap; use std::sync::Arc; @@ -74,7 +74,7 @@ pub enum ParticipantHandle { } impl ParticipantHandle { - // TODO(theomonnom): Add async support to wrap_variants ... + // TODO(theomonnom): Add async support to wrap_variants ... pub(crate) async fn update_info(&self, info: ParticipantInfo) { match self { Self::Local(inner) => inner.clone().update_info(info).await, @@ -84,20 +84,20 @@ impl ParticipantHandle { } impl ParticipantInternalTrait for ParticipantHandle { - wrap_variants!( + enum_dispatch!( [Local, Remote] - fnc!(internal_events, Arc, []); + fnc!(internal_events, &Self, [], Arc); ); } impl ParticipantTrait for ParticipantHandle { - wrap_variants!( + enum_dispatch!( [Local, Remote] - fnc!(events, Arc, []); - fnc!(sid, ParticipantSid, []); - fnc!(identity, ParticipantIdentity, []); - fnc!(name, String, []); - fnc!(metadata, String, []); + fnc!(events, &Self, [], Arc); + fnc!(sid, &Self, [], ParticipantSid); + fnc!(identity, &Self, [], ParticipantIdentity); + fnc!(name, &Self, [], String); + fnc!(metadata, &Self, [], String); ); } diff --git a/crates/livekit-core/src/room/publication/mod.rs b/crates/livekit-core/src/room/publication/mod.rs index 1820e88..547e825 100644 --- a/crates/livekit-core/src/room/publication/mod.rs +++ b/crates/livekit-core/src/room/publication/mod.rs @@ -5,7 +5,7 @@ use crate::room::id::TrackSid; use crate::room::track::local_track::LocalTrackHandle; use crate::room::track::remote_track::RemoteTrackHandle; use crate::room::track::{TrackHandle, TrackKind, TrackSource}; -use crate::utils::wrap_variants; +use livekit_utils::enum_dispatch; use parking_lot::Mutex; use std::sync::atomic::{AtomicBool, AtomicU8, Ordering}; use std::sync::Arc; @@ -38,7 +38,11 @@ pub(super) struct TrackPublicationShared { } impl TrackPublicationShared { - pub fn new(info: TrackInfo, participant: ParticipantSid, track: Option) -> Arc { + pub fn new( + info: TrackInfo, + participant: ParticipantSid, + track: Option, + ) -> Arc { Arc::new(Self { track: Mutex::new(track), name: Mutex::new(info.name), @@ -88,21 +92,21 @@ impl TrackPublication { } impl TrackPublicationInternalTrait for TrackPublication { - wrap_variants!( + enum_dispatch!( [Local, Remote] - fnc!(update_track, (), [track: Option]); - fnc!(update_info, (), [info: TrackInfo]); + fnc!(update_track, &Self, [track: Option], ()); + fnc!(update_info, &Self, [info: TrackInfo], ()); ); } impl TrackPublicationTrait for TrackPublication { - wrap_variants!( + enum_dispatch!( [Local, Remote] - fnc!(sid, TrackSid, []); - fnc!(name, String, []); - fnc!(kind, TrackKind, []); - fnc!(source, TrackSource, []); - fnc!(simulcasted, bool, []); + fnc!(sid, &Self, [], TrackSid); + fnc!(name, &Self, [], String); + fnc!(kind, &Self, [], TrackKind); + fnc!(source, &Self, [], TrackSource); + fnc!(simulcasted, &Self, [], bool); ); } diff --git a/crates/livekit-core/src/room/track/mod.rs b/crates/livekit-core/src/room/track/mod.rs index 327084f..ad9e218 100644 --- a/crates/livekit-core/src/room/track/mod.rs +++ b/crates/livekit-core/src/room/track/mod.rs @@ -4,7 +4,7 @@ use crate::room::track::local_audio_track::LocalAudioTrack; use crate::room::track::local_video_track::LocalVideoTrack; use crate::room::track::remote_audio_track::RemoteAudioTrack; use crate::room::track::remote_video_track::RemoteVideoTrack; -use crate::utils::wrap_variants; +use livekit_utils::enum_dispatch; use livekit_webrtc::media_stream::{MediaStreamTrackHandle, MediaStreamTrackTrait}; use parking_lot::Mutex; use std::sync::atomic::AtomicU8; @@ -150,14 +150,14 @@ pub enum TrackHandle { } impl TrackTrait for TrackHandle { - wrap_variants!( + enum_dispatch!( [LocalVideo, LocalAudio, RemoteVideo, RemoteAudio] - fnc!(sid, TrackSid, []); - fnc!(name, String, []); - fnc!(kind, TrackKind, []); - fnc!(stream_state, StreamState, []); - fnc!(start, (), []); - fnc!(stop, (), []); + fnc!(sid, &Self, [], TrackSid); + fnc!(name, &Self, [], String); + fnc!(kind, &Self, [], TrackKind); + fnc!(stream_state, &Self, [], StreamState); + fnc!(start, &Self, [], ()); + fnc!(stop, &Self, [], ()); ); } diff --git a/crates/livekit-core/src/room/track/remote_track.rs b/crates/livekit-core/src/room/track/remote_track.rs index 591b443..81e53ea 100644 --- a/crates/livekit-core/src/room/track/remote_track.rs +++ b/crates/livekit-core/src/room/track/remote_track.rs @@ -5,7 +5,7 @@ use crate::room::id::TrackSid; use crate::room::track::remote_audio_track::RemoteAudioTrack; use crate::room::track::remote_video_track::RemoteVideoTrack; use crate::room::track::TrackHandle; -use crate::utils::wrap_variants; +use livekit_utils::enum_dispatch; use super::TrackTrait; @@ -16,14 +16,14 @@ pub enum RemoteTrackHandle { } impl TrackTrait for RemoteTrackHandle { - wrap_variants!( + enum_dispatch!( [Audio, Video] - fnc!(sid, TrackSid, []); - fnc!(name, String, []); - fnc!(kind, TrackKind, []); - fnc!(stream_state, StreamState, []); - fnc!(start, (), []); - fnc!(stop, (), []); + fnc!(sid, &Self, [], TrackSid); + fnc!(name, &Self, [], String); + fnc!(kind, &Self, [], TrackKind); + fnc!(stream_state, &Self, [], StreamState); + fnc!(start, &Self, [], ()); + fnc!(stop, &Self, [], ()); ); } diff --git a/crates/livekit-utils/Cargo.toml b/crates/livekit-utils/Cargo.toml new file mode 100644 index 0000000..27b9ca7 --- /dev/null +++ b/crates/livekit-utils/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "livekit-utils" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/crates/livekit-core/src/utils.rs b/crates/livekit-utils/src/enum_dispatch.rs similarity index 51% rename from crates/livekit-core/src/utils.rs rename to crates/livekit-utils/src/enum_dispatch.rs index c250092..c7f59df 100644 --- a/crates/livekit-core/src/utils.rs +++ b/crates/livekit-utils/src/enum_dispatch.rs @@ -1,4 +1,5 @@ -macro_rules! wrap_variants { +#[macro_export] +macro_rules! enum_dispatch { // This arm is used to avoid nested loops with the arguments // The arguments are transformed to $combined_args TokenTree (@match $self:ident $fnc:ident $combined_args:tt [$($variant:ident),+]) => { @@ -9,18 +10,16 @@ macro_rules! wrap_variants { } }; - ($fnc:ident, $ret:ty, [$($arg:ident: $t:ty),*], [$($variant:ident),+]) => { - fn $fnc(&self, $($arg: $t),*) -> $ret { - wrap_variants!(@match self $fnc ($($arg,)*) [$($variant),+]) + ($fnc:ident, $self:ty, [$($arg:ident: $t:ty),*], $ret:ty, [$($variant:ident),+]) => { + fn $fnc(self: $self, $($arg: $t),*) -> $ret { + enum_dispatch!(@match self $fnc ($($arg,)*) [$($variant),+]) } }; - ($variants:tt $(fnc!($fnc:ident, $ret:ty, $args:tt);)+) => { + ($variants:tt $(fnc!($fnc:ident, $self:ty, $args:tt, $ret:ty);)+) => { $( - wrap_variants!($fnc, $ret, $args, $variants); + enum_dispatch!($fnc, $self, $args, $ret, $variants); )* }; } -pub(crate) use wrap_variants; - diff --git a/crates/livekit-utils/src/lib.rs b/crates/livekit-utils/src/lib.rs new file mode 100644 index 0000000..f328b57 --- /dev/null +++ b/crates/livekit-utils/src/lib.rs @@ -0,0 +1 @@ +pub mod enum_dispatch; diff --git a/crates/livekit-webrtc/Cargo.toml b/crates/livekit-webrtc/Cargo.toml index c9264ff..0de0d93 100644 --- a/crates/livekit-webrtc/Cargo.toml +++ b/crates/livekit-webrtc/Cargo.toml @@ -6,10 +6,11 @@ homepage = "https://livekit.io" [dependencies] libwebrtc-sys = { path = "./libwebrtc-sys" } +livekit-utils = { path = "../livekit-utils" } tokio = { version = "1", features = ["full"] } cxx = "1.0" log = "0.4" thiserror = "1.0" [dev-dependencies] -env_logger = "0.9" \ No newline at end of file +env_logger = "0.9" diff --git a/crates/livekit-webrtc/libwebrtc-sys/.gitignore b/crates/livekit-webrtc/libwebrtc-sys/.gitignore index 1a2f000..3aa1f00 100644 --- a/crates/livekit-webrtc/libwebrtc-sys/.gitignore +++ b/crates/livekit-webrtc/libwebrtc-sys/.gitignore @@ -1,2 +1 @@ -/libwebrtc /cmake-build-debug \ No newline at end of file diff --git a/crates/livekit-webrtc/libwebrtc-sys/build.rs b/crates/livekit-webrtc/libwebrtc-sys/build.rs index b1fdd96..377958a 100644 --- a/crates/livekit-webrtc/libwebrtc-sys/build.rs +++ b/crates/livekit-webrtc/libwebrtc-sys/build.rs @@ -55,17 +55,17 @@ fn main() { let target_os = "windows"; //let target_arch = "arm64"; - let libwebrtc_dir = path::PathBuf::from("libwebrtc"); + let libwebrtc_dir = path::PathBuf::from("libwebrtc/src"); // Just required for the bridge build to succeed. let includes = &[ path::PathBuf::from("./include"), - libwebrtc_dir.join("include/"), - libwebrtc_dir.join("include/third_party/abseil-cpp/"), - libwebrtc_dir.join("include/third_party/libc++/"), + libwebrtc_dir.clone(), + libwebrtc_dir.join("third_party/abseil-cpp/"), + libwebrtc_dir.join("third_party/libc++/"), // For mac & ios - libwebrtc_dir.join("include/sdk/objc"), - libwebrtc_dir.join("include/sdk/objc/base"), + libwebrtc_dir.join("sdk/objc"), + libwebrtc_dir.join("sdk/objc/base"), ]; let mut builder = cxx_build::bridges(&[ @@ -81,6 +81,7 @@ fn main() { "src/webrtc.rs", "src/video_frame.rs", "src/video_frame_buffer.rs", + "src/yuv_helper.rs", ]); builder.file("src/peer_connection.cpp"); @@ -100,7 +101,12 @@ fn main() { println!( "cargo:rustc-link-search=native={}", - libwebrtc_dir.canonicalize().unwrap().to_str().unwrap() + libwebrtc_dir + .join("out/Default/obj") + .canonicalize() + .unwrap() + .to_str() + .unwrap() ); match target_os { @@ -124,6 +130,7 @@ fn main() { .flag("/std:c++17") .flag("/EHsc") .define("WEBRTC_WIN", None) + //.define("WEBRTC_ENABLE_SYMBOL_EXPORT", None) Not necessary when using WebRTC as a static library .define("NOMINMAX", None); } "macos" => { diff --git a/crates/livekit-webrtc/libwebrtc-sys/compile_flags.txt b/crates/livekit-webrtc/libwebrtc-sys/compile_flags.txt index e0fb4f0..1a76a73 100644 --- a/crates/livekit-webrtc/libwebrtc-sys/compile_flags.txt +++ b/crates/livekit-webrtc/libwebrtc-sys/compile_flags.txt @@ -1,8 +1,8 @@ -xc++ -std=c++17 -Iinclude --Ilibwebrtc/include --Ilibwebrtc/include/third_party/abseil-cpp --Ilibwebrtc/include/third_party/libc++ +-Ilibwebrtc/src +-Ilibwebrtc/src/third_party/abseil-cpp +-Ilibwebrtc/src/third_party/libc++ -I../../../target/cxxbridge -DWEBRTC_WIN diff --git a/crates/livekit-webrtc/libwebrtc-sys/include/livekit/yuv_helper.h b/crates/livekit-webrtc/libwebrtc-sys/include/livekit/yuv_helper.h new file mode 100644 index 0000000..1378cdd --- /dev/null +++ b/crates/livekit-webrtc/libwebrtc-sys/include/livekit/yuv_helper.h @@ -0,0 +1,30 @@ +// +// Created by Théo Monnom on 01/12/2022. +// + +#ifndef CLIENT_SDK_NATIVE_YUV_HELPER_H +#define CLIENT_SDK_NATIVE_YUV_HELPER_H + +#include + +#include "api/video/yuv_helper.h" + +namespace livekit { + +static void i420_to_abgr(const uint8_t* src_y, + int src_stride_y, + const uint8_t* src_u, + int src_stride_u, + const uint8_t* src_v, + int src_stride_v, + uint8_t* dst_rgba, + int dst_stride_abgr, + int width, + int height) { + webrtc::I420ToABGR(src_y, src_stride_y, src_u, src_stride_u, src_v, + src_stride_v, dst_rgba, dst_stride_abgr, width, height); +} + +} // namespace livekit + +#endif // CLIENT_SDK_NATIVE_YUV_HELPER_H diff --git a/crates/livekit-webrtc/libwebrtc-sys/libwebrtc/.gclient b/crates/livekit-webrtc/libwebrtc-sys/libwebrtc/.gclient new file mode 100644 index 0000000..b58c202 --- /dev/null +++ b/crates/livekit-webrtc/libwebrtc-sys/libwebrtc/.gclient @@ -0,0 +1,11 @@ +solutions = [ + { + "name" : 'src', + "url" : 'https://github.com/webrtc-sdk/webrtc.git', + "deps_file" : 'DEPS', + "managed" : False, + "custom_deps" : { + }, + "custom_vars": {}, + }, +] diff --git a/crates/livekit-webrtc/libwebrtc-sys/libwebrtc/.gitignore b/crates/livekit-webrtc/libwebrtc-sys/libwebrtc/.gitignore new file mode 100644 index 0000000..2ec6974 --- /dev/null +++ b/crates/livekit-webrtc/libwebrtc-sys/libwebrtc/.gitignore @@ -0,0 +1,3 @@ +.cipd +src +.gclient_* diff --git a/crates/livekit-webrtc/libwebrtc-sys/libwebrtc/compile.py b/crates/livekit-webrtc/libwebrtc-sys/libwebrtc/compile.py new file mode 100644 index 0000000..7119707 --- /dev/null +++ b/crates/livekit-webrtc/libwebrtc-sys/libwebrtc/compile.py @@ -0,0 +1,19 @@ +import subprocess + +GN_ARGS = [ + "is_debug=false", + "treat_warnings_as_errors=false", + 'target_os="win"', + 'target_cpu="x64"', + "rtc_include_tests=false", + "rtc_use_h264=false", + "is_component_build=false", + "rtc_build_examples=false", + "use_rtti=true", + "rtc_build_tools=false", + "use_custom_libcxx=false", + "strip_debug_info=true", + "symbol_level=0" +] + +subprocess.call(["gn", "gen", "out/Default", "--args=" + ' '.join(GN_ARGS)], shell=True) diff --git a/crates/livekit-webrtc/libwebrtc-sys/src/lib.rs b/crates/livekit-webrtc/libwebrtc-sys/src/lib.rs index ab6e52a..a2abebd 100644 --- a/crates/livekit-webrtc/libwebrtc-sys/src/lib.rs +++ b/crates/livekit-webrtc/libwebrtc-sys/src/lib.rs @@ -10,6 +10,7 @@ pub mod rtp_transceiver; pub mod video_frame; pub mod video_frame_buffer; pub mod webrtc; +pub mod yuv_helper; pub const MEDIA_TYPE_VIDEO: &str = "video"; pub const MEDIA_TYPE_AUDIO: &str = "audio"; diff --git a/crates/livekit-webrtc/libwebrtc-sys/src/yuv_helper.rs b/crates/livekit-webrtc/libwebrtc-sys/src/yuv_helper.rs new file mode 100644 index 0000000..69da044 --- /dev/null +++ b/crates/livekit-webrtc/libwebrtc-sys/src/yuv_helper.rs @@ -0,0 +1,19 @@ +#[cxx::bridge(namespace = "livekit")] +pub mod ffi { + unsafe extern "C++" { + include!("livekit/yuv_helper.h"); + + unsafe fn i420_to_abgr( + src_y: *const u8, + src_stride_y: i32, + src_u: *const u8, + src_stride_u: i32, + src_v: *const u8, + src_stride_v: i32, + dst_abgr: *mut u8, + dst_stride_abgr: i32, + width: i32, + height: i32, + ); + } +} diff --git a/crates/livekit-webrtc/src/lib.rs b/crates/livekit-webrtc/src/lib.rs index 684388d..951b6ac 100644 --- a/crates/livekit-webrtc/src/lib.rs +++ b/crates/livekit-webrtc/src/lib.rs @@ -9,3 +9,4 @@ pub mod rtp_transceiver; pub mod video_frame; pub mod video_frame_buffer; pub mod webrtc; +pub mod yuv_helper; diff --git a/crates/livekit-webrtc/src/video_frame_buffer.rs b/crates/livekit-webrtc/src/video_frame_buffer.rs index 64cf28d..c85a123 100644 --- a/crates/livekit-webrtc/src/video_frame_buffer.rs +++ b/crates/livekit-webrtc/src/video_frame_buffer.rs @@ -1,5 +1,6 @@ use cxx::UniquePtr; use libwebrtc_sys::video_frame_buffer as vfb_sys; +use livekit_utils::enum_dispatch; use std::pin::Pin; use std::slice; use vfb_sys::ffi::VideoFrameBufferType; @@ -53,6 +54,15 @@ impl VideoFrameBuffer { } } +impl VideoFrameBufferTrait for VideoFrameBuffer { + enum_dispatch!( + [Native, I420, I420A, I422, I444, I010, NV12] + fnc!(width, &Self, [], i32); + fnc!(height, &Self, [], i32); + fnc!(to_i420, Self, [], I420Buffer); + ); +} + macro_rules! recursive_cast { ($ptr:expr $(, $fnc:ident)*) => { { @@ -146,21 +156,23 @@ macro_rules! impl_yuv8_buffer { fn data_y(&self) -> &[u8] { let ptr = recursive_cast!(&*self.cxx_handle $(, $cast)*); unsafe { - slice::from_raw_parts((*ptr).data_y(), self.stride_y().try_into().unwrap()) + slice::from_raw_parts((*ptr).data_y(), (self.width() * self.height()) as usize) } } fn data_u(&self) -> &[u8] { let ptr = recursive_cast!(&*self.cxx_handle $(, $cast)*); unsafe { - slice::from_raw_parts((*ptr).data_u(), self.stride_u().try_into().unwrap()) + let chroma_height = (self.height() + 1) / 2; + slice::from_raw_parts((*ptr).data_u(), (self.stride_u() * chroma_height) as usize) } } fn data_v(&self) -> &[u8] { let ptr = recursive_cast!(&*self.cxx_handle $(, $cast)*); unsafe { - slice::from_raw_parts((*ptr).data_v(), self.stride_v().try_into().unwrap()) + let chroma_height = (self.height() + 1) / 2; + slice::from_raw_parts((*ptr).data_v(), (self.stride_v() * chroma_height) as usize) } } } diff --git a/crates/livekit-webrtc/src/yuv_helper.rs b/crates/livekit-webrtc/src/yuv_helper.rs new file mode 100644 index 0000000..91a3f70 --- /dev/null +++ b/crates/livekit-webrtc/src/yuv_helper.rs @@ -0,0 +1,43 @@ +use std::convert::TryInto; + +use libwebrtc_sys::yuv_helper as yuv_sys; + +pub fn i420_to_abgr( + src_y: &[u8], + src_stride_y: i32, + src_u: &[u8], + src_stride_u: i32, + src_v: &[u8], + src_stride_v: i32, + dst_abgr: &mut [u8], + dst_stride_abgr: i32, + width: i32, + height: i32, +) { + // Assert minimum capacity for safety + let chroma_height = (height + 1) / 2; // the buffer should be padded? + let min_y: usize = (src_stride_y * height).try_into().unwrap(); + let min_u: usize = (src_stride_u * chroma_height).try_into().unwrap(); + let min_v: usize = (src_stride_v * chroma_height).try_into().unwrap(); + let min_abgr: usize = (dst_stride_abgr * height).try_into().unwrap(); + + assert!(src_y.len() >= min_y); + assert!(src_u.len() >= min_u); + assert!(src_v.len() >= min_v); + assert!(dst_abgr.len() >= min_abgr); + + unsafe { + yuv_sys::ffi::i420_to_abgr( + src_y.as_ptr(), + src_stride_y, + src_u.as_ptr(), + src_stride_u, + src_v.as_ptr(), + src_stride_v, + dst_abgr.as_mut_ptr(), + dst_stride_abgr, + width, + height, + ); + } +} diff --git a/examples/Cargo.lock b/examples/Cargo.lock index c82ce3c..35e7fa4 100644 --- a/examples/Cargo.lock +++ b/examples/Cargo.lock @@ -2,6 +2,50 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "ab_glyph" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dcdbc68024b653943864d436fe8a24b028095bc1cf91a8926f8241e4aaffe59" +dependencies = [ + "ab_glyph_rasterizer", + "owned_ttf_parser", +] + +[[package]] +name = "ab_glyph_rasterizer" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "330223a1aecc308757b9926e9391c9b47f8ef2dbd8aea9df88312aea18c5e8d6" + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "ahash" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +dependencies = [ + "getrandom", + "once_cell", + "version_check", +] + +[[package]] +name = "ahash" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf6ccdb167abbf410dcb915cabd428929d7f6a04980b54a11f26a39f1c7f7107" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", +] + [[package]] name = "aho-corasick" version = "0.7.19" @@ -11,6 +55,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + [[package]] name = "ansi_term" version = "0.12.1" @@ -26,6 +79,57 @@ version = "1.0.65" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98161a4e3e2184da77bb14f02184cdd111e83bbbcc9979dfee3c44b9a85f5602" +[[package]] +name = "arboard" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6041616acea41d67c4a984709ddab1587fd0b10efe5cc563fee954d2f011854" +dependencies = [ + "clipboard-win", + "log", + "objc", + "objc-foundation", + "objc_id", + "once_cell", + "parking_lot", + "thiserror", + "winapi", + "x11rb", +] + +[[package]] +name = "arrayref" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" + +[[package]] +name = "arrayvec" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" + +[[package]] +name = "arrayvec" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" + +[[package]] +name = "ash" +version = "0.37.1+1.3.235" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "911015c962d56e2e4052f40182ca5462ba60a3d2ff04e827c365a0ab3d65726d" +dependencies = [ + "libloading", +] + +[[package]] +name = "atomic_refcell" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73b5e5f48b927f04e952dedc932f31995a65a0bf65ec971c74436e51bf6e970d" + [[package]] name = "autocfg" version = "1.1.0" @@ -38,12 +142,33 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +[[package]] +name = "bit-set" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" + [[package]] name = "bitflags" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "block" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" + [[package]] name = "block-buffer" version = "0.10.3" @@ -53,6 +178,32 @@ dependencies = [ "generic-array", ] +[[package]] +name = "bumpalo" +version = "3.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" + +[[package]] +name = "bytemuck" +version = "1.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aaa3a8d9a1ca92e282c96a32d6511b695d7d994d1d102ba85d279f9b2756947f" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fe233b960f12f8007e3db2d136e3cb1c291bfd7396e384ee76025fc1a3932b4" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "byteorder" version = "1.4.3" @@ -65,18 +216,94 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" +[[package]] +name = "calloop" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bcf530afb40e45e14440701e5e996d7fd139e84a912a4d83a8d6a0fb3e58663" +dependencies = [ + "log", + "nix 0.25.0", + "slotmap", + "thiserror", + "vec_map", +] + [[package]] name = "cc" version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" +[[package]] +name = "cesu8" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" + [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "cfg_aliases" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" + +[[package]] +name = "clipboard-win" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4ab1b92798304eedc095b53942963240037c0516452cb11aeba709d420b2219" +dependencies = [ + "error-code", + "str-buf", + "winapi", +] + +[[package]] +name = "cmake" +version = "0.1.49" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db34956e100b30725f2eb215f90d4871051239535632f84fea3bc92722c66b7c" +dependencies = [ + "cc", +] + +[[package]] +name = "cocoa" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f425db7937052c684daec3bd6375c8abe2d146dca4b8b143d6db777c39138f3a" +dependencies = [ + "bitflags", + "block", + "cocoa-foundation", + "core-foundation", + "core-graphics", + "foreign-types 0.3.2", + "libc", + "objc", +] + +[[package]] +name = "cocoa-foundation" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ade49b65d560ca58c403a479bb396592b155c0185eada742ee323d1d68d6318" +dependencies = [ + "bitflags", + "block", + "core-foundation", + "core-graphics-types", + "foreign-types 0.3.2", + "libc", + "objc", +] + [[package]] name = "codespan-reporting" version = "0.11.1" @@ -87,6 +314,16 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "combine" +version = "4.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4" +dependencies = [ + "bytes", + "memchr", +] + [[package]] name = "core-foundation" version = "0.9.3" @@ -103,6 +340,43 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" +[[package]] +name = "core-graphics" +version = "0.22.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb" +dependencies = [ + "bitflags", + "core-foundation", + "core-graphics-types", + "foreign-types 0.3.2", + "libc", +] + +[[package]] +name = "core-graphics-types" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a68b68b3446082644c91ac778bf50cd4104bfb002b5a6a7c44cca5a2c70788b" +dependencies = [ + "bitflags", + "core-foundation", + "foreign-types 0.3.2", + "libc", +] + +[[package]] +name = "core-text" +version = "19.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d74ada66e07c1cefa18f8abfba765b486f250de2e4a999e5727fc0dd4b4a25" +dependencies = [ + "core-foundation", + "core-graphics", + "foreign-types 0.3.2", + "libc", +] + [[package]] name = "cpufeatures" version = "0.2.5" @@ -112,6 +386,38 @@ dependencies = [ "libc", ] +[[package]] +name = "crc32fast" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossfont" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21fd3add36ea31aba1520aa5288714dd63be506106753226d0eb387a93bc9c45" +dependencies = [ + "cocoa", + "core-foundation", + "core-foundation-sys", + "core-graphics", + "core-text", + "dwrote", + "foreign-types 0.5.0", + "freetype-rs", + "libc", + "log", + "objc", + "once_cell", + "pkg-config", + "servo-fontconfig", + "winapi", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -122,6 +428,12 @@ dependencies = [ "typenum", ] +[[package]] +name = "cty" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35" + [[package]] name = "cxx" version = "1.0.78" @@ -166,6 +478,52 @@ dependencies = [ "syn", ] +[[package]] +name = "d3d12" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "827914e1f53b1e0e025ecd3d967a7836b7bcb54520f90e21ef8df7b4d88a2759" +dependencies = [ + "bitflags", + "libloading", + "winapi", +] + +[[package]] +name = "darling" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +dependencies = [ + "darling_core", + "quote", + "syn", +] + [[package]] name = "digest" version = "0.10.5" @@ -176,12 +534,169 @@ dependencies = [ "crypto-common", ] +[[package]] +name = "dispatch" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" + +[[package]] +name = "dlib" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac1b7517328c04c2aa68422fc60a41b92208182142ed04a25879c26c8f878794" +dependencies = [ + "libloading", +] + +[[package]] +name = "downcast-rs" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" + +[[package]] +name = "dwrote" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439a1c2ba5611ad3ed731280541d36d2e9c4ac5e7fb818a27b604bdc5a6aa65b" +dependencies = [ + "lazy_static", + "libc", + "serde", + "serde_derive", + "winapi", + "wio", +] + +[[package]] +name = "egui" +version = "0.19.0" +source = "git+https://github.com/emilk/egui#0336816faf9f361e59ca77f99c19fcfa2bf7c993" +dependencies = [ + "ahash 0.8.2", + "epaint", + "nohash-hasher", + "tracing", +] + +[[package]] +name = "egui-wgpu" +version = "0.19.0" +source = "git+https://github.com/emilk/egui#0336816faf9f361e59ca77f99c19fcfa2bf7c993" +dependencies = [ + "bytemuck", + "egui", + "pollster", + "tracing", + "type-map", + "wgpu", + "winit", +] + +[[package]] +name = "egui-winit" +version = "0.19.0" +source = "git+https://github.com/emilk/egui#0336816faf9f361e59ca77f99c19fcfa2bf7c993" +dependencies = [ + "arboard", + "egui", + "instant", + "smithay-clipboard", + "tracing", + "webbrowser", + "winit", +] + +[[package]] +name = "egui_demo_lib" +version = "0.19.0" +source = "git+https://github.com/emilk/egui#0336816faf9f361e59ca77f99c19fcfa2bf7c993" +dependencies = [ + "egui", + "egui_extras", + "enum-map", + "tracing", + "unicode_names2", +] + +[[package]] +name = "egui_extras" +version = "0.19.0" +source = "git+https://github.com/emilk/egui#0336816faf9f361e59ca77f99c19fcfa2bf7c993" +dependencies = [ + "egui", +] + [[package]] name = "either" version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" +[[package]] +name = "emath" +version = "0.19.0" +source = "git+https://github.com/emilk/egui#0336816faf9f361e59ca77f99c19fcfa2bf7c993" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "enum-map" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5a56d54c8dd9b3ad34752ed197a4eb2a6601bc010808eb097a04a58ae4c43e1" +dependencies = [ + "enum-map-derive", + "serde", +] + +[[package]] +name = "enum-map-derive" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9045e2676cd5af83c3b167d917b0a5c90a4d8e266e2683d6631b235c457fc27" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "epaint" +version = "0.19.0" +source = "git+https://github.com/emilk/egui#0336816faf9f361e59ca77f99c19fcfa2bf7c993" +dependencies = [ + "ab_glyph", + "ahash 0.8.2", + "atomic_refcell", + "bytemuck", + "emath", + "nohash-hasher", + "parking_lot", +] + +[[package]] +name = "error-code" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64f18991e7bf11e7ffee451b5318b5c1a73c52d0d0ada6e5a3017c8c1ced6a21" +dependencies = [ + "libc", + "str-buf", +] + +[[package]] +name = "expat-sys" +version = "2.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "658f19728920138342f68408b7cf7644d90d4784353d8ebc32e7e8663dbe45fa" +dependencies = [ + "cmake", + "pkg-config", +] + [[package]] name = "fastrand" version = "1.8.0" @@ -197,6 +712,16 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" +[[package]] +name = "flate2" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + [[package]] name = "fnv" version = "1.0.7" @@ -209,7 +734,28 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" dependencies = [ - "foreign-types-shared", + "foreign-types-shared 0.1.1", +] + +[[package]] +name = "foreign-types" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" +dependencies = [ + "foreign-types-macros", + "foreign-types-shared 0.3.1", +] + +[[package]] +name = "foreign-types-macros" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8469d0d40519bc608ec6863f1cc88f3f1deee15913f2f3b3e573d81ed38cccc" +dependencies = [ + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -218,6 +764,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" +[[package]] +name = "foreign-types-shared" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" + [[package]] name = "form_urlencoded" version = "1.1.0" @@ -227,6 +779,28 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "freetype-rs" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74eadec9d0a5c28c54bb9882e54787275152a4e36ce206b45d7451384e5bf5fb" +dependencies = [ + "bitflags", + "freetype-sys", + "libc", +] + +[[package]] +name = "freetype-sys" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a37d4011c0cc628dfa766fcc195454f4b068d7afdc2adfd28861191d866e731a" +dependencies = [ + "cmake", + "libc", + "pkg-config", +] + [[package]] name = "futures" version = "0.3.24" @@ -316,6 +890,15 @@ dependencies = [ "slab", ] +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + [[package]] name = "generic-array" version = "0.14.6" @@ -326,6 +909,16 @@ dependencies = [ "version_check", ] +[[package]] +name = "gethostname" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1ebd34e35c46e00bb73e81363248d627782724609fe1b6396f553f68fe3862e" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "getrandom" version = "0.2.7" @@ -343,11 +936,65 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" +[[package]] +name = "glow" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8bd5877156a19b8ac83a29b2306fe20537429d318f3ff0a1a2119f8d9c61919" +dependencies = [ + "js-sys", + "slotmap", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gpu-alloc" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fc59e5f710e310e76e6707f86c561dd646f69a8876da9131703b2f717de818d" +dependencies = [ + "bitflags", + "gpu-alloc-types", +] + +[[package]] +name = "gpu-alloc-types" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54804d0d6bc9d7f26db4eaec1ad10def69b599315f487d32c334a80d1efe67a5" +dependencies = [ + "bitflags", +] + +[[package]] +name = "gpu-descriptor" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b0c02e1ba0bdb14e965058ca34e09c020f8e507a760df1121728e0aef68d57a" +dependencies = [ + "bitflags", + "gpu-descriptor-types", + "hashbrown", +] + +[[package]] +name = "gpu-descriptor-types" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "363e3677e55ad168fef68cf9de3a4a310b53124c5e784c53a1d70e92d23f2126" +dependencies = [ + "bitflags", +] + [[package]] name = "hashbrown" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash 0.7.6", +] [[package]] name = "heck" @@ -364,6 +1011,12 @@ dependencies = [ "libc", ] +[[package]] +name = "hexf-parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df" + [[package]] name = "http" version = "0.2.8" @@ -381,6 +1034,12 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "idna" version = "0.3.0" @@ -408,6 +1067,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", ] [[package]] @@ -425,6 +1087,46 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754" +[[package]] +name = "jni" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "039022cdf4d7b1cf548d31f60ae783138e5fd42013f6271049d7df7afadef96c" +dependencies = [ + "cesu8", + "combine", + "jni-sys", + "log", + "thiserror", + "walkdir", +] + +[[package]] +name = "jni-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" + +[[package]] +name = "js-sys" +version = "0.3.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "khronos-egl" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c2352bd1d0bceb871cb9d40f24360c8133c11d7486b68b5381c1dd1a32015e3" +dependencies = [ + "libc", + "libloading", + "pkg-config", +] + [[package]] name = "lazy_static" version = "1.4.0" @@ -437,6 +1139,16 @@ version = "0.2.134" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "329c933548736bc49fd575ee68c89e8be4d260064184389a5b77517cddd99ffb" +[[package]] +name = "libloading" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +dependencies = [ + "cfg-if", + "winapi", +] + [[package]] name = "libwebrtc-sys" version = "0.1.0" @@ -462,6 +1174,7 @@ name = "livekit" version = "0.1.0" dependencies = [ "livekit-core", + "livekit-webrtc", ] [[package]] @@ -471,6 +1184,7 @@ dependencies = [ "futures", "futures-util", "lazy_static", + "livekit-utils", "livekit-webrtc", "parking_lot", "prost", @@ -485,12 +1199,17 @@ dependencies = [ "url", ] +[[package]] +name = "livekit-utils" +version = "0.1.0" + [[package]] name = "livekit-webrtc" version = "0.1.0" dependencies = [ "cxx", "libwebrtc-sys", + "livekit-utils", "log", "thiserror", "tokio", @@ -515,12 +1234,68 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "malloc_buf" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" +dependencies = [ + "libc", +] + [[package]] name = "memchr" version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +[[package]] +name = "memmap2" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b182332558b18d807c4ce1ca8ca983b34c3ee32765e47b3f0f69b90355cc1dc" +dependencies = [ + "libc", +] + +[[package]] +name = "memoffset" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +dependencies = [ + "autocfg", +] + +[[package]] +name = "metal" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de11355d1f6781482d027a3b4d4de7825dcedb197bf573e0596d00008402d060" +dependencies = [ + "bitflags", + "block", + "core-graphics-types", + "foreign-types 0.3.2", + "log", + "objc", +] + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" +dependencies = [ + "adler", +] + [[package]] name = "mio" version = "0.8.4" @@ -539,6 +1314,26 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" +[[package]] +name = "naga" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "262d2840e72dbe250e8cf2f522d080988dfca624c4112c096238a4845f591707" +dependencies = [ + "bit-set", + "bitflags", + "codespan-reporting", + "hexf-parse", + "indexmap", + "log", + "num-traits", + "rustc-hash", + "spirv", + "termcolor", + "thiserror", + "unicode-xid", +] + [[package]] name = "native-tls" version = "0.2.10" @@ -557,6 +1352,114 @@ dependencies = [ "tempfile", ] +[[package]] +name = "ndk" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "451422b7e4718271c8b5b3aadf5adedba43dc76312454b387e98fae0fc951aa0" +dependencies = [ + "bitflags", + "jni-sys", + "ndk-sys", + "num_enum", + "raw-window-handle 0.5.0", + "thiserror", +] + +[[package]] +name = "ndk-context" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" + +[[package]] +name = "ndk-glue" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0434fabdd2c15e0aab768ca31d5b7b333717f03cf02037d5a0a3ff3c278ed67f" +dependencies = [ + "libc", + "log", + "ndk", + "ndk-context", + "ndk-macro", + "ndk-sys", + "once_cell", + "parking_lot", +] + +[[package]] +name = "ndk-macro" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0df7ac00c4672f9d5aece54ee3347520b7e20f158656c7db2e6de01902eb7a6c" +dependencies = [ + "darling", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "ndk-sys" +version = "0.4.1+23.1.7779620" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cf2aae958bd232cac5069850591667ad422d263686d75b52a065f9badeee5a3" +dependencies = [ + "jni-sys", +] + +[[package]] +name = "nix" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "195cdbc1741b8134346d515b3a56a1c94b0912758009cfd53f99ea0f57b065fc" +dependencies = [ + "bitflags", + "cfg-if", + "libc", + "memoffset", +] + +[[package]] +name = "nix" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e322c04a9e3440c327fca7b6c8a63e6890a32fa2ad689db972425f07e0d22abb" +dependencies = [ + "autocfg", + "bitflags", + "cfg-if", + "libc", + "memoffset", +] + +[[package]] +name = "nohash-hasher" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" + +[[package]] +name = "nom" +version = "7.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "num-traits" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +dependencies = [ + "autocfg", +] + [[package]] name = "num_cpus" version = "1.13.1" @@ -567,6 +1470,66 @@ dependencies = [ "libc", ] +[[package]] +name = "num_enum" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf5395665662ef45796a4ff5486c5d41d29e0c09640af4c5f17fd94ee2c119c9" +dependencies = [ + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0498641e53dd6ac1a4f22547548caa6864cc4933784319cd1775271c5a46ce" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "objc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" +dependencies = [ + "malloc_buf", + "objc_exception", +] + +[[package]] +name = "objc-foundation" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9" +dependencies = [ + "block", + "objc", + "objc_id", +] + +[[package]] +name = "objc_exception" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad970fb455818ad6cba4c122ad012fae53ae8b4795f86378bce65e4f6bab2ca4" +dependencies = [ + "cc", +] + +[[package]] +name = "objc_id" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c92d4ddb4bd7b50d730c215ff871754d0da6b2178849f8a2a2ab69712d0c073b" +dependencies = [ + "objc", +] + [[package]] name = "once_cell" version = "1.15.0" @@ -581,7 +1544,7 @@ checksum = "12fc0523e3bd51a692c8850d075d74dc062ccf251c0110668cbd921917118a13" dependencies = [ "bitflags", "cfg-if", - "foreign-types", + "foreign-types 0.3.2", "libc", "once_cell", "openssl-macros", @@ -618,6 +1581,15 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "owned_ttf_parser" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18904d3c65493a9f0d7542293d1a7f69bfdc309a6b9ef4f46dc3e58b0577edc5" +dependencies = [ + "ttf-parser", +] + [[package]] name = "parking_lot" version = "0.12.1" @@ -675,12 +1647,41 @@ version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" +[[package]] +name = "png" +version = "0.17.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d708eaf860a19b19ce538740d2b4bdeeb8337fa53f7738455e706623ad5c638" +dependencies = [ + "bitflags", + "crc32fast", + "flate2", + "miniz_oxide", +] + +[[package]] +name = "pollster" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5da3b0203fd7ee5720aa0b5e790b591aa5d3f41c3ed2c34a3a393382198af2f7" + [[package]] name = "ppv-lite86" version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" +[[package]] +name = "proc-macro-crate" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eda0fc3b0fb7c975631757e14d9049da17374063edb6ebbcbc54d880d4fe94e9" +dependencies = [ + "once_cell", + "thiserror", + "toml", +] + [[package]] name = "proc-macro2" version = "1.0.46" @@ -690,6 +1691,12 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "profiling" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74605f360ce573babfe43964cbe520294dcb081afbf8c108fc6e23036b4da2df" + [[package]] name = "prost" version = "0.11.0" @@ -782,6 +1789,30 @@ dependencies = [ "getrandom", ] +[[package]] +name = "range-alloc" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e935c45e09cc6dcf00d2f0b2d630a58f4095320223d47fc68918722f0538b6" + +[[package]] +name = "raw-window-handle" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b800beb9b6e7d2df1fe337c9e3d04e3af22a124460fb4c30fcc22c9117cefb41" +dependencies = [ + "cty", +] + +[[package]] +name = "raw-window-handle" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed7e3d950b66e19e0c372f3fa3fbbcf85b1746b571f74e0c2af6042a5c93420a" +dependencies = [ + "cty", +] + [[package]] name = "redox_syscall" version = "0.2.16" @@ -817,12 +1848,42 @@ dependencies = [ "winapi", ] +[[package]] +name = "renderdoc-sys" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1382d1f0a252c4bf97dc20d979a2fdd05b024acd7c2ed0f7595d7817666a157" + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + [[package]] name = "ryu" version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" +[[package]] +name = "safe_arch" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1ff3d6d9696af502cc3110dacce942840fb06ff4514cad92236ecc455f2ce05" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + [[package]] name = "schannel" version = "0.1.20" @@ -833,6 +1894,12 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + [[package]] name = "scopeguard" version = "1.1.0" @@ -845,6 +1912,18 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" +[[package]] +name = "sctk-adwaita" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61270629cc6b4d77ec1907db1033d5c2e1a404c412743621981a871dc9c12339" +dependencies = [ + "crossfont", + "log", + "smithay-client-toolkit", + "tiny-skia", +] + [[package]] name = "security-framework" version = "2.7.0" @@ -899,6 +1978,27 @@ dependencies = [ "serde", ] +[[package]] +name = "servo-fontconfig" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7e3e22fe5fd73d04ebf0daa049d3efe3eae55369ce38ab16d07ddd9ac5c217c" +dependencies = [ + "libc", + "servo-fontconfig-sys", +] + +[[package]] +name = "servo-fontconfig-sys" +version = "5.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e36b879db9892dfa40f95da1c38a835d41634b825fbd8c4c418093d53c24b388" +dependencies = [ + "expat-sys", + "freetype-sys", + "pkg-config", +] + [[package]] name = "sha-1" version = "0.10.0" @@ -932,11 +2032,17 @@ dependencies = [ name = "simple_room" version = "0.1.0" dependencies = [ + "egui", + "egui-wgpu", + "egui-winit", + "egui_demo_lib", "futures", "livekit", "tokio", "tracing", "tracing-subscriber", + "wgpu", + "winit", ] [[package]] @@ -948,12 +2054,50 @@ dependencies = [ "autocfg", ] +[[package]] +name = "slotmap" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1e08e261d0e8f5c43123b7adf3e4ca1690d655377ac93a03b2c9d3e98de1342" +dependencies = [ + "version_check", +] + [[package]] name = "smallvec" version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" +[[package]] +name = "smithay-client-toolkit" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f307c47d32d2715eb2e0ece5589057820e0e5e70d07c247d1063e844e107f454" +dependencies = [ + "bitflags", + "calloop", + "dlib", + "lazy_static", + "log", + "memmap2", + "nix 0.24.2", + "pkg-config", + "wayland-client", + "wayland-cursor", + "wayland-protocols", +] + +[[package]] +name = "smithay-clipboard" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a345c870a1fae0b1b779085e81b51e614767c239e93503588e54c5b17f4b0e8" +dependencies = [ + "smithay-client-toolkit", + "wayland-client", +] + [[package]] name = "socket2" version = "0.4.7" @@ -964,6 +2108,34 @@ dependencies = [ "winapi", ] +[[package]] +name = "spirv" +version = "0.2.0+1.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "246bfa38fe3db3f1dfc8ca5a2cdeb7348c78be2112740cc0ec8ef18b6d94f830" +dependencies = [ + "bitflags", + "num-traits", +] + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "str-buf" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e08d8363704e6c71fc928674353e6b7c23dcea9d82d7012c8faf2a3a025f8d0" + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + [[package]] name = "syn" version = "1.0.101" @@ -1027,6 +2199,31 @@ dependencies = [ "once_cell", ] +[[package]] +name = "tiny-skia" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "642680569bb895b16e4b9d181c60be1ed136fa0c9c7f11d004daf053ba89bf82" +dependencies = [ + "arrayref", + "arrayvec 0.5.2", + "bytemuck", + "cfg-if", + "png", + "safe_arch", + "tiny-skia-path", +] + +[[package]] +name = "tiny-skia-path" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c114d32f0c2ee43d585367cb013dfaba967ab9f62b90d9af0d696e955e70fa6c" +dependencies = [ + "arrayref", + "bytemuck", +] + [[package]] name = "tinyvec" version = "1.6.0" @@ -1097,6 +2294,15 @@ dependencies = [ "tungstenite", ] +[[package]] +name = "toml" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" +dependencies = [ + "serde", +] + [[package]] name = "tracing" version = "0.1.36" @@ -1155,6 +2361,12 @@ dependencies = [ "tracing-log", ] +[[package]] +name = "ttf-parser" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "375812fa44dab6df41c195cd2f7fecb488f6c09fbaafb62807488cefab642bff" + [[package]] name = "tungstenite" version = "0.17.3" @@ -1175,6 +2387,15 @@ dependencies = [ "utf-8", ] +[[package]] +name = "type-map" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "deb68604048ff8fa93347f02441e4487594adc20bb8a084f9e564d2b827a0a9f" +dependencies = [ + "rustc-hash", +] + [[package]] name = "typenum" version = "1.15.0" @@ -1208,6 +2429,18 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + +[[package]] +name = "unicode_names2" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "029df4cc8238cefc911704ff8fa210853a0f3bce2694d8f51181dd41ee0f3301" + [[package]] name = "url" version = "2.3.1" @@ -1237,18 +2470,294 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" +[[package]] +name = "vec_map" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" + [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "walkdir" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" +dependencies = [ + "same-file", + "winapi", + "winapi-util", +] + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasm-bindgen" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" + +[[package]] +name = "wayland-client" +version = "0.29.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f3b068c05a039c9f755f881dc50f01732214f5685e379829759088967c46715" +dependencies = [ + "bitflags", + "downcast-rs", + "libc", + "nix 0.24.2", + "scoped-tls", + "wayland-commons", + "wayland-scanner", + "wayland-sys", +] + +[[package]] +name = "wayland-commons" +version = "0.29.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8691f134d584a33a6606d9d717b95c4fa20065605f798a3f350d78dced02a902" +dependencies = [ + "nix 0.24.2", + "once_cell", + "smallvec", + "wayland-sys", +] + +[[package]] +name = "wayland-cursor" +version = "0.29.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6865c6b66f13d6257bef1cd40cbfe8ef2f150fb8ebbdb1e8e873455931377661" +dependencies = [ + "nix 0.24.2", + "wayland-client", + "xcursor", +] + +[[package]] +name = "wayland-protocols" +version = "0.29.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b950621f9354b322ee817a23474e479b34be96c2e909c14f7bc0100e9a970bc6" +dependencies = [ + "bitflags", + "wayland-client", + "wayland-commons", + "wayland-scanner", +] + +[[package]] +name = "wayland-scanner" +version = "0.29.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f4303d8fa22ab852f789e75a967f0a2cdc430a607751c0499bada3e451cbd53" +dependencies = [ + "proc-macro2", + "quote", + "xml-rs", +] + +[[package]] +name = "wayland-sys" +version = "0.29.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be12ce1a3c39ec7dba25594b97b42cb3195d54953ddb9d3d95a7c3902bc6e9d4" +dependencies = [ + "dlib", + "lazy_static", + "pkg-config", +] + +[[package]] +name = "web-sys" +version = "0.3.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webbrowser" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a0cc7962b5aaa0dfcebaeef0161eec6edf5f4606c12e6777fd7d392f52033a5" +dependencies = [ + "jni", + "ndk-context", + "objc", + "raw-window-handle 0.5.0", + "url", + "web-sys", + "widestring", + "winapi", +] + +[[package]] +name = "wgpu" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2272b17bffc8a0c7d53897435da7c1db587c87d3a14e8dae9cdb8d1d210fc0f" +dependencies = [ + "arrayvec 0.7.2", + "js-sys", + "log", + "naga", + "parking_lot", + "raw-window-handle 0.5.0", + "smallvec", + "static_assertions", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "wgpu-core", + "wgpu-hal", + "wgpu-types", +] + +[[package]] +name = "wgpu-core" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73d14cad393054caf992ee02b7da6a372245d39a484f7461c1f44f6f6359bd28" +dependencies = [ + "arrayvec 0.7.2", + "bit-vec", + "bitflags", + "cfg_aliases", + "codespan-reporting", + "fxhash", + "log", + "naga", + "parking_lot", + "profiling", + "raw-window-handle 0.5.0", + "smallvec", + "thiserror", + "web-sys", + "wgpu-hal", + "wgpu-types", +] + +[[package]] +name = "wgpu-hal" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cc320a61acb26be4f549c9b1b53405c10a223fbfea363ec39474c32c348d12f" +dependencies = [ + "android_system_properties", + "arrayvec 0.7.2", + "ash", + "bit-set", + "bitflags", + "block", + "core-graphics-types", + "d3d12", + "foreign-types 0.3.2", + "fxhash", + "glow", + "gpu-alloc", + "gpu-descriptor", + "js-sys", + "khronos-egl", + "libloading", + "log", + "metal", + "naga", + "objc", + "parking_lot", + "profiling", + "range-alloc", + "raw-window-handle 0.5.0", + "renderdoc-sys", + "smallvec", + "thiserror", + "wasm-bindgen", + "web-sys", + "wgpu-types", + "winapi", +] + +[[package]] +name = "wgpu-types" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb6b28ef22cac17b9109b25b3bf8c9a103eeb293d7c5f78653979b09140375f6" +dependencies = [ + "bitflags", +] + [[package]] name = "which" version = "4.3.0" @@ -1260,6 +2769,12 @@ dependencies = [ "once_cell", ] +[[package]] +name = "widestring" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "653f141f39ec16bba3c5abe400a0c60da7468261cc2cbf36805022876bc721a8" + [[package]] name = "winapi" version = "0.3.9" @@ -1285,6 +2800,15 @@ dependencies = [ "winapi", ] +[[package]] +name = "winapi-wsapoll" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44c17110f57155602a80dca10be03852116403c9ff3cd25b079d666f2aa3df6e" +dependencies = [ + "winapi", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -1333,3 +2857,93 @@ name = "windows_x86_64_msvc" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" + +[[package]] +name = "winit" +version = "0.27.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb796d6fbd86b2fd896c9471e6f04d39d750076ebe5680a3958f00f5ab97657c" +dependencies = [ + "bitflags", + "cocoa", + "core-foundation", + "core-graphics", + "dispatch", + "instant", + "libc", + "log", + "mio", + "ndk", + "ndk-glue", + "objc", + "once_cell", + "parking_lot", + "percent-encoding", + "raw-window-handle 0.4.3", + "raw-window-handle 0.5.0", + "sctk-adwaita", + "smithay-client-toolkit", + "wasm-bindgen", + "wayland-client", + "wayland-protocols", + "web-sys", + "windows-sys", + "x11-dl", +] + +[[package]] +name = "wio" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d129932f4644ac2396cb456385cbf9e63b5b30c6e8dc4820bdca4eb082037a5" +dependencies = [ + "winapi", +] + +[[package]] +name = "x11-dl" +version = "2.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1536d6965a5d4e573c7ef73a2c15ebcd0b2de3347bdf526c34c297c00ac40f0" +dependencies = [ + "lazy_static", + "libc", + "pkg-config", +] + +[[package]] +name = "x11rb" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "592b4883219f345e712b3209c62654ebda0bb50887f330cbd018d0f654bfd507" +dependencies = [ + "gethostname", + "nix 0.24.2", + "winapi", + "winapi-wsapoll", + "x11rb-protocol", +] + +[[package]] +name = "x11rb-protocol" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56b245751c0ac9db0e006dc812031482784e434630205a93c73cfefcaabeac67" +dependencies = [ + "nix 0.24.2", +] + +[[package]] +name = "xcursor" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "463705a63313cd4301184381c5e8042f0a7e9b4bb63653f216311d4ae74690b7" +dependencies = [ + "nom", +] + +[[package]] +name = "xml-rs" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2d7d3948613f75c98fd9328cfdcc45acc4d360655289d0a7d4ec931392200a3" diff --git a/examples/Cargo.toml b/examples/Cargo.toml index 5f00359..6696429 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -1,3 +1,4 @@ [workspace] members = ["*"] -exclude = ["target"] \ No newline at end of file +exclude = ["target"] +resolver = "2" diff --git a/examples/simple_room/Cargo.toml b/examples/simple_room/Cargo.toml index aab5f93..d9e266a 100644 --- a/examples/simple_room/Cargo.toml +++ b/examples/simple_room/Cargo.toml @@ -9,3 +9,10 @@ tracing = "0.1" tracing-subscriber = "0.3" livekit = { path = "../.." } futures = "0.3" +wgpu = "0.14.0" +winit = "0.27.5" + +egui = { git = "https://github.com/emilk/egui" } +egui-wgpu = { git = "https://github.com/emilk/egui", features = ["winit"] } +egui-winit = { git = "https://github.com/emilk/egui" } +egui_demo_lib = { git = "https://github.com/emilk/egui" } diff --git a/examples/simple_room/src/main.rs b/examples/simple_room/src/main.rs index 1b49771..a35bbbf 100644 --- a/examples/simple_room/src/main.rs +++ b/examples/simple_room/src/main.rs @@ -1,36 +1,192 @@ -use std::time::Duration; +use std::convert::TryInto; +use std::ops::DerefMut; +use std::{num::NonZeroU32, time::Duration}; + +use egui_wgpu::WgpuConfiguration; +use livekit::webrtc::media_stream::VideoTrack; +use livekit::webrtc::video_frame_buffer::{ + PlanarYuv8Buffer, PlanarYuvBuffer, VideoFrameBufferTrait, +}; +use livekit::webrtc::yuv_helper; +use std::sync::{Arc, Mutex}; +use video_renderer::VideoRenderer; +use wgpu::{Device, Queue}; -use livekit::room::RoomError; -use livekit::room::{track::remote_track::RemoteTrackHandle, Room}; use tokio::time::sleep; +use livekit::room::track::remote_track::RemoteTrackHandle; +use livekit::room::{Room, RoomError}; + const URL: &str = "ws://localhost:7880"; const TOKEN : &str = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjIzODQ4MDY0NzMsImlzcyI6IkFQSXpLYkFTaUNWYWtnSiIsIm5hbWUiOiJuYXRpdmUiLCJuYmYiOjE2NjQ4MDY0NzMsInN1YiI6Im5hdGl2ZSIsInZpZGVvIjp7InJvb21DcmVhdGUiOnRydWUsInJvb21Kb2luIjp0cnVlfX0.BgVdBnq3XFD3_BQHoe1azqjifYysubgFl6Qlzu9IQGI"; // eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjIzODQ4MDY3MzAsImlzcyI6IkFQSXpLYkFTaUNWYWtnSiIsIm5hbWUiOiJ3ZWIiLCJuYmYiOjE2NjQ4MDY3MzAsInN1YiI6IndlYiIsInZpZGVvIjp7InJvb21DcmVhdGUiOnRydWUsInJvb21Kb2luIjp0cnVlfX0.VbDoULjX1CVGZu2sPy3SvWYlVZUBXxQVPmdB9BnmlN4 -#[tokio::main] -async fn main() -> Result<(), RoomError> { - tracing_subscriber::fmt::init(); +mod video_renderer; - let mut room = Room::new(); - room.events() - .on_participant_connected(|_event| async move {}); +use winit::{ + event::*, + event_loop::{ControlFlow, EventLoop}, + window::{Window, WindowBuilder, WindowId}, +}; - room.events().on_track_subscribed(|event| async move { - let track = event.publication.track().unwrap(); - if let RemoteTrackHandle::Video(video_track) = track { - let rtc_track = video_track.rtc_track(); - rtc_track.set_should_receive(true); - rtc_track.on_frame(Box::new(|_frame, _buffer| { - // called on libwebrtc worker_thread - println!("Received frame"); - })); - } - }); - - room.connect(URL, TOKEN).await?; - - sleep(Duration::from_secs(200)).await; - Ok(()) +struct AppState { + room: Room, + demo: egui_demo_lib::DemoWindows, + egui_context: egui::Context, + egui_state: egui_winit::State, + egui_painter: egui_wgpu::winit::Painter, + window: winit::window::Window, +} + +impl AppState { + fn on_event(&mut self, event: Event<'_, T>, control_flow: &mut ControlFlow) { + match event { + Event::WindowEvent { window_id, event } => { + if let Some(flow) = self.on_window_event(window_id, event) { + *control_flow = flow; + } + } + Event::RedrawRequested(window_id) if window_id == self.window.id() => { + self.render(); + } + Event::RedrawEventsCleared => { + self.window.request_redraw(); + } + _ => {} + }; + } + + fn on_window_event( + &mut self, + _window_id: WindowId, + event: WindowEvent<'_>, + ) -> Option { + if self + .egui_state + .on_event(&self.egui_context, &event) + .consumed + { + return None; + } + + match event { + WindowEvent::CloseRequested => Some(ControlFlow::Exit), + WindowEvent::Resized(inner_size) => { + self.egui_painter + .on_window_resized(inner_size.width, inner_size.height); + None + } + WindowEvent::ScaleFactorChanged { new_inner_size, .. } => { + self.egui_painter + .on_window_resized(new_inner_size.width, new_inner_size.height); + None + } + _ => None, + } + } + + fn render(&mut self) { + let raw_inputs = self.egui_state.take_egui_input(&self.window); + let full_output = self.egui_context.run(raw_inputs, |ctx| { + //self.ui(ctx); + }); + let clipped_primitives = self.egui_context.tessellate(full_output.shapes); + + self.egui_painter.paint_and_update_textures( + egui_winit::native_pixels_per_point(&self.window), + egui::Rgba::BLACK, + &clipped_primitives, + &full_output.textures_delta, + ); + + self.egui_state.handle_platform_output( + &self.window, + &self.egui_context, + full_output.platform_output, + ); + } +} + +struct App { + rt: tokio::runtime::Runtime, +} + +impl App { + pub fn new(rt: tokio::runtime::Runtime) -> Self { + Self { rt } + } + + pub fn run(&mut self) { + self.rt.block_on(async { + let event_loop = EventLoop::new(); + let window = WindowBuilder::new().build(&event_loop).unwrap(); + + let egui_context = egui::Context::default(); + let egui_state = egui_winit::State::new(&event_loop); + let mut egui_painter = + egui_wgpu::winit::Painter::new(WgpuConfiguration::default(), 1, 32); + unsafe { + egui_painter.set_window(Some(&window)); + } + + let mut inner = AppState { + room: Room::new(), + demo: egui_demo_lib::DemoWindows::default(), + egui_context, + egui_state, + egui_painter, + window, + }; + + inner + .room + .events() + .on_participant_connected(|_event| async move {}); + + inner.room.events().on_track_subscribed({ + let test = Arc::new(Mutex::new(None)); + + let egui_render = inner.egui_painter.render_state().clone().unwrap(); + + move |event| { + let test = test.clone(); + let egui_render = egui_render.clone(); + + async move { + let track = event.publication.track().unwrap(); + if let RemoteTrackHandle::Video(video_track) = track { + *test.lock().unwrap() = + Some(VideoRenderer::new(egui_render, video_track.rtc_track())) + } + } + } + }); + + inner.room.connect(URL, TOKEN).await.unwrap(); + + tokio::spawn(async { + loop { + println!("Test"); + tokio::time::sleep(Duration::from_secs(5)).await; + } + }); + + tokio::task::block_in_place(move || loop { + event_loop.run(move |event, _, control_flow| { + inner.on_event(event, control_flow); + }); + }); + }); + } +} + +fn main() { + let rt = tokio::runtime::Builder::new_multi_thread() + .enable_all() + .build() + .unwrap(); + + let mut app = App::new(rt); + app.run(); } diff --git a/examples/simple_room/src/video_renderer.rs b/examples/simple_room/src/video_renderer.rs new file mode 100644 index 0000000..124322b --- /dev/null +++ b/examples/simple_room/src/video_renderer.rs @@ -0,0 +1,172 @@ +use livekit::webrtc::media_stream::VideoTrack; +use livekit::webrtc::video_frame_buffer::PlanarYuv8Buffer; +use livekit::webrtc::video_frame_buffer::PlanarYuvBuffer; +use livekit::webrtc::video_frame_buffer::VideoFrameBufferTrait; +use livekit::webrtc::yuv_helper; +use std::convert::TryInto; +use std::num::NonZeroU32; +use std::{ + ops::DerefMut, + sync::{Arc, Mutex}, +}; + +pub struct VideoRenderer { + internal: Arc>, + rtc_track: Arc, +} + +struct RendererInternal { + render_state: egui_wgpu::RenderState, + width: u32, + height: u32, + rgba_data: Vec, + texture: Option, + texture_view: Option, + egui_texture: Option, +} + +impl RendererInternal { + fn ensure_texture_size(&mut self, width: u32, height: u32) { + if self.width == width && self.height == height { + return; + } + + self.width = width; + self.height = height; + self.rgba_data.resize((width * height * 4) as usize, 0); + + self.texture = Some( + self.render_state + .device + .create_texture(&wgpu::TextureDescriptor { + label: Some("lk-videotexture"), + usage: wgpu::TextureUsages::TEXTURE_BINDING | wgpu::TextureUsages::COPY_DST, + dimension: wgpu::TextureDimension::D2, + size: wgpu::Extent3d { + width, + height, + ..Default::default() + }, + sample_count: 1, + mip_level_count: 1, + format: wgpu::TextureFormat::Rgba8UnormSrgb, + }), + ); + + self.texture_view = Some(self.texture.as_mut().unwrap().create_view( + &wgpu::TextureViewDescriptor { + label: Some("lk-videotexture-view"), + format: Some(wgpu::TextureFormat::Rgba8UnormSrgb), + dimension: Some(wgpu::TextureViewDimension::D2), + mip_level_count: NonZeroU32::new(1), + array_layer_count: NonZeroU32::new(1), + ..Default::default() + }, + )); + + if let Some(texture_id) = self.egui_texture { + // Update the existing texture + self.render_state + .renderer + .write() + .update_egui_texture_from_wgpu_texture( + &*self.render_state.device, + self.texture_view.as_ref().unwrap(), + wgpu::FilterMode::Linear, + texture_id, + ); + } else { + self.egui_texture = Some(self.render_state.renderer.write().register_native_texture( + &*self.render_state.device, + self.texture_view.as_ref().unwrap(), + wgpu::FilterMode::Linear, + )); + } + } +} + +impl VideoRenderer { + pub fn new(render_state: egui_wgpu::RenderState, rtc_track: Arc) -> Self { + let internal = Arc::new(Mutex::new(RendererInternal { + render_state, + width: 0, + height: 0, + rgba_data: Vec::default(), + texture: None, + texture_view: None, + egui_texture: None, + })); + + rtc_track.on_frame({ + let internal = internal.clone(); + + Box::new(move |_frame, buffer| { + let mut internal = internal.lock().unwrap(); + let buffer = buffer.to_i420(); + + let width: u32 = buffer.width().try_into().unwrap(); + let height: u32 = buffer.height().try_into().unwrap(); + + internal.ensure_texture_size(width, height); + + let rgba_ptr = internal.rgba_data.deref_mut(); + let rgba_stride = buffer.width() * 4; + + yuv_helper::i420_to_abgr( + buffer.data_y(), + buffer.stride_y(), + buffer.data_u(), + buffer.stride_u(), + buffer.data_v(), + buffer.stride_v(), + rgba_ptr, + rgba_stride, + buffer.width(), + buffer.height(), + ); + + let copy_desc = wgpu::ImageCopyTexture { + texture: internal.texture.as_ref().unwrap(), + mip_level: 0, + origin: wgpu::Origin3d::default(), + aspect: wgpu::TextureAspect::default(), + }; + + let copy_layout = wgpu::ImageDataLayout { + bytes_per_row: Some(NonZeroU32::new(width * 4).unwrap()), + ..Default::default() + }; + + let copy_size = wgpu::Extent3d { + width, + height, + ..Default::default() + }; + + internal.render_state.queue.write_texture( + copy_desc, + &internal.rgba_data, + copy_layout, + copy_size, + ); + + println!("wrote"); + }) + }); + + Self { + rtc_track, + internal, + } + } + + pub fn texture_id(&self) -> Option { + self.internal.lock().unwrap().egui_texture.clone() + } +} + +impl Drop for VideoRenderer { + fn drop(&mut self) { + self.rtc_track.on_frame(Box::new(|_, _| {})); + } +} diff --git a/src/lib.rs b/src/lib.rs index ef89eee..f18044b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,2 +1,6 @@ // export everything inside livekit-core pub use livekit_core::*; + +pub mod webrtc { + pub use livekit_webrtc::*; +}