Visualization: Correct possible race condition

It's safer to ignore an out of range latency value before it's actually
assigned, rather than letting it slip through before gating it with the
control variable. So, assign the ignore latency state before assigning
latency itself, since neither side is synchronization locked, because it
used to just be one variable, which was fairly safe to leave unsynced,
but now it's two.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
Christopher Snowhill 2025-07-01 04:55:24 -07:00
parent 98d898a715
commit 5cbebd0c43

View file

@ -101,8 +101,8 @@ static VisualizationController *_sharedController = nil;
} }
- (void)postLatency:(double)latency { - (void)postLatency:(double)latency {
self->latency = latency;
ignoreLatency = (latency >= 45.0) || (latency < 0.0); ignoreLatency = (latency >= 45.0) || (latency < 0.0);
self->latency = latency;
} }
- (double)readSampleRate { - (double)readSampleRate {