mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-10-31 22:58:51 +00:00
transcriberbin: Protect runtime "passthrough=false" change
There can be small race where transcription-bin is linked with tee but state change of the transcription-bin is not finished. And at the same time, upstream pushes event/buffer to the transcription-bin. Do state change first then link to avoid the condition Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/716>
This commit is contained in:
parent
08379ab389
commit
558656deb5
1 changed files with 7 additions and 4 deletions
|
@ -349,16 +349,16 @@ impl TranscriberBin {
|
|||
// Do nothing, wait for the previous transcription bin
|
||||
// to finish tearing down
|
||||
} else {
|
||||
let audio_tee_pad = state.audio_tee.request_pad_simple("src_%u").unwrap();
|
||||
let transcription_sink_pad = state.transcription_bin.static_pad("sink").unwrap();
|
||||
audio_tee_pad.link(&transcription_sink_pad).unwrap();
|
||||
|
||||
state
|
||||
.transcription_bin
|
||||
.link_pads(Some("src"), &state.cccombiner, Some("caption"))
|
||||
.unwrap();
|
||||
state.transcription_bin.set_locked_state(false);
|
||||
state.transcription_bin.sync_state_with_parent().unwrap();
|
||||
|
||||
let audio_tee_pad = state.audio_tee.request_pad_simple("src_%u").unwrap();
|
||||
let transcription_sink_pad = state.transcription_bin.static_pad("sink").unwrap();
|
||||
audio_tee_pad.link(&transcription_sink_pad).unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -473,6 +473,9 @@ impl TranscriberBin {
|
|||
let cccapsfilter = gst::ElementFactory::make("capsfilter", None)?;
|
||||
let transcription_valve = gst::ElementFactory::make("valve", None)?;
|
||||
|
||||
// Protect passthrough enable (and resulting dynamic reconfigure)
|
||||
// from non-streaming thread
|
||||
audio_tee.set_property("allow-not-linked", true);
|
||||
transcription_valve.set_property_from_str("drop-mode", "transform-to-gap");
|
||||
|
||||
Ok(State {
|
||||
|
|
Loading…
Reference in a new issue