Files
songbird/src/driver/decode_mode.rs
Kyle Simpson c60c454cf5 Driver/receive: Implement audio reorder/jitter buffer (#156)
This PR Introduces a new `VoiceTick` event which collects and reorders all RTP packets to smooth over network instability, as well as to synchronise user audio streams. Raw packet events have been moved to `RtpPacket`, while `SpeakingUpdate`s have been removed as they can be easily computed using the `silent`/`speaking` audio maps included in each event.

Closes #146.
2023-11-20 00:02:55 +00:00

27 lines
729 B
Rust

/// Decode behaviour for received RTP packets within the driver.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[non_exhaustive]
pub enum DecodeMode {
/// Packets received from Discord are handed over to events without any
/// changes applied.
///
/// No CPU work involved.
Pass,
/// Decrypts the body of each received packet.
///
/// Small per-packet CPU use.
Decrypt,
/// Decrypts and decodes each received packet, correctly accounting for losses.
///
/// Larger per-packet CPU use.
Decode,
}
impl DecodeMode {
/// Returns whether this mode will decrypt received packets.
#[must_use]
pub fn should_decrypt(self) -> bool {
self != DecodeMode::Pass
}
}