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
parent 8389bff7d8
commit ecf03d0e5c

View file

@ -395,7 +395,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() {
@ -405,6 +404,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() {