mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-03-14 09:12:39 +00:00
transcriberbin: fix cea608mux start time selection
cea608mux is set to force-live=true, which means it will not wait for a first buffer to select a start time. There was however a problem when manually syncing the state of its containing bin as we do: when doing so while the state of the containing bin is still transitioning to Playing, the element first gets a 0 base time distributed, before its containing bin finally gets the correct base time and redistributes it. In this interval cea608mux could pick a start time, then end up waiting for ever to timeout. This commit works around the issue by simply unlocking the state of the inner bins but not syncing it when in Paused, as the subsequent state change to Playing, if it happens, will trigger the state change of the elements anyway. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2115>
This commit is contained in:
parent
e31e5b2c6f
commit
ebcb8f220b
1 changed files with 18 additions and 5 deletions
|
@ -848,8 +848,17 @@ impl TranscriberBin {
|
|||
.link_pads(Some("src"), &state.cccombiner, Some("caption"))
|
||||
.unwrap();
|
||||
|
||||
// We don't need to sync below playing as the state is now unlocked
|
||||
// and the bin will transition when necessary.
|
||||
//
|
||||
// Trying to sync in PAUSED was causing issues with base time distribution,
|
||||
// with cea608mux selecting an incorrect start time.
|
||||
let do_sync = self.obj().current_state() == gst::State::Playing;
|
||||
|
||||
state.transcription_bin.set_locked_state(false);
|
||||
state.transcription_bin.sync_state_with_parent().unwrap();
|
||||
if do_sync {
|
||||
state.transcription_bin.sync_state_with_parent().unwrap();
|
||||
}
|
||||
|
||||
for pad in state.audio_sink_pads.values() {
|
||||
let ps = pad.imp().state.lock().unwrap();
|
||||
|
@ -858,10 +867,14 @@ impl TranscriberBin {
|
|||
|
||||
if !pad_settings.passthrough {
|
||||
pad_state.transcription_bin.set_locked_state(false);
|
||||
pad_state
|
||||
.transcription_bin
|
||||
.sync_state_with_parent()
|
||||
.unwrap();
|
||||
|
||||
if do_sync {
|
||||
pad_state
|
||||
.transcription_bin
|
||||
.sync_state_with_parent()
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
let transcription_sink_pad =
|
||||
state.transcription_bin.static_pad(&pad.name()).unwrap();
|
||||
// Might be linked already if "translation-languages" is set
|
||||
|
|
Loading…
Reference in a new issue