pub struct AudioCaptureSettings {Show 13 fields
pub device_name: Option<String>,
pub sample_rate: u32,
pub channels: i32,
pub opus_bitrate: i32,
pub frame_duration_ms: f64,
pub use_vbr: bool,
pub opus_complexity: Option<i32>,
pub use_silence_gate: bool,
pub debug_logging: bool,
pub latency_ms: i32,
pub omit_audio_header: bool,
pub red_distance: i32,
pub output_socket: String,
}Expand description
Capture/encode configuration, read once by AudioCapture::start. Default is the
configuration the Python AudioCaptureSettings starts with: the system default source,
48 kHz stereo at 128 kbps VBR in 20 ms frames, the silence gate on, the audio header
emitted, no RED, no output socket.
Fields§
§device_name: Option<String>The PulseAudio source to record; None or empty for the system default.
sample_rate: u328000, 12000, 16000, 24000, or 48000.
channels: i321, 2, 6 (5.1), or 8 (7.1).
opus_bitrate: i32Opus target bitrate in bits/s, clamped into the encoder’s range at start.
frame_duration_ms: f642.5, 5, 10, 20, 40, or 60.
use_vbr: bool§opus_complexity: Option<i32>Opus encoder complexity, 0 (cheapest) to 10; None leaves libopus’s default.
Applied when the encoder is created, so it does not change during a running capture.
use_silence_gate: boolDrop frames of digital silence before encoding them.
debug_logging: boolPrint a status line every two seconds.
latency_ms: i32The record stream’s fragment size in milliseconds; 0 selects the default.
omit_audio_header: boolDeliver raw Opus packets instead of the two-byte header and RED framing.
red_distance: i32Redundant copies of recent frames each frame carries, 0 to RED_MAX_DISTANCE.
output_socket: StringUnix socket path on which the capture serves its packets as an Ogg Opus stream to every consumer that connects; empty serves none. A path that cannot be bound fails the start like any other startup error.
Implementations§
Source§impl AudioCaptureSettings
impl AudioCaptureSettings
Sourcepub fn validate(&self) -> Result<AudioCaptureSettings, Error>
pub fn validate(&self) -> Result<AudioCaptureSettings, Error>
The settings a run snapshots, or why they are refused: what the worker could only fail on later is rejected here, before a thread is spawned.
opus_bitrate is clamped into the Opus range exactly as update_audio_bitrate
clamps a live update; red_distance into [0, RED_MAX_DISTANCE] — it selects how
many redundant Opus copies each frame carries, and cannot exceed the RFC 2198
history depth. An empty device_name becomes None, the system default, and one
with an interior NUL is refused: the name becomes a C string for libpulse on the
worker thread, where it could only surface as a panic. latency_ms == 0 selects the
default fragment size.
Trait Implementations§
Source§impl Clone for AudioCaptureSettings
impl Clone for AudioCaptureSettings
Source§fn clone(&self) -> AudioCaptureSettings
fn clone(&self) -> AudioCaptureSettings
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more