fix(audio): replace Mutex unwrap with poisoned-mutex recovery (TODO-006)
Replace 42 .lock().unwrap() calls with .unwrap_or_else(|e| e.into_inner()) across 7 files. Poisoned mutex recovery prevents panics in realtime audio callbacks. Add SAFETY comment to WebRtcFallbackVad Send impl (TODO-007).
This commit is contained in:
@@ -82,7 +82,7 @@ struct RecordingLayer {
|
||||
|
||||
impl RecordingLayer {
|
||||
fn snapshot(&self) -> Vec<Captured> {
|
||||
self.records.lock().unwrap().clone()
|
||||
self.records.lock().unwrap_or_else(|e| e.into_inner()).clone()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ where
|
||||
target: event.metadata().target().to_string(),
|
||||
field_names: names.0,
|
||||
};
|
||||
self.records.lock().unwrap().push(captured);
|
||||
self.records.lock().unwrap_or_else(|e| e.into_inner()).push(captured);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user