Files
songbird/src/driver/tasks/message/mixer.rs
Kyle Simpson 504b8dfaef Driver, Input: Performance & Benchmarks (#27)
* Driver Benchmarks

Benchmarks driver use cases for single packet send,
multiple packet send, float vs opus, and the cost of
head-of-queue track removal.

Mix costs for large packet counts are also included.

This is a prelude to the optimisations discussed in
#21.

* Typo in benchmark

* Place Opus packet directly into packet buffer

Cleans up some other logic surrounding this, too. Gets a 16.9% perf improvement on opus packet passthrough (sub 5us here).

* Better track removal

In theory this should be faster, but it aint. Keeping in case
reducing struct sizes down the line magically makes this
faster.

* Reduce size of Input, TrackHandle

Metadata is now boxed away. Similarly, TrackHandles are neatly Arc'd to reduce their size to pointer length (and mitigate the impact of copies if we add in more fields).
2020-12-26 23:08:35 +00:00

44 lines
892 B
Rust

#![allow(missing_docs)]
use super::{Interconnect, UdpRxMessage, UdpTxMessage, WsMessage};
use crate::{
driver::{Config, CryptoState},
tracks::Track,
Bitrate,
};
use flume::Sender;
use xsalsa20poly1305::XSalsa20Poly1305 as Cipher;
pub struct MixerConnection {
pub cipher: Cipher,
pub crypto_state: CryptoState,
pub udp_rx: Sender<UdpRxMessage>,
pub udp_tx: Sender<UdpTxMessage>,
}
impl Drop for MixerConnection {
fn drop(&mut self) {
let _ = self.udp_rx.send(UdpRxMessage::Poison);
let _ = self.udp_tx.send(UdpTxMessage::Poison);
}
}
pub enum MixerMessage {
AddTrack(Track),
SetTrack(Option<Track>),
SetBitrate(Bitrate),
SetConfig(Config),
SetMute(bool),
SetConn(MixerConnection, u32),
Ws(Option<Sender<WsMessage>>),
DropConn,
ReplaceInterconnect(Interconnect),
RebuildEncoder,
Poison,
}