Files
songbird/Cargo.toml
Kyle Simpson 2277595be4 Driver: Split receive into its own feature (#141)
Adds the "receive" feature, which is disabled by default. When this is disabled, the UDP receive task is not compiled and not run, and as an optimisation the UDP receive buffer size is set to 0. All related events are also removed.

This also removes the UDP Tx task, and moves packet and keepalive sends back into the mixer thread. This allows us to entirely remove channels and various allocations between the mixer and an async task created only for sending data (i.e., fewer memcopies).

If "receive" is enabled, UDP sends are now non-blocking due to technical constraints -- failure to send is non-fatal, but *will* drop affected packets. Given that blocking on a UDP send indicates that the OS cannot clear send buffers fast enough, this should alleviate OS load.

Closes #131.
2023-11-20 00:02:54 +00:00

171 lines
4.8 KiB
TOML

[package]
authors = ["Kyle Simpson <kyleandrew.simpson@gmail.com>"]
description = "An async Rust library for the Discord voice API."
documentation = "https://docs.rs/songbird"
edition = "2021"
homepage = "https://github.com/serenity-rs/songbird"
include = ["src/**/*.rs", "Cargo.toml", "build.rs"]
keywords = ["discord", "api", "rtp", "audio"]
license = "ISC"
name = "songbird"
readme = "README.md"
repository = "https://github.com/serenity-rs/songbird.git"
rust-version = "1.61"
version = "0.3.0"
[dependencies]
async-trait = { optional = true, version = "0.1" }
audiopus = { optional = true, version = "0.3.0-rc.0" }
byteorder = { optional = true, version = "1" }
dashmap = { optional = true, version = "5" }
derivative = "2"
discortp = { default-features = false, features = ["discord", "pnet", "rtp"], optional = true, version = "0.5" }
flume = { optional = true, version = "0.10" }
futures = "0.3"
once_cell = { optional = true, version = "1" }
parking_lot = { optional = true, version = "0.12" }
pin-project = "1"
rand = { optional = true, version = "0.8" }
reqwest = { default-features = false, features = ["stream"], optional = true, version = "0.11" }
ringbuf = { optional = true, version = "0.2" }
rubato = { optional = true, version = "0.12" }
rusty_pool = { optional = true, version = "0.7" }
serde = { version = "1", features = ["derive"] }
serde-aux = { default-features = false, optional = true, version = "3"}
serde_json = "1"
simd-json = { features = ["serde_impl"], optional = true, version = "0.6.0" }
socket2 = { optional = true, version = "0.4" }
streamcatcher = { optional = true, version = "1" }
tokio = { default-features = false, optional = true, version = "1.0" }
tokio-tungstenite = { optional = true, version = "0.17" }
tokio-util = { features = ["io"], optional = true, version = "0.7" }
tracing = { version = "0.1", features = ["log"] }
tracing-futures = "0.2"
twilight-gateway = { default-features = false, optional = true, version = "0.12.0" }
twilight-model = { default-features = false, optional = true, version = "0.12.0" }
typemap_rev = { optional = true, version = "0.1" }
url = { optional = true, version = "2" }
uuid = { features = ["v4"], optional = true, version = "1" }
xsalsa20poly1305 = { features = ["std"], optional = true, version = "0.8" }
[dependencies.serenity]
version = "0.11"
default-features = false
features = ["voice", "gateway"]
optional = true
[dependencies.serenity-voice-model]
version = "0.11"
optional = true
[dependencies.symphonia]
branch = "songbird-fixes"
git = "https://github.com/FelixMcFelix/Symphonia"
default-features = false
optional = true
version = "0.5"
[dependencies.symphonia-core]
branch = "songbird-fixes"
git = "https://github.com/FelixMcFelix/Symphonia"
optional = true
version = "0.5"
[dev-dependencies]
criterion = "0.3"
ntest = "0.8"
symphonia = { version = "0.5", features = ["mp3"], git = "https://github.com/FelixMcFelix/Symphonia", branch = "songbird-fixes" }
utils = { path = "utils" }
tokio = { version = "1", features = ["rt", "rt-multi-thread"] }
[features]
# Core features
default = [
"driver",
"gateway",
"rustls",
"serenity",
]
gateway = [
"dep:async-trait",
"dep:dashmap",
"dep:flume",
"dep:once_cell",
"dep:parking_lot",
"dep:tokio",
"tokio?/sync",
"tokio?/time",
]
driver = [
"dep:async-trait",
"dep:audiopus",
"dep:byteorder",
"dep:discortp",
"dep:reqwest",
"dep:flume",
"dep:once_cell",
"dep:parking_lot",
"dep:rand",
"dep:ringbuf",
"dep:rubato",
"dep:rusty_pool",
"dep:serde-aux",
"dep:serenity-voice-model",
"dep:socket2",
"dep:streamcatcher",
"dep:symphonia",
"dep:symphonia-core",
"dep:tokio",
"dep:tokio-tungstenite",
"dep:tokio-util",
"dep:typemap_rev",
"dep:url",
"dep:uuid",
"dep:xsalsa20poly1305",
"tokio?/fs",
"tokio?/io-util",
"tokio?/macros",
"tokio?/net",
"tokio?/process",
"tokio?/rt",
"tokio?/sync",
"tokio?/time",
]
rustls = [
"reqwest?/rustls-tls",
"serenity?/rustls_backend",
"tokio-tungstenite?/rustls-tls-webpki-roots",
"twilight-gateway?/rustls-native-roots",
]
native = [
"reqwest?/native-tls",
"serenity?/native_tls_backend",
"tokio-tungstenite?/native-tls",
"twilight-gateway?/native",
]
twilight = ["dep:twilight-gateway","dep:twilight-model"]
# Behaviour altering features.
builtin-queue = []
receive = ["discortp?/demux", "discortp?/rtcp"]
# Used for docgen/testing/benchmarking.
full-doc = ["default", "twilight", "builtin-queue", "receive"]
internals = []
[[bench]]
name = "base-mixing"
path = "benches/base-mixing.rs"
required-features = ["internals"]
harness = false
[[bench]]
name = "mixing-task"
path = "benches/mixing-task.rs"
required-features = ["internals"]
harness = false
[package.metadata.docs.rs]
features = ["full-doc"]
rustdoc-args = ["--cfg", "docsrs"]