pub struct RoundTripLatencyDto {
pub latency_ms: f64,
pub is_valid: bool,
pub error: Option<String>,
}Expand description
Result of a hardware round-trip latency measurement.
Round-trip latency is the total wall-clock time from when a sample is written to the output ring buffer to when it returns on the input ring buffer after passing through the DAC, the physical audio path, and the ADC. It captures:
- Input and output buffer delays
- Hardware AD/DA conversion time
- OS scheduling and driver latency
- Any resampler buffering in the signal path
The measurement is performed by RoundTripLatencySession on a dedicated thread
using private CPAL streams, completely separate from the main audio loopback.
§Validity
Always check is_valid before using latency_ms. When is_valid is false
the latency_ms field is 0.0 and error contains a human-readable description
of what went wrong (e.g. no echo detected, timeout).
Fields§
§latency_ms: f64Average round-trip latency in milliseconds across all impulse/echo cycles.
Only meaningful when is_valid is true. Set to 0.0 on failure.
is_valid: boolWhether the measurement completed successfully.
true when at least IMPULSE_COUNT echoes were detected within the timeout.
false when the measurement timed out or the echo signal was undetectable.
error: Option<String>Human-readable failure reason, or None on success.
Typical messages:
"Echo not detected above threshold …"— output not routed to input."Round-trip measurement timed out …"— overall deadline exceeded."Round-trip measurement thread panicked"— unexpected internal error.
Implementations§
Trait Implementations§
Source§impl Clone for RoundTripLatencyDto
impl Clone for RoundTripLatencyDto
Source§fn clone(&self) -> RoundTripLatencyDto
fn clone(&self) -> RoundTripLatencyDto
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more