diff --git a/.github/workflows/cut-video-daemon-dev.yaml b/.github/workflows/cut-video-daemon-dev.yaml index 948a6288..b6527027 100644 --- a/.github/workflows/cut-video-daemon-dev.yaml +++ b/.github/workflows/cut-video-daemon-dev.yaml @@ -8,7 +8,7 @@ on: tags: - '*' paths: - - 'video-daemon/**' + - 'videocall-daemon/**' jobs: build_and_package: @@ -33,10 +33,10 @@ jobs: - name: Build and Create DEB Package run: | cargo install cargo-deb - cd video-daemon + cd videocall-daemon cargo deb - uses: actions/upload-artifact@v2 with: - name: video-daemon.deb - path: video-daemon/target/debian/*.deb + name: videocall-daemon.deb + path: videocall-daemon/target/debian/*.deb diff --git a/Cargo.lock b/Cargo.lock index def0d5fa..ecac5f7b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -539,8 +539,8 @@ dependencies = [ "serde_json", "tokio", "tokio-tungstenite", - "types", "url", + "videocall-types", ] [[package]] @@ -2083,6 +2083,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-integer" version = "0.1.46" @@ -2488,9 +2494,9 @@ dependencies = [ [[package]] name = "protobuf" -version = "3.3.0" +version = "3.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b65f4a8ec18723a734e5dc09c173e0abf9690432da5340285d536edcb4dac190" +checksum = "a3a7c64d9bf75b1b8d981124c14c179074e8caa7dfe7b6a12e6222ddcd0c8f72" dependencies = [ "once_cell", "protobuf-support", @@ -2499,9 +2505,9 @@ dependencies = [ [[package]] name = "protobuf-support" -version = "3.3.0" +version = "3.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6872f4d4f4b98303239a2b5838f5bbbb77b01ffc892d627957f37a22d7cfe69c" +checksum = "b088fd20b938a875ea00843b6faf48579462630015c3788d397ad6a786663252" dependencies = [ "thiserror", ] @@ -3040,9 +3046,9 @@ dependencies = [ "tracing", "tracing-subscriber", "tracing-tree", - "types", "urlencoding", "uuid", + "videocall-types", "web-transport-quinn", ] @@ -3419,12 +3425,13 @@ dependencies = [ [[package]] name = "time" -version = "0.3.30" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", "itoa", + "num-conv", "powerfmt", "serde", "time-core", @@ -3439,10 +3446,11 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.15" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" dependencies = [ + "num-conv", "time-core", ] @@ -3728,16 +3736,6 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" -[[package]] -name = "types" -version = "0.1.0" -dependencies = [ - "protobuf", - "serde", - "serde_json", - "yew-websocket", -] - [[package]] name = "unicode-bidi" version = "0.3.14" @@ -3839,7 +3837,7 @@ dependencies = [ "protobuf", "rand", "rsa", - "types", + "videocall-types", "wasm-bindgen", "wasm-bindgen-futures", "wasm-bindgen-test", @@ -3849,6 +3847,16 @@ dependencies = [ "yew-webtransport", ] +[[package]] +name = "videocall-types" +version = "0.1.0" +dependencies = [ + "protobuf", + "serde", + "serde_json", + "yew-websocket", +] + [[package]] name = "walkdir" version = "2.5.0" diff --git a/Cargo.toml b/Cargo.toml index 370f56d5..32836dce 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,13 +3,13 @@ resolver = "2" members = [ "actix-api", "bot", - "types", + "videocall-types", "videocall-client" ] exclude = [ "src-tauri", - "video-daemon", + "videocall-daemon", "yew-ui", - "leptos-website" + "leptos-website", ] diff --git a/Dockerfile.video-daemon b/Dockerfile.video-daemon index 1c7884fa..9578c850 100644 --- a/Dockerfile.video-daemon +++ b/Dockerfile.video-daemon @@ -27,7 +27,7 @@ RUN apt-get update && \ apt-get install -y pkg-config libvpx-dev && \ apt-get clean -COPY --from=build /app/target/release/video-daemon /usr/bin/ +COPY --from=build /app/target/release/videocall-daemon /usr/bin/ -CMD ["video-daemon"] +CMD ["videocall-daemon"] diff --git a/LICENSE.md b/LICENSE.md index 42d124ee..f415aeec 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2022 Security Union +Copyright (c) 2024 Security Union Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/actix-api/Cargo.toml b/actix-api/Cargo.toml index 2b9b0a66..e9e9119c 100644 --- a/actix-api/Cargo.toml +++ b/actix-api/Cargo.toml @@ -50,7 +50,7 @@ tokio = { version = "1.28.2", features = ["full"] } tracing = "0.1.37" tracing-subscriber = { version = "0.3.17", features = ["fmt", "ansi", "env-filter", "time", "tracing-log"] } tracing-tree = "0.2.3" -types = { path= "../types"} +videocall-types = { path= "../videocall-types"} urlencoding = "2.1.3" uuid = { version = "0.8", features = ["serde", "v4"] } web-transport-quinn = "0.3.1" diff --git a/actix-api/src/bin/websocket_server.rs b/actix-api/src/bin/websocket_server.rs index dfd234c6..4257d944 100644 --- a/actix-api/src/bin/websocket_server.rs +++ b/actix-api/src/bin/websocket_server.rs @@ -25,7 +25,7 @@ use sec_api::{ models::{AppConfig, AppState}, }; use tracing::{debug, error, info}; -use types::truthy; +use videocall_types::truthy; const SCOPE: &str = "email%20profile%20openid"; /** diff --git a/actix-api/src/webtransport/mod.rs b/actix-api/src/webtransport/mod.rs index 99dcef90..b04598f2 100644 --- a/actix-api/src/webtransport/mod.rs +++ b/actix-api/src/webtransport/mod.rs @@ -11,9 +11,9 @@ use std::{fs, io}; use std::{net::SocketAddr, path::PathBuf, sync::Arc}; use tokio::sync::{watch, RwLock}; use tracing::{error, info, trace_span}; -use types::protos::connection_packet::ConnectionPacket; -use types::protos::packet_wrapper::packet_wrapper::PacketType; -use types::protos::packet_wrapper::PacketWrapper; +use videocall_types::protos::connection_packet::ConnectionPacket; +use videocall_types::protos::packet_wrapper::packet_wrapper::PacketType; +use videocall_types::protos::packet_wrapper::PacketWrapper; use web_transport_quinn::Session; pub const WEB_TRANSPORT_ALPN: &[&[u8]] = &[b"h3", b"h3-32", b"h3-31", b"h3-30", b"h3-29"]; diff --git a/bot/Cargo.toml b/bot/Cargo.toml index 12ceb348..81d43ee6 100644 --- a/bot/Cargo.toml +++ b/bot/Cargo.toml @@ -10,8 +10,8 @@ serde = "1.0.130" serde_json = "1.0.72" rand = "0.8.5" futures = "0.3.16" -types = { path= "../types"} -protobuf = "3.2.0" +videocall-types = { path= "../videocall-types"} +protobuf = "3.3.0" chrono = "0.4.25" dotenv = "0.15.0" diff --git a/bot/src/main.rs b/bot/src/main.rs index 6b529630..761a18b7 100644 --- a/bot/src/main.rs +++ b/bot/src/main.rs @@ -7,9 +7,9 @@ use rand::Rng; use std::env; use tokio::task::JoinHandle; use tokio_tungstenite::{connect_async, tungstenite::Message}; -use types::protos::media_packet::media_packet::MediaType; -use types::protos::media_packet::MediaPacket; use url::Url; +use videocall_types::protos::media_packet::media_packet::MediaType; +use videocall_types::protos::media_packet::MediaPacket; #[tokio::main] async fn main() { diff --git a/cut_build_push_video_daemon.sh b/cut_build_push_video_daemon.sh index 026833f8..d9ec4568 100755 --- a/cut_build_push_video_daemon.sh +++ b/cut_build_push_video_daemon.sh @@ -1,10 +1,10 @@ #!/bin/bash set -e -IMAGE_URL=securityunion/video-daemon:staging +IMAGE_URL=securityunion/videocall-daemon:staging echo "Building image $IMAGE_URL" -if ! docker build -t $IMAGE_URL . --file Dockerfile.video-daemon; then +if ! docker build -t $IMAGE_URL . --file Dockerfile.videocall-daemon; then echo "Failed to build docker image" else docker push $IMAGE_URL diff --git a/protobuf/Makefile b/protobuf/Makefile index 773a55d4..28c73969 100644 --- a/protobuf/Makefile +++ b/protobuf/Makefile @@ -20,7 +20,7 @@ build/rust: .PHONY: generate_rust generate_rust: build/rust - protoc --rust_out=build/rust types/*.proto + protoc --rs_out=build/rust types/*.proto .PHONY: build-env-rust build-env-rust: @@ -30,7 +30,7 @@ build-env-rust: build-env-generate-rust: $(DOCKER_RUN_RUST_CMD) make generate_rust - mv build/rust/* ../types/src/protos + mv build/rust/* ../videocall-types/src/protos .PHONY: build build: diff --git a/protobuf/build-env-rust.Dockerfile b/protobuf/build-env-rust.Dockerfile index cd01588d..17bd4e54 100644 --- a/protobuf/build-env-rust.Dockerfile +++ b/protobuf/build-env-rust.Dockerfile @@ -10,7 +10,7 @@ RUN apt-get update && \ curl \ protobuf-compiler -RUN cargo install protobuf-codegen --vers 3.3.0 +RUN cargo install protobuf-codegen --vers 3.7.1 RUN useradd --create-home $USER --uid $UID && \ adduser $USER sudo && \ diff --git a/types/Cargo.toml b/types/Cargo.toml deleted file mode 100644 index 29450285..00000000 --- a/types/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "types" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -serde_json = "1.0.81" -serde = { version = "1.0.37", features = ["derive"]} -protobuf = "3.2.0" -yew-websocket = "1.0.1" \ No newline at end of file diff --git a/videocall-client/Cargo.toml b/videocall-client/Cargo.toml index a0ee7dc2..67132531 100644 --- a/videocall-client/Cargo.toml +++ b/videocall-client/Cargo.toml @@ -15,10 +15,10 @@ gloo-timers = "0.2.6" gloo-utils = "0.1" js-sys = "0.3" log = "0.4.19" -protobuf = "3.2.0" +protobuf = "3.3.0" rand = { version = "0.8.5", features = ["std_rng", "small_rng"] } rsa = "0.9.2" -types = { path= "../types"} +videocall-types = { path= "../videocall-types"} wasm-bindgen = "0.2.78" wasm-bindgen-futures = "0.4.30" yew = { version = "0.21" } diff --git a/videocall-client/src/client/video_call_client.rs b/videocall-client/src/client/video_call_client.rs index 86dec061..552bad0e 100644 --- a/videocall-client/src/client/video_call_client.rs +++ b/videocall-client/src/client/video_call_client.rs @@ -9,11 +9,11 @@ use rsa::pkcs8::{DecodePublicKey, EncodePublicKey}; use rsa::RsaPublicKey; use std::cell::RefCell; use std::rc::{Rc, Weak}; -use types::protos::aes_packet::AesPacket; -use types::protos::media_packet::media_packet::MediaType; -use types::protos::packet_wrapper::packet_wrapper::PacketType; -use types::protos::packet_wrapper::PacketWrapper; -use types::protos::rsa_packet::RsaPacket; +use videocall_types::protos::aes_packet::AesPacket; +use videocall_types::protos::media_packet::media_packet::MediaType; +use videocall_types::protos::packet_wrapper::packet_wrapper::PacketType; +use videocall_types::protos::packet_wrapper::PacketWrapper; +use videocall_types::protos::rsa_packet::RsaPacket; use wasm_bindgen::JsValue; use yew::prelude::Callback; diff --git a/videocall-client/src/connection/connection.rs b/videocall-client/src/connection/connection.rs index 99da5bef..8f6c342d 100644 --- a/videocall-client/src/connection/connection.rs +++ b/videocall-client/src/connection/connection.rs @@ -9,10 +9,10 @@ use gloo::timers::callback::Interval; use protobuf::Message; use std::cell::Cell; use std::rc::Rc; -use types::protos::media_packet::media_packet::MediaType; -use types::protos::media_packet::MediaPacket; -use types::protos::packet_wrapper::packet_wrapper::PacketType; -use types::protos::packet_wrapper::PacketWrapper; +use videocall_types::protos::media_packet::media_packet::MediaType; +use videocall_types::protos::media_packet::MediaPacket; +use videocall_types::protos::packet_wrapper::packet_wrapper::PacketType; +use videocall_types::protos::packet_wrapper::PacketWrapper; use yew::prelude::Callback; #[derive(Clone, Copy, Debug)] diff --git a/videocall-client/src/connection/task.rs b/videocall-client/src/connection/task.rs index f0e1cbda..4cd241c3 100644 --- a/videocall-client/src/connection/task.rs +++ b/videocall-client/src/connection/task.rs @@ -4,7 +4,7 @@ // Handles rollover of connection from WebTransport to WebSocket // use log::{debug, error}; -use types::protos::packet_wrapper::PacketWrapper; +use videocall_types::protos::packet_wrapper::PacketWrapper; use yew_websocket::websocket::WebSocketTask; use yew_webtransport::webtransport::WebTransportTask; diff --git a/videocall-client/src/connection/webmedia.rs b/videocall-client/src/connection/webmedia.rs index 86e8c3e8..6331ad15 100644 --- a/videocall-client/src/connection/webmedia.rs +++ b/videocall-client/src/connection/webmedia.rs @@ -5,7 +5,7 @@ // use log::error; use protobuf::Message; -use types::protos::packet_wrapper::PacketWrapper; +use videocall_types::protos::packet_wrapper::PacketWrapper; use wasm_bindgen::JsValue; use yew::prelude::Callback; diff --git a/videocall-client/src/connection/webtransport.rs b/videocall-client/src/connection/webtransport.rs index 9b3483ab..81d6f5db 100644 --- a/videocall-client/src/connection/webtransport.rs +++ b/videocall-client/src/connection/webtransport.rs @@ -12,7 +12,7 @@ use log::debug; use log::error; use log::info; use protobuf::Message; -use types::protos::packet_wrapper::PacketWrapper; +use videocall_types::protos::packet_wrapper::PacketWrapper; use wasm_bindgen::JsCast; use wasm_bindgen_futures::JsFuture; use web_sys::ReadableStreamDefaultReader; diff --git a/videocall-client/src/decode/peer_decode_manager.rs b/videocall-client/src/decode/peer_decode_manager.rs index f4474c13..538d0d43 100644 --- a/videocall-client/src/decode/peer_decode_manager.rs +++ b/videocall-client/src/decode/peer_decode_manager.rs @@ -2,9 +2,11 @@ use super::hash_map_with_ordered_keys::HashMapWithOrderedKeys; use log::debug; use protobuf::Message; use std::{fmt::Display, sync::Arc}; -use types::protos::media_packet::MediaPacket; -use types::protos::packet_wrapper::packet_wrapper::PacketType; -use types::protos::{media_packet::media_packet::MediaType, packet_wrapper::PacketWrapper}; +use videocall_types::protos::media_packet::MediaPacket; +use videocall_types::protos::packet_wrapper::packet_wrapper::PacketType; +use videocall_types::protos::{ + media_packet::media_packet::MediaType, packet_wrapper::PacketWrapper, +}; use yew::prelude::Callback; use crate::crypto::aes::Aes128State; diff --git a/videocall-client/src/decode/peer_decoder.rs b/videocall-client/src/decode/peer_decoder.rs index 319fd64b..b89531a1 100644 --- a/videocall-client/src/decode/peer_decoder.rs +++ b/videocall-client/src/decode/peer_decoder.rs @@ -20,7 +20,7 @@ use crate::constants::AUDIO_SAMPLE_RATE; use crate::constants::VIDEO_CODEC; use log::error; use std::sync::Arc; -use types::protos::media_packet::MediaPacket; +use videocall_types::protos::media_packet::MediaPacket; use wasm_bindgen::prelude::Closure; use wasm_bindgen::JsCast; use wasm_bindgen::JsValue; diff --git a/videocall-client/src/decode/video_decoder_with_buffer.rs b/videocall-client/src/decode/video_decoder_with_buffer.rs index 071ebbab..42de899d 100644 --- a/videocall-client/src/decode/video_decoder_with_buffer.rs +++ b/videocall-client/src/decode/video_decoder_with_buffer.rs @@ -1,7 +1,7 @@ use super::super::wrappers::EncodedVideoChunkTypeWrapper; use super::video_decoder_wrapper::VideoDecoderTrait; use std::{cmp::Ordering, collections::BTreeMap, sync::Arc}; -use types::protos::media_packet::MediaPacket; +use videocall_types::protos::media_packet::MediaPacket; use wasm_bindgen::JsValue; use web_sys::{CodecState, EncodedVideoChunkType, VideoDecoderConfig, VideoDecoderInit}; @@ -135,7 +135,7 @@ mod test { use std::sync::Mutex; - use types::protos::media_packet::VideoMetadata; + use videocall_types::protos::media_packet::VideoMetadata; use wasm_bindgen::prelude::*; use wasm_bindgen_test::wasm_bindgen_test; diff --git a/videocall-client/src/decode/video_decoder_wrapper.rs b/videocall-client/src/decode/video_decoder_wrapper.rs index 6a87c2d5..caf8b93b 100644 --- a/videocall-client/src/decode/video_decoder_wrapper.rs +++ b/videocall-client/src/decode/video_decoder_wrapper.rs @@ -1,7 +1,7 @@ use super::super::wrappers::EncodedVideoChunkTypeWrapper; use js_sys::Uint8Array; use std::sync::Arc; -use types::protos::media_packet::MediaPacket; +use videocall_types::protos::media_packet::MediaPacket; use wasm_bindgen::JsValue; use web_sys::{ CodecState, EncodedVideoChunk, EncodedVideoChunkInit, VideoDecoder, VideoDecoderConfig, diff --git a/videocall-client/src/encode/camera_encoder.rs b/videocall-client/src/encode/camera_encoder.rs index c0d4cd2c..36f1f5dc 100644 --- a/videocall-client/src/encode/camera_encoder.rs +++ b/videocall-client/src/encode/camera_encoder.rs @@ -6,7 +6,7 @@ use js_sys::Reflect; use log::debug; use log::error; use std::sync::atomic::Ordering; -use types::protos::packet_wrapper::PacketWrapper; +use videocall_types::protos::packet_wrapper::PacketWrapper; use wasm_bindgen::prelude::Closure; use wasm_bindgen::JsCast; use wasm_bindgen::JsValue; diff --git a/videocall-client/src/encode/microphone_encoder.rs b/videocall-client/src/encode/microphone_encoder.rs index 9bae31c8..4533b350 100644 --- a/videocall-client/src/encode/microphone_encoder.rs +++ b/videocall-client/src/encode/microphone_encoder.rs @@ -5,7 +5,7 @@ use js_sys::JsString; use js_sys::Reflect; use log::error; use std::sync::atomic::Ordering; -use types::protos::packet_wrapper::PacketWrapper; +use videocall_types::protos::packet_wrapper::PacketWrapper; use wasm_bindgen::prelude::Closure; use wasm_bindgen::JsCast; use wasm_bindgen::JsValue; diff --git a/videocall-client/src/encode/screen_encoder.rs b/videocall-client/src/encode/screen_encoder.rs index ebdf75d2..423902db 100644 --- a/videocall-client/src/encode/screen_encoder.rs +++ b/videocall-client/src/encode/screen_encoder.rs @@ -4,7 +4,7 @@ use js_sys::JsString; use js_sys::Reflect; use log::error; use std::sync::atomic::Ordering; -use types::protos::packet_wrapper::PacketWrapper; +use videocall_types::protos::packet_wrapper::PacketWrapper; use wasm_bindgen::prelude::Closure; use wasm_bindgen::JsCast; use wasm_bindgen::JsValue; diff --git a/videocall-client/src/encode/transform.rs b/videocall-client/src/encode/transform.rs index d00ffe65..b4f22f09 100644 --- a/videocall-client/src/encode/transform.rs +++ b/videocall-client/src/encode/transform.rs @@ -2,7 +2,7 @@ use super::super::wrappers::{EncodedAudioChunkTypeWrapper, EncodedVideoChunkType use crate::crypto::aes::Aes128State; use protobuf::Message; use std::rc::Rc; -use types::protos::{ +use videocall_types::protos::{ media_packet::{media_packet::MediaType, MediaPacket, VideoMetadata}, packet_wrapper::{packet_wrapper::PacketType, PacketWrapper}, }; diff --git a/video-daemon/.cargo/config.toml b/videocall-daemon/.cargo/config.toml similarity index 100% rename from video-daemon/.cargo/config.toml rename to videocall-daemon/.cargo/config.toml diff --git a/video-daemon/Cargo.lock b/videocall-daemon/Cargo.lock similarity index 93% rename from video-daemon/Cargo.lock rename to videocall-daemon/Cargo.lock index ff9123d8..45130173 100644 --- a/video-daemon/Cargo.lock +++ b/videocall-daemon/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" @@ -48,6 +48,15 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "ansi_term" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" +dependencies = [ + "winapi", +] + [[package]] name = "anstream" version = "0.6.5" @@ -114,6 +123,17 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi 0.1.19", + "libc", + "winapi", +] + [[package]] name = "audiopus_sys" version = "0.2.2" @@ -163,25 +183,25 @@ dependencies = [ [[package]] name = "bindgen" -version = "0.65.1" +version = "0.56.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfdf7b466f9a4903edc73f95d6d2bcd5baf8ae620638762244d3f60143643cc5" +checksum = "2da379dbebc0b76ef63ca68d8fc6e71c0f13e59432e0987e508c1820e6ab5239" dependencies = [ "bitflags 1.3.2", - "cexpr", + "cexpr 0.4.0", "clang-sys", + "clap 2.34.0", + "env_logger", "lazy_static", "lazycell", "log", "peeking_take_while", - "prettyplease 0.2.15", "proc-macro2", "quote", "regex", "rustc-hash", - "shlex", - "syn 2.0.41", - "which", + "shlex 0.1.1", + "which 3.1.1", ] [[package]] @@ -191,7 +211,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "726e4313eb6ec35d2730258ad4e15b547ee75d6afaa1361a922e78e59b7d8078" dependencies = [ "bitflags 2.4.1", - "cexpr", + "cexpr 0.6.0", "clang-sys", "lazy_static", "lazycell", @@ -202,9 +222,9 @@ dependencies = [ "quote", "regex", "rustc-hash", - "shlex", + "shlex 1.2.0", "syn 2.0.41", - "which", + "which 4.4.2", ] [[package]] @@ -214,7 +234,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ffcebc3849946a7170a05992aac39da343a90676ab392c51a4280981d6379c2" dependencies = [ "bitflags 2.4.1", - "cexpr", + "cexpr 0.6.0", "clang-sys", "lazy_static", "lazycell", @@ -223,7 +243,7 @@ dependencies = [ "quote", "regex", "rustc-hash", - "shlex", + "shlex 1.2.0", "syn 2.0.41", ] @@ -314,13 +334,22 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" +[[package]] +name = "cexpr" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4aedb84272dbe89af497cf81375129abda4fc0a9e7c5d317498c15cc30c0d27" +dependencies = [ + "nom 5.1.3", +] + [[package]] name = "cexpr" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" dependencies = [ - "nom", + "nom 7.1.3", ] [[package]] @@ -346,6 +375,21 @@ dependencies = [ "libloading", ] +[[package]] +name = "clap" +version = "2.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" +dependencies = [ + "ansi_term", + "atty", + "bitflags 1.3.2", + "strsim 0.8.0", + "textwrap", + "unicode-width", + "vec_map", +] + [[package]] name = "clap" version = "4.4.11" @@ -365,7 +409,7 @@ dependencies = [ "anstream", "anstyle", "clap_lex", - "strsim", + "strsim 0.10.0", ] [[package]] @@ -696,6 +740,19 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "env_logger" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3" +dependencies = [ + "atty", + "humantime", + "log", + "regex", + "termcolor", +] + [[package]] name = "equivalent" version = "1.0.1" @@ -719,7 +776,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "832a761f35ab3e6664babfbdc6cef35a4860e816ec3916dcfd0882954e98a8a8" dependencies = [ "bit_field", - "flume", + "flume 0.11.0", "half", "lebe", "miniz_oxide", @@ -747,6 +804,19 @@ dependencies = [ "miniz_oxide", ] +[[package]] +name = "flume" +version = "0.10.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1657b4441c3403d9f7b3409e47575237dac27b1b5726df654a6ecbf92f0f7577" +dependencies = [ + "futures-core", + "futures-sink", + "nanorand", + "pin-project", + "spin 0.9.8", +] + [[package]] name = "flume" version = "0.11.0" @@ -1126,6 +1196,15 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + [[package]] name = "hermit-abi" version = "0.3.3" @@ -1152,6 +1231,12 @@ dependencies = [ "itoa", ] +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + [[package]] name = "idna" version = "0.5.0" @@ -1523,39 +1608,43 @@ dependencies = [ [[package]] name = "nokhwa" -version = "0.10.5" -source = "git+https://github.com/security-union/nokhwa?branch=add-yuyv#9e0385c0cf4194c7a8d64bfe3f68247bc6f47700" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99263afbe9d2fbe81c65d2e7aaac9c2e262f4c5fb92060bca8cb86ef8aab2611" dependencies = [ - "flume", + "flume 0.11.0", "image 0.25.2", "nokhwa-bindings-linux", "nokhwa-bindings-macos", "nokhwa-bindings-windows", "nokhwa-core", + "parking_lot", "paste", "thiserror", ] [[package]] name = "nokhwa-bindings-linux" -version = "0.1.1" -source = "git+https://github.com/security-union/nokhwa?branch=add-yuyv#9e0385c0cf4194c7a8d64bfe3f68247bc6f47700" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "448db09af68e12168b6311423409f679d2da6e75fb158b2d75de2f5d6dc460ca" dependencies = [ "nokhwa-core", "v4l", + "v4l2-sys-mit", ] [[package]] name = "nokhwa-bindings-macos" -version = "0.2.2" -source = "git+https://github.com/security-union/nokhwa?branch=add-yuyv#9e0385c0cf4194c7a8d64bfe3f68247bc6f47700" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "739d58859fd2b958f01c25de9a0fbb686be7271e5ef3624150e2be85a627b38a" dependencies = [ "block", "cocoa-foundation", - "core-foundation 0.9.4", "core-media-sys", "core-video-sys", - "flume", + "flume 0.10.14", "nokhwa-core", "objc", "once_cell", @@ -1563,8 +1652,9 @@ dependencies = [ [[package]] name = "nokhwa-bindings-windows" -version = "0.4.1" -source = "git+https://github.com/security-union/nokhwa?branch=add-yuyv#9e0385c0cf4194c7a8d64bfe3f68247bc6f47700" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9b9bae36d0ce413568cefb94c43748e80f9ae97aa0a9e2d8e18f0275a909746" dependencies = [ "nokhwa-core", "once_cell", @@ -1573,8 +1663,9 @@ dependencies = [ [[package]] name = "nokhwa-core" -version = "0.1.3" -source = "git+https://github.com/security-union/nokhwa?branch=add-yuyv#9e0385c0cf4194c7a8d64bfe3f68247bc6f47700" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d87e1f2b3de3b339daa2be71d1d1a09a15250cc2d9e5f808da9bafc8c7d83641" dependencies = [ "bytes", "image 0.25.2", @@ -1582,6 +1673,16 @@ dependencies = [ "thiserror", ] +[[package]] +name = "nom" +version = "5.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08959a387a676302eebf4ddbcbc611da04285579f76f88ee0506c63b1a61dd4b" +dependencies = [ + "memchr", + "version_check", +] + [[package]] name = "nom" version = "7.1.3" @@ -1655,7 +1756,7 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi", + "hermit-abi 0.3.3", "libc", ] @@ -1965,9 +2066,9 @@ dependencies = [ [[package]] name = "protobuf" -version = "3.3.0" +version = "3.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b65f4a8ec18723a734e5dc09c173e0abf9690432da5340285d536edcb4dac190" +checksum = "a3a7c64d9bf75b1b8d981124c14c179074e8caa7dfe7b6a12e6222ddcd0c8f72" dependencies = [ "once_cell", "protobuf-support", @@ -1976,9 +2077,9 @@ dependencies = [ [[package]] name = "protobuf-support" -version = "3.3.0" +version = "3.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6872f4d4f4b98303239a2b5838f5bbbb77b01ffc892d627957f37a22d7cfe69c" +checksum = "b088fd20b938a875ea00843b6faf48579462630015c3788d397ad6a786663252" dependencies = [ "thiserror", ] @@ -2407,6 +2508,12 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "shlex" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" + [[package]] name = "shlex" version = "1.2.0" @@ -2468,6 +2575,12 @@ dependencies = [ "lock_api", ] +[[package]] +name = "strsim" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" + [[package]] name = "strsim" version = "0.10.0" @@ -2496,6 +2609,24 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "termcolor" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "textwrap" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +dependencies = [ + "unicode-width", +] + [[package]] name = "thiserror" version = "1.0.51" @@ -2706,16 +2837,6 @@ dependencies = [ "tracing-log", ] -[[package]] -name = "types" -version = "0.1.0" -dependencies = [ - "protobuf", - "serde", - "serde_json", - "yew-websocket", -] - [[package]] name = "unicode-bidi" version = "0.3.14" @@ -2737,6 +2858,12 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "unicode-width" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" + [[package]] name = "untrusted" version = "0.7.1" @@ -2768,9 +2895,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "v4l" -version = "0.14.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8fbfea44a46799d62c55323f3c55d06df722fbe577851d848d328a1041c3403" +checksum = "fd9946a2fda19c7a729dc72e28b9fd9c653e9b7de954ffe3aecaf51977f88762" dependencies = [ "bitflags 1.3.2", "libc", @@ -2779,11 +2906,11 @@ dependencies = [ [[package]] name = "v4l2-sys-mit" -version = "0.3.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6779878362b9bacadc7893eac76abe69612e8837ef746573c4a5239daf11990b" +checksum = "e0c932c06df4af1dfb229f604214f2a87993784596ff33ffdadcba1b5519254e" dependencies = [ - "bindgen 0.65.1", + "bindgen 0.56.0", ] [[package]] @@ -2792,6 +2919,12 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" +[[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" @@ -2799,13 +2932,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] -name = "video-daemon" -version = "0.1.0" +name = "videocall-daemon" +version = "0.2.0" dependencies = [ "anyhow", "base64", "bus", - "clap", + "clap 4.4.11", "cpal", "directories-next", "env-libvpx-sys", @@ -2823,12 +2956,22 @@ dependencies = [ "tokio", "tracing", "tracing-subscriber", - "types", "url", + "videocall-types", "webpki-roots", "yuv", ] +[[package]] +name = "videocall-types" +version = "0.1.0" +dependencies = [ + "protobuf", + "serde", + "serde_json", + "yew-websocket", +] + [[package]] name = "walkdir" version = "2.4.0" @@ -2933,6 +3076,15 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb" +[[package]] +name = "which" +version = "3.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d011071ae14a2f6671d0b74080ae0cd8ebf3a6f8c9589a2cd45f23126fe29724" +dependencies = [ + "libc", +] + [[package]] name = "which" version = "4.4.2" diff --git a/video-daemon/Cargo.toml b/videocall-daemon/Cargo.toml similarity index 66% rename from video-daemon/Cargo.toml rename to videocall-daemon/Cargo.toml index da08da61..87174839 100644 --- a/video-daemon/Cargo.toml +++ b/videocall-daemon/Cargo.toml @@ -1,20 +1,26 @@ [package] -name = "video-daemon" -version = "0.1.0" +name = "videocall-daemon" +version = "0.2.0" edition = "2021" -description = "Stream audio and video to the videocall-rs backend" license = "MIT" +readme = "README.md" +homepage = "https://github.com/security-union/videocall-rs" +repository = "https://github.com/security-union/videocall-rs" authors = [ "Griffin Obeid ", "Dario Lencina ", ] +keywords = ["quic", "webtransport", "zoom"] +categories = ["network-programming", "multimedia"] +description = "linux native client for the videocall streaming platform" + # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [package.metadata.deb] maintainer = "Dario Lencina " license-file = ["../LICENSE.md", "4"] -depends = "libvpx7 (>= 1.11.0), libvpx-dev (>= 1.11.0), libc6 (>= 2.34), libasound2-dev (>=1.2.8), libv4l-dev (>=1.22.1)" +depends = "libvpx7 (>= 1.11.0), libvpx-dev (>= 1.11.0), libc6 (>= 2.34), libasound2-dev (>=1.2.8), libv4l-dev (>=1.22.1), libssl-dev(>=3.3.1)" [dependencies] anyhow = "1.0.75" @@ -25,8 +31,7 @@ directories-next = "2.0.0" env-libvpx-sys = { version = "5.1.3", features=["generate"] } futures-util = { version = "0.3.28", features = ["sink"] } image = "0.24.7" -nokhwa = { git="https://github.com/security-union/nokhwa", branch="add-yuyv", features = ["input-native"] } -protobuf = "3.2.0" +protobuf = "3.3.0" quinn = "0.10.2" rustls = {version = "0.21.7", features = ["dangerous_configuration"]} serde = { version = "1.0.188", features = ["derive"] } @@ -36,9 +41,16 @@ tracing = "0.1.37" tracing-subscriber = { version = "0.3.17", features = ["env-filter", "fmt", "ansi", "time", "local-time"] } url = "2.4.1" webpki-roots = "0.25.2" -types = { path= "../types"} yuv = "0.1.5" rayon = "1.8.0" thiserror = "1.0.51" cpal = "0.15.2" opus = "0.3.0" + +[dependencies.videocall-types] +path = "../videocall-types" +version = "0.1.0" + +[dependencies.nokhwa] +version = "0.10.6" +features = ["input-native", "output-threaded"] \ No newline at end of file diff --git a/video-daemon/README.md b/videocall-daemon/README.md similarity index 64% rename from video-daemon/README.md rename to videocall-daemon/README.md index 09a54acd..0cb999c1 100644 --- a/video-daemon/README.md +++ b/videocall-daemon/README.md @@ -1,17 +1,22 @@ -# Video Daemon Rust Client +# Video Call Daemon Rust Client + +This is a rust application that can be used to connect to the video call daemon and stream video to a meeting. ## Setup ### Dependencies ```sh -sudo apt install build-essential pkg-config libclang-dev libvpx-dev libasound2-dev libv4l-dev cmake +sudo apt install build-essential pkg-config libclang-dev libvpx-dev libasound2-dev libv4l-dev cmake libssl-dev ``` +## Running using cargo -## Running locally -We recommend using a linux computer with Ubuntu 22. +``` +cargo install videocall-daemon +``` -In our experience doing web development with a rpi is miserable due to the lack of processing power. +## Running locally +We recommend using a linux computer with Ubuntu 24. You can run the project locally by running: @@ -24,6 +29,6 @@ URL can be your local webtransport server or prod https://transport.rustlemania. # Compile deb 1. Install `cargo-deb` with `cargo install cargo-deb` -2. run `cargo deb` this will generate the deb file at `target/debian/video-daemon...deb` +2. run `cargo deb` this will generate the deb file at `target/debian/videocall-daemon...deb` 3. Verify dependencies: `dpkg-deb -I ` 4. Install deb file: `sudo dpkg -i ` diff --git a/video-daemon/build-raspy.sh b/videocall-daemon/build-raspy.sh similarity index 92% rename from video-daemon/build-raspy.sh rename to videocall-daemon/build-raspy.sh index f32eeb76..2a69b82b 100755 --- a/video-daemon/build-raspy.sh +++ b/videocall-daemon/build-raspy.sh @@ -3,7 +3,7 @@ TARGET=aarch64-unknown-linux-gnu sudo apt update -sudo apt install -y libclang-dev libv4l-dev llvm gcc-aarch64-linux-gnu +sudo apt install -y libclang-dev libv4l-dev llvm gcc-aarch64-linux-gnu libssl-dev rustup target add aarch64-unknown-linux-gnu # build binary diff --git a/video-daemon/check_versions.sh b/videocall-daemon/check_versions.sh similarity index 100% rename from video-daemon/check_versions.sh rename to videocall-daemon/check_versions.sh diff --git a/video-daemon/install-raspy.sh b/videocall-daemon/install-raspy.sh similarity index 64% rename from video-daemon/install-raspy.sh rename to videocall-daemon/install-raspy.sh index 094099fa..7c33d5f0 100755 --- a/video-daemon/install-raspy.sh +++ b/videocall-daemon/install-raspy.sh @@ -6,4 +6,4 @@ TARGET=aarch64-unknown-linux-gnu # upload binary ssh-copy-id $USER@$PI_IP -scp -r ./target/$TARGET/release/video-daemon $USER@$PI_IP:/tmp/ \ No newline at end of file +scp -r ./target/$TARGET/release/videocall-daemon $USER@$PI_IP:/tmp/ \ No newline at end of file diff --git a/video-daemon/src/camera.rs b/videocall-daemon/src/camera.rs similarity index 83% rename from video-daemon/src/camera.rs rename to videocall-daemon/src/camera.rs index a51585a6..f254ef69 100644 --- a/video-daemon/src/camera.rs +++ b/videocall-daemon/src/camera.rs @@ -15,11 +15,11 @@ use std::sync::Arc; use std::thread::JoinHandle; use std::time::{Duration, Instant, SystemTime, UNIX_EPOCH}; use tokio::sync::mpsc::{self, Sender}; -use tracing::{debug, error, info, warn}; +use tracing::{debug, error, info}; -use types::protos::media_packet::media_packet::MediaType; -use types::protos::media_packet::{MediaPacket, VideoMetadata}; -use types::protos::packet_wrapper::{packet_wrapper::PacketType, PacketWrapper}; +use videocall_types::protos::media_packet::media_packet::MediaType; +use videocall_types::protos::media_packet::{MediaPacket, VideoMetadata}; +use videocall_types::protos::packet_wrapper::{packet_wrapper::PacketType, PacketWrapper}; type CameraPacket = (Vec, u128); @@ -69,8 +69,6 @@ pub struct CameraConfig { pub struct CameraDaemon { config: CameraConfig, user_id: String, - fps_rx: Option>, - fps_tx: Arc>, cam_rx: Option>>, cam_tx: Arc>>, quic_tx: Arc>>, @@ -84,13 +82,10 @@ impl CameraDaemon { user_id: String, quic_tx: Sender>, ) -> CameraDaemon { - let (fps_tx, fps_rx) = mpsc::channel(5); let (cam_tx, cam_rx) = mpsc::channel(100); CameraDaemon { config, user_id, - fps_rx: Some(fps_rx), - fps_tx: Arc::new(fps_tx), cam_rx: Some(cam_rx), cam_tx: Arc::new(cam_tx), quit: Arc::new(AtomicBool::new(false)), @@ -155,7 +150,6 @@ impl CameraDaemon { } fn encoder_thread(&mut self) -> JoinHandle<()> { - let fps_tx = self.fps_tx.clone(); let mut cam_rx = self.cam_rx.take().unwrap(); let quic_tx = self.quic_tx.clone(); let quit = self.quit.clone(); @@ -190,7 +184,7 @@ impl CameraDaemon { let packet_wrapper = transform_video_chunk(&frame, &user_id); if let Err(e) = quic_tx.try_send(packet_wrapper.write_to_bytes().unwrap()) { error!("Unable to send packet: {:?}", e); - } + } // else if let Err(e) = fps_tx.try_send(since_the_epoch().as_millis()) { // error!("Unable to send fps: {:?}", e); // } @@ -199,28 +193,6 @@ impl CameraDaemon { }) } - fn fps_thread(&mut self) -> JoinHandle<()> { - let mut fps_rx = self.fps_rx.take().unwrap(); - let quit = self.quit.clone(); - std::thread::spawn(move || { - let mut num_frames = 0; - let mut now_plus_1 = since_the_epoch().as_millis() + 1000; - warn!("Starting fps loop"); - while let Some(dur) = fps_rx.blocking_recv() { - if quit.load(std::sync::atomic::Ordering::Relaxed) { - return; - } - if now_plus_1 < dur { - warn!("FPS: {:?}", num_frames); - num_frames = 0; - now_plus_1 = since_the_epoch().as_millis() + 1000; - } else { - num_frames += 1; - } - } - }) - } - pub fn stop(&mut self) -> Result<()> { self.quit.store(true, std::sync::atomic::Ordering::Relaxed); for handle in self.handles.drain(..) { diff --git a/video-daemon/src/fake_cert_verifier.rs b/videocall-daemon/src/fake_cert_verifier.rs similarity index 100% rename from video-daemon/src/fake_cert_verifier.rs rename to videocall-daemon/src/fake_cert_verifier.rs diff --git a/video-daemon/src/lib.rs b/videocall-daemon/src/lib.rs similarity index 100% rename from video-daemon/src/lib.rs rename to videocall-daemon/src/lib.rs diff --git a/video-daemon/src/main.rs b/videocall-daemon/src/main.rs similarity index 90% rename from video-daemon/src/main.rs rename to videocall-daemon/src/main.rs index 059884ec..8d550449 100644 --- a/video-daemon/src/main.rs +++ b/videocall-daemon/src/main.rs @@ -1,9 +1,9 @@ use clap::Parser; use tokio::sync::mpsc::channel; -use video_daemon::camera::{CameraConfig, CameraDaemon}; -use video_daemon::microphone::MicrophoneDaemon; -use video_daemon::quic::{Client, ClientError, Opt}; +use videocall_daemon::camera::{CameraConfig, CameraDaemon}; +use videocall_daemon::microphone::MicrophoneDaemon; +use videocall_daemon::quic::{Client, ClientError, Opt}; #[tokio::main] async fn main() { @@ -31,7 +31,7 @@ async fn main() { let mut camera = CameraDaemon::from_config(camera_config, user_id.clone(), quic_tx.clone()); camera.start().expect("failed to start camera"); let mut microphone = MicrophoneDaemon::default(); - if let Some(audio_device) = audio_device { + if let Some(audio_device) = audio_device { microphone .start(quic_tx, audio_device, user_id) .expect("failed to start microphone"); diff --git a/video-daemon/src/microphone.rs b/videocall-daemon/src/microphone.rs similarity index 90% rename from video-daemon/src/microphone.rs rename to videocall-daemon/src/microphone.rs index 53ff0bc3..54abba1c 100644 --- a/video-daemon/src/microphone.rs +++ b/videocall-daemon/src/microphone.rs @@ -7,10 +7,10 @@ use std::thread::JoinHandle; use std::time::Duration; use tokio::sync::mpsc::Sender; use tracing::{error, info}; -use types::protos::media_packet::media_packet::MediaType; -use types::protos::media_packet::{MediaPacket, VideoMetadata}; -use types::protos::packet_wrapper::packet_wrapper::PacketType; -use types::protos::packet_wrapper::PacketWrapper; +use videocall_types::protos::media_packet::media_packet::MediaType; +use videocall_types::protos::media_packet::{MediaPacket, VideoMetadata}; +use videocall_types::protos::packet_wrapper::packet_wrapper::PacketType; +use videocall_types::protos::packet_wrapper::PacketWrapper; pub struct MicrophoneDaemon { stop: Arc, @@ -74,11 +74,13 @@ fn start_microphone( .expect("failed to find input device"); info!("Input device: {}", device.name()?); - let range = cpal::SupportedBufferSize::Range { - min: 960, - max: 960 - }; - let config = cpal::SupportedStreamConfig::new(1, cpal::SampleRate(48000), range, cpal::SampleFormat::I16); + let range = cpal::SupportedBufferSize::Range { min: 960, max: 960 }; + let config = cpal::SupportedStreamConfig::new( + 1, + cpal::SampleRate(48000), + range, + cpal::SampleFormat::I16, + ); let mut encoder = opus::Encoder::new(48000, Channels::Mono, opus::Application::Voip)?; info!("Opus encoder created {:?}", encoder); diff --git a/video-daemon/src/quic.rs b/videocall-daemon/src/quic.rs similarity index 99% rename from video-daemon/src/quic.rs rename to videocall-daemon/src/quic.rs index 3f97ecbb..c03ffcd6 100644 --- a/video-daemon/src/quic.rs +++ b/videocall-daemon/src/quic.rs @@ -1,7 +1,7 @@ use clap::Parser; use protobuf::Message; use quinn::ConnectError; -use types::protos::{ +use videocall_types::protos::{ connection_packet::ConnectionPacket, packet_wrapper::{packet_wrapper::PacketType, PacketWrapper}, }; diff --git a/video-daemon/src/video_encoder.rs b/videocall-daemon/src/video_encoder.rs similarity index 100% rename from video-daemon/src/video_encoder.rs rename to videocall-daemon/src/video_encoder.rs diff --git a/video-daemon/start_cameras.sh b/videocall-daemon/start_cameras.sh similarity index 100% rename from video-daemon/start_cameras.sh rename to videocall-daemon/start_cameras.sh diff --git a/types/.gitignore b/videocall-types/.gitignore similarity index 100% rename from types/.gitignore rename to videocall-types/.gitignore diff --git a/videocall-types/Cargo.toml b/videocall-types/Cargo.toml new file mode 100644 index 00000000..e1f5af7c --- /dev/null +++ b/videocall-types/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "videocall-types" +version = "0.1.0" +edition = "2021" +homepage = "https://github.com/security-union/videocall-rs" +repository = "https://github.com/security-union/videocall-rs" +license = "MIT" +readme = "README.md" +authors = [ + "Dario Lencina " +] +keywords = ["quic", "webtransport", "zoom"] +categories = ["network-programming", "multimedia"] +description = "types for the videocall streaming platform" + + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +serde_json = "1.0.81" +serde = { version = "1.0.37", features = ["derive"]} +protobuf = "=3.7.1" +yew-websocket = "1.0.1" \ No newline at end of file diff --git a/videocall-types/LICENSE b/videocall-types/LICENSE new file mode 100644 index 00000000..f415aeec --- /dev/null +++ b/videocall-types/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Security Union + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/videocall-types/README.md b/videocall-types/README.md new file mode 100644 index 00000000..4a056f26 --- /dev/null +++ b/videocall-types/README.md @@ -0,0 +1,40 @@ + +# videocall-types + +`videocall-types` is a Rust library that provides the shared types and definitions for the [videocall.rs](https://videocall.rs) teleconferencing system. This crate contains essential data structures and type definitions used across the system, enabling seamless communication and interoperability between components. + +## Main Repo + +If you are new to videocall you should start at our repo [videocall](https://github.com/security-union/videocall-rs) + +## Features + +- **Common Data Models**: Standardized types for messages, user sessions, room configurations, and more. +- **Serialization/Deserialization**: Implementations for Protobuf to enable efficient data transfer (well better than JSON). +- **Type Safety**: Strongly-typed structures to reduce errors in communication. + +## Usage + +To use `videocall-types`, add it to your `Cargo.toml`: + +```toml +[dependencies] +videocall-types = "0.1" +``` + +Then, import and use the types in your project: + +```rust +use videocall_types::protos::{ + connection_packet::ConnectionPacket, + packet_wrapper::{packet_wrapper::PacketType, PacketWrapper}, +}; +``` + +## About `videocall.rs` + +The `videocall.rs` system is an open-source, real-time teleconferencing platform built with Rust, WebTransport, and HTTP/3, designed for high-performance and low-latency communication. + +## License + +This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details. diff --git a/types/src/lib.rs b/videocall-types/src/lib.rs similarity index 100% rename from types/src/lib.rs rename to videocall-types/src/lib.rs diff --git a/types/src/protos/aes_packet.rs b/videocall-types/src/protos/aes_packet.rs similarity index 97% rename from types/src/protos/aes_packet.rs rename to videocall-types/src/protos/aes_packet.rs index 1ebc7739..4bbd4067 100644 --- a/types/src/protos/aes_packet.rs +++ b/videocall-types/src/protos/aes_packet.rs @@ -1,5 +1,5 @@ -// This file is generated by rust-protobuf 3.3.0. Do not edit -// .proto file is parsed by protoc --rust-out=... +// This file is generated by rust-protobuf 3.7.1. Do not edit +// .proto file is parsed by protoc --rs_out=... // @generated // https://github.com/rust-lang/rust-clippy/issues/702 @@ -9,7 +9,6 @@ #![allow(unused_attributes)] #![cfg_attr(rustfmt, rustfmt::skip)] -#![allow(box_pointers)] #![allow(dead_code)] #![allow(missing_docs)] #![allow(non_camel_case_types)] @@ -23,7 +22,7 @@ /// Generated files are compatible only with the same version /// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; +const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_7_1; // @@protoc_insertion_point(message:AesPacket) #[derive(PartialEq,Clone,Default,Debug)] diff --git a/types/src/protos/connection_packet.rs b/videocall-types/src/protos/connection_packet.rs similarity index 97% rename from types/src/protos/connection_packet.rs rename to videocall-types/src/protos/connection_packet.rs index 389fb03f..5e2c17ea 100644 --- a/types/src/protos/connection_packet.rs +++ b/videocall-types/src/protos/connection_packet.rs @@ -1,5 +1,5 @@ -// This file is generated by rust-protobuf 3.3.0. Do not edit -// .proto file is parsed by protoc --rust-out=... +// This file is generated by rust-protobuf 3.7.1. Do not edit +// .proto file is parsed by protoc --rs_out=... // @generated // https://github.com/rust-lang/rust-clippy/issues/702 @@ -9,7 +9,6 @@ #![allow(unused_attributes)] #![cfg_attr(rustfmt, rustfmt::skip)] -#![allow(box_pointers)] #![allow(dead_code)] #![allow(missing_docs)] #![allow(non_camel_case_types)] @@ -23,7 +22,7 @@ /// Generated files are compatible only with the same version /// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; +const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_7_1; // @@protoc_insertion_point(message:ConnectionPacket) #[derive(PartialEq,Clone,Default,Debug)] diff --git a/types/src/protos/media_packet.rs b/videocall-types/src/protos/media_packet.rs similarity index 99% rename from types/src/protos/media_packet.rs rename to videocall-types/src/protos/media_packet.rs index d4bde114..acf88b29 100644 --- a/types/src/protos/media_packet.rs +++ b/videocall-types/src/protos/media_packet.rs @@ -1,5 +1,5 @@ -// This file is generated by rust-protobuf 3.3.0. Do not edit -// .proto file is parsed by protoc --rust-out=... +// This file is generated by rust-protobuf 3.7.1. Do not edit +// .proto file is parsed by protoc --rs_out=... // @generated // https://github.com/rust-lang/rust-clippy/issues/702 @@ -9,7 +9,6 @@ #![allow(unused_attributes)] #![cfg_attr(rustfmt, rustfmt::skip)] -#![allow(box_pointers)] #![allow(dead_code)] #![allow(missing_docs)] #![allow(non_camel_case_types)] @@ -23,7 +22,7 @@ /// Generated files are compatible only with the same version /// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; +const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_7_1; // @@protoc_insertion_point(message:MediaPacket) #[derive(PartialEq,Clone,Default,Debug)] diff --git a/types/src/protos/mod.rs b/videocall-types/src/protos/mod.rs similarity index 100% rename from types/src/protos/mod.rs rename to videocall-types/src/protos/mod.rs diff --git a/types/src/protos/packet_wrapper.rs b/videocall-types/src/protos/packet_wrapper.rs similarity index 98% rename from types/src/protos/packet_wrapper.rs rename to videocall-types/src/protos/packet_wrapper.rs index feb49da7..9b27ec3e 100644 --- a/types/src/protos/packet_wrapper.rs +++ b/videocall-types/src/protos/packet_wrapper.rs @@ -1,5 +1,5 @@ -// This file is generated by rust-protobuf 3.3.0. Do not edit -// .proto file is parsed by protoc --rust-out=... +// This file is generated by rust-protobuf 3.7.1. Do not edit +// .proto file is parsed by protoc --rs_out=... // @generated // https://github.com/rust-lang/rust-clippy/issues/702 @@ -9,7 +9,6 @@ #![allow(unused_attributes)] #![cfg_attr(rustfmt, rustfmt::skip)] -#![allow(box_pointers)] #![allow(dead_code)] #![allow(missing_docs)] #![allow(non_camel_case_types)] @@ -23,7 +22,7 @@ /// Generated files are compatible only with the same version /// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; +const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_7_1; // @@protoc_insertion_point(message:PacketWrapper) #[derive(PartialEq,Clone,Default,Debug)] diff --git a/types/src/protos/rsa_packet.rs b/videocall-types/src/protos/rsa_packet.rs similarity index 97% rename from types/src/protos/rsa_packet.rs rename to videocall-types/src/protos/rsa_packet.rs index 4649df28..530bd685 100644 --- a/types/src/protos/rsa_packet.rs +++ b/videocall-types/src/protos/rsa_packet.rs @@ -1,5 +1,5 @@ -// This file is generated by rust-protobuf 3.3.0. Do not edit -// .proto file is parsed by protoc --rust-out=... +// This file is generated by rust-protobuf 3.7.1. Do not edit +// .proto file is parsed by protoc --rs_out=... // @generated // https://github.com/rust-lang/rust-clippy/issues/702 @@ -9,7 +9,6 @@ #![allow(unused_attributes)] #![cfg_attr(rustfmt, rustfmt::skip)] -#![allow(box_pointers)] #![allow(dead_code)] #![allow(missing_docs)] #![allow(non_camel_case_types)] @@ -23,7 +22,7 @@ /// Generated files are compatible only with the same version /// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; +const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_7_1; // @@protoc_insertion_point(message:RsaPacket) #[derive(PartialEq,Clone,Default,Debug)] diff --git a/yew-ui/Cargo.lock b/yew-ui/Cargo.lock index bfed9749..3c295421 100644 --- a/yew-ui/Cargo.lock +++ b/yew-ui/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" @@ -1170,9 +1170,9 @@ dependencies = [ [[package]] name = "protobuf" -version = "3.3.0" +version = "3.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b65f4a8ec18723a734e5dc09c173e0abf9690432da5340285d536edcb4dac190" +checksum = "a3a7c64d9bf75b1b8d981124c14c179074e8caa7dfe7b6a12e6222ddcd0c8f72" dependencies = [ "once_cell", "protobuf-support", @@ -1181,9 +1181,9 @@ dependencies = [ [[package]] name = "protobuf-support" -version = "3.3.0" +version = "3.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6872f4d4f4b98303239a2b5838f5bbbb77b01ffc892d627957f37a22d7cfe69c" +checksum = "b088fd20b938a875ea00843b6faf48579462630015c3788d397ad6a786663252" dependencies = [ "thiserror", ] @@ -1515,16 +1515,6 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" -[[package]] -name = "types" -version = "0.1.0" -dependencies = [ - "protobuf", - "serde", - "serde_json", - "yew-websocket", -] - [[package]] name = "unicode-ident" version = "1.0.12" @@ -1571,7 +1561,7 @@ dependencies = [ "protobuf", "rand", "rsa", - "types", + "videocall-types", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", @@ -1580,6 +1570,16 @@ dependencies = [ "yew-webtransport", ] +[[package]] +name = "videocall-types" +version = "0.1.0" +dependencies = [ + "protobuf", + "serde", + "serde_json", + "yew-websocket", +] + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -1786,9 +1786,9 @@ dependencies = [ "reqwasm", "serde", "serde_derive", - "types", "urlencoding", "videocall-client", + "videocall-types", "wasm-bindgen", "wasm-bindgen-futures", "wasm-bindgen-test", diff --git a/yew-ui/Cargo.toml b/yew-ui/Cargo.toml index 11968261..ab7b18cb 100644 --- a/yew-ui/Cargo.toml +++ b/yew-ui/Cargo.toml @@ -9,7 +9,7 @@ edition = "2021" yew = { version = "0.21", features = ["csr"] } wasm-bindgen = "0.2.78" reqwasm = "0.5.0" -types = { path= "../types"} +videocall-types = { path= "../videocall-types"} videocall-client = { path= "../videocall-client"} console_error_panic_hook = "0.1.7" console_log = "1.0.0" @@ -21,7 +21,7 @@ gloo-utils = "0.1" yew-router = "0.18" serde = "1" serde_derive = "1" -protobuf = "3.2.0" +protobuf = "3.3.0" gloo = "0.8.0" urlencoding = "2.1.2" getrandom = { version = "0.2.10", features = ["js"] } diff --git a/yew-ui/rust-toolchain.toml b/yew-ui/rust-toolchain.toml index a09cf934..5ae0a52a 100644 --- a/yew-ui/rust-toolchain.toml +++ b/yew-ui/rust-toolchain.toml @@ -1,2 +1,3 @@ [toolchain] +channel = "nightly-2024-08-21" targets = [ "wasm32-unknown-unknown" ] \ No newline at end of file diff --git a/yew-ui/src/components/attendants.rs b/yew-ui/src/components/attendants.rs index d3d37b67..66b35e55 100644 --- a/yew-ui/src/components/attendants.rs +++ b/yew-ui/src/components/attendants.rs @@ -2,8 +2,8 @@ use crate::components::{canvas_generator, peer_list::PeerList}; use crate::constants::{CANVAS_LIMIT, USERS_ALLOWED_TO_STREAM, WEBTRANSPORT_HOST}; use crate::{components::host::Host, constants::ACTIX_WEBSOCKET}; use log::{error, warn}; -use types::protos::media_packet::media_packet::MediaType; use videocall_client::{MediaDeviceAccess, VideoCallClient, VideoCallClientOptions}; +use videocall_types::protos::media_packet::media_packet::MediaType; use wasm_bindgen::JsValue; use web_sys::*; use yew::prelude::*; diff --git a/yew-ui/src/constants.rs b/yew-ui/src/constants.rs index 655a36b1..2588e1bf 100644 --- a/yew-ui/src/constants.rs +++ b/yew-ui/src/constants.rs @@ -1,4 +1,4 @@ -use types::truthy; +use videocall_types::truthy; // This is read at compile time, please restart if you change this value. pub const LOGIN_URL: &str = std::env!("LOGIN_URL"); diff --git a/yew-ui/src/main.rs b/yew-ui/src/main.rs index fdffabf4..4910b4f8 100644 --- a/yew-ui/src/main.rs +++ b/yew-ui/src/main.rs @@ -5,7 +5,7 @@ mod constants; mod pages; use constants::{E2EE_ENABLED, LOGIN_URL, WEBTRANSPORT_ENABLED}; -use types::truthy; +use videocall_types::truthy; use log::info; use yew::prelude::*;