mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-22 03:21:00 +00:00
transcriberbin: fix initial transcription setup
Only link the audio tee with the pad transcriber when it is not in passthrough mode. Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/628 Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1916>
This commit is contained in:
parent
4284fe953a
commit
d993c95e38
1 changed files with 32 additions and 5 deletions
|
@ -39,6 +39,7 @@ const DEFAULT_MUX_METHOD: MuxMethod = MuxMethod::Cea608;
|
||||||
|
|
||||||
const CEAX08MUX_LATENCY: gst::ClockTime = gst::ClockTime::from_mseconds(100);
|
const CEAX08MUX_LATENCY: gst::ClockTime = gst::ClockTime::from_mseconds(100);
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
enum TargetPassthroughState {
|
enum TargetPassthroughState {
|
||||||
None,
|
None,
|
||||||
Enabled,
|
Enabled,
|
||||||
|
@ -567,11 +568,15 @@ impl TranscriberBin {
|
||||||
.transcription_bin
|
.transcription_bin
|
||||||
.sync_state_with_parent()
|
.sync_state_with_parent()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let transcription_sink_pad = state.transcription_bin.static_pad(&pad.name()).unwrap();
|
let pad_settings = pad.imp().settings.lock().unwrap();
|
||||||
// Might be linked already if "translation-languages" is set
|
if !pad_settings.passthrough {
|
||||||
if transcription_sink_pad.peer().is_none() {
|
let transcription_sink_pad =
|
||||||
let audio_tee_pad = pad_state.audio_tee.request_pad_simple("src_%u").unwrap();
|
state.transcription_bin.static_pad(&pad.name()).unwrap();
|
||||||
audio_tee_pad.link(&transcription_sink_pad).unwrap();
|
// Might be linked already if "translation-languages" is set
|
||||||
|
if transcription_sink_pad.peer().is_none() {
|
||||||
|
let audio_tee_pad = pad_state.audio_tee.request_pad_simple("src_%u").unwrap();
|
||||||
|
audio_tee_pad.link(&transcription_sink_pad).unwrap();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -594,6 +599,9 @@ impl TranscriberBin {
|
||||||
let bin_sink_pad = state.transcription_bin.static_pad(&pad.name()).unwrap();
|
let bin_sink_pad = state.transcription_bin.static_pad(&pad.name()).unwrap();
|
||||||
if let Some(audio_tee_pad) = bin_sink_pad.peer() {
|
if let Some(audio_tee_pad) = bin_sink_pad.peer() {
|
||||||
audio_tee_pad.unlink(&bin_sink_pad).unwrap();
|
audio_tee_pad.unlink(&bin_sink_pad).unwrap();
|
||||||
|
|
||||||
|
gst::debug!(CAT, obj = pad, "releasing audio tee pad");
|
||||||
|
|
||||||
pad_state.audio_tee.release_request_pad(&audio_tee_pad);
|
pad_state.audio_tee.release_request_pad(&audio_tee_pad);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -622,11 +630,21 @@ impl TranscriberBin {
|
||||||
state: &mut State,
|
state: &mut State,
|
||||||
pad_state: &mut TranscriberSinkPadState,
|
pad_state: &mut TranscriberSinkPadState,
|
||||||
) {
|
) {
|
||||||
|
gst::debug!(CAT, imp = sinkpad, "enabling transcription bin");
|
||||||
|
|
||||||
for channel in pad_state.transcription_channels.values() {
|
for channel in pad_state.transcription_channels.values() {
|
||||||
let srcpad = pad_state
|
let srcpad = pad_state
|
||||||
.transcription_bin
|
.transcription_bin
|
||||||
.static_pad(&format!("src_{}", channel.language))
|
.static_pad(&format!("src_{}", channel.language))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
gst::log!(
|
||||||
|
CAT,
|
||||||
|
obj = srcpad,
|
||||||
|
"linking transcription channel for language {}",
|
||||||
|
channel.language
|
||||||
|
);
|
||||||
|
|
||||||
let sinkpad = state
|
let sinkpad = state
|
||||||
.ccmux
|
.ccmux
|
||||||
.static_pad(&channel.ccmux_pad_name)
|
.static_pad(&channel.ccmux_pad_name)
|
||||||
|
@ -686,6 +704,8 @@ impl TranscriberBin {
|
||||||
return gst::PadProbeReturn::Remove;
|
return gst::PadProbeReturn::Remove;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
gst::debug!(CAT, imp = imp, "pad probed");
|
||||||
|
|
||||||
let pad_imp = pad
|
let pad_imp = pad
|
||||||
.downcast_ref::<super::TranscriberSinkPad>()
|
.downcast_ref::<super::TranscriberSinkPad>()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -2078,6 +2098,13 @@ impl ObjectImpl for TranscriberSinkPad {
|
||||||
}
|
}
|
||||||
drop(pad_settings);
|
drop(pad_settings);
|
||||||
|
|
||||||
|
gst::debug!(
|
||||||
|
CAT,
|
||||||
|
imp = self,
|
||||||
|
"target passthrough state: {:?}",
|
||||||
|
pad_state.target_passthrough_state
|
||||||
|
);
|
||||||
|
|
||||||
parent.imp().block_and_update(self, s, ps);
|
parent.imp().block_and_update(self, s, ps);
|
||||||
}
|
}
|
||||||
"translation-languages" => {
|
"translation-languages" => {
|
||||||
|
|
Loading…
Reference in a new issue