All files / src audio-latency.js

100% Statements 5/5
100% Branches 4/4
100% Functions 1/1
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 113x 3x     3x 3x     58x    
export const DefaultTargetLatencyMs = 1000 * (1 / 50); // One frame
export const MaxTargetLatencyMs = 250;
 
// A lead kept this far past the target for this long is skipped back to it.
export const ExcessLeadMs = 50;
export const PersistentExcessSeconds = 0.5;
 
export function validTargetLatencyMs(ms) {
    return Number.isFinite(ms) && ms > 0 ? Math.min(ms, MaxTargetLatencyMs) : DefaultTargetLatencyMs;
}