transcriberbin: Fix deadlock

Fix race between latency query handler and setup_transcription()
method.

Locking order of setup_transcription() is
state lock -> setup_transcription() -> settings lock
So taking state lock inside of setting lock in src_query()
can cause deadlock.
This commit is contained in:
Seungha Yang 2022-03-08 22:38:55 +09:00 committed by Sebastian Dröge
parent 1c2d4d4350
commit ce24ca965e

View file

@ -396,7 +396,6 @@ impl TranscriberBin {
if ret {
let (_, mut min, _) = upstream_query.result();
let settings = self.settings.lock().unwrap();
let received_framerate = {
let state = self.state.lock().unwrap();
if let Some(state) = state.as_ref() {
@ -406,6 +405,7 @@ impl TranscriberBin {
}
};
let settings = self.settings.lock().unwrap();
if settings.passthrough || !received_framerate {
min += settings.latency + settings.accumulate_time;
} else if settings.mode.is_rollup() {