Skip to content

Lightweight native Discord client for Windows, Linux and macOS, written in Rust. No Electron, no browser engine.

4.5 KB
Raw Blame
# Discord voice and Go Live client for RustCord, adapted from Serein's `discord-voice`
# crate (https://github.com/ViceVerse-cz/Serein, MIT OR Apache-2.0). See NOTICE.md.
#
# A member of the root workspace: it shares the root Cargo.lock and the root's
# `[patch.crates-io]` (davey, hpke-rs). Test it with `cargo test -p voice`.
[package]
name = "voice"
version = "0.1.0"
edition = "2024"
license = "MIT OR Apache-2.0"
description = "Discord voice and Go Live (gateway v8, UDP/RTP, RTCP, DAVE E2EE, Opus, H.264) for RustCord, adapted from Serein"
publish = false

# Versions follow Serein's exact pins (its Cargo.toml / Cargo.lock at a0e72cc).
[dependencies]
tokio = { version = "1.50", features = ["rt", "macros", "sync", "time", "net"] }
tokio-tungstenite = { version = "=0.30.0", default-features = false, features = ["connect", "rustls-tls-webpki-roots"] }
# Serein's graph gets rustls' aws-lc-rs provider from other crates; this crate has none, so
# it names ring explicitly (already in the graph through rustls-webpki; no C/NASM build).
rustls = { version = "=0.23.46", default-features = false, features = ["ring", "std", "tls12"] }
webpki-roots = "=1.0.11"
futures-util = { version = "0.3", default-features = false, features = ["sink", "std"] }
serde_json = "1"
zeroize = "1.8"
url = "2"
getrandom = "0.4"
# RustCord: audio device failures and recoveries go to the app's log (rustcord.log).
log = "0.4"
# Upstream DAVE/MLS trace statements can contain key material: compile all of it out.
tracing = { version = "0.1", default-features = false, features = ["max_level_off", "release_max_level_off"] }
davey = { version = "=0.1.4", default-features = false }
openmls = { version = "=0.8.1", default-features = false }
chacha20poly1305 = { version = "=0.10.1", default-features = false, features = ["alloc"] }
opus2 = { version = "=0.4.0", default-features = false, features = ["backend-libopus", "static", "bundled"] }
rtrb = "=0.4.0"
cpal = { version = "=0.18.2", default-features = false }
# RustCord: "Voice Isolation" noise suppression (pure-Rust RNNoise port, BSD-3-Clause).
# No default features: those build its command-line tool.
nnnoiseless = { version = "=0.5.2", default-features = false }
# RustCord: "Echo Cancellation" (WebRTC's AEC3 as a pure-Rust port, BSD-3-Clause); no C++
# or build script.
sonora = "=0.3.0"
# Go Live: H.264 decoding of watched streams where Media Foundation is unavailable, and
# the encoder fallback when Media Foundation has no hardware H.264 encoder. Built from the
# bundled Cisco sources.
openh264 = { version = "=0.9.8", default-features = false, features = ["source"] }
# Go Live: decoded pictures are converted to RGBA in parallel row bands. Already in the
# graph (windows-capture, openmls), so nothing new is compiled.
rayon = "=1.12.0"
# Go Live: a larger UDP receive buffer, so keyframe bursts survive a busy media thread
# instead of becoming kernel drops. Already in the graph through tokio's `net` feature.
socket2 = "=0.6.5"

[target.'cfg(target_os = "windows")'.dependencies]
# 1 ms timer resolution and power-throttling opt-out while a call runs (timer.rs); Go Live
# screen capture consent, Media Foundation H.264 encoding and decoding (DXVA through a
# Direct3D 11 device), and process-loopback audio.
windows = { version = "=0.61.3", features = [
    "Win32_Media",
    "Win32_System_Threading",
    "Win32_Foundation",
    "Win32_Media_MediaFoundation",
    "Win32_Graphics_Direct3D",
    "Win32_Graphics_Direct3D11",
    "Win32_Graphics_Dxgi",
    "Win32_Graphics_Dxgi_Common",
    "Win32_Media_Audio",
    "Win32_System_Com",
    "Win32_System_Com_StructuredStorage",
    "Win32_System_Variant",
    "Win32_System_Ole",
    "Win32_System_WinRT",
    "Win32_Security",
    "Win32_Graphics_Dwm",
    # The Go Live pointer drawn into captured frames.
    "Win32_Graphics_Gdi",
    "Win32_UI_HiDpi",
    "Win32_UI_WindowsAndMessaging",
    "Foundation",
    "Graphics_Capture",
    "Security_Authorization_AppCapabilityAccess",
] }
# `#[implement]` (the WASAPI activation callback) expands to `::windows_core` paths.
windows-core = "=0.61.2"
windows-future = "=0.2.1"
# Windows Graphics Capture (monitors and windows), as in Serein.
windows-capture = "=2.0.1"

[dev-dependencies]
# RustCord drives `connect` from a multi-threaded runtime; the API tests do the same.
tokio = { version = "1.50", features = ["rt-multi-thread", "io-util"] }
sha3 ={ version = "=0.10.9", default-features = false }
openmls_rust_crypto = "=0.5.1"
openmls_basic_credential = "=0.5.0"

[lints.rust]
unsafe_code = "deny"