mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-28 22:41:02 +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
|
// Do nothing, wait for the previous transcription bin
|
||||||
// to finish tearing down
|
// to finish tearing down
|
||||||
} else {
|
} 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
|
state
|
||||||
.transcription_bin
|
.transcription_bin
|
||||||
.link_pads(Some("src"), &state.cccombiner, Some("caption"))
|
.link_pads(Some("src"), &state.cccombiner, Some("caption"))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
state.transcription_bin.set_locked_state(false);
|
state.transcription_bin.set_locked_state(false);
|
||||||
state.transcription_bin.sync_state_with_parent().unwrap();
|
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 cccapsfilter = gst::ElementFactory::make("capsfilter", None)?;
|
||||||
let transcription_valve = gst::ElementFactory::make("valve", 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");
|
transcription_valve.set_property_from_str("drop-mode", "transform-to-gap");
|
||||||
|
|
||||||
Ok(State {
|
Ok(State {
|
||||||
|
|
Loading…
Reference in a new issue