21 lines
811 B
Rust
21 lines
811 B
Rust
//! UDP High-speed Voice Packet structures.
|
|
//!
|
|
//! Defines the headers and payload structures for the low-latency voice data
|
|
//! sent over UDP.
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
/// The header attached to every UDP voice frame.
|
|
///
|
|
/// We separate this from the payload to allow the server to rapidly route packets
|
|
/// using just the `session_token` without fully deserializing the heavy audio data.
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct VoicePacketHeader {
|
|
/// The unique session ID matching the client's TCP authentication token.
|
|
pub session_token: u32,
|
|
/// A strictly increasing sequence number to detect dropped or out-of-order packets.
|
|
pub sequence_num: u64,
|
|
/// The timestamp of the packet generation, used to align jitter buffers.
|
|
pub timestamp: u64,
|
|
}
|