inputselector: fix possible clock leak on shutdown

Avoid leaking a GstClock object on shutdown, bail out before taking the ref when
not playing.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6455>
This commit is contained in:
Arnaud Vrac 2024-03-26 14:28:28 +01:00 committed by GStreamer Marge Bot
parent 4020144a65
commit 0d04d702bd

View file

@ -839,6 +839,13 @@ gst_input_selector_wait_running_time (GstInputSelector * sel,
GstClockTimeDiff jitter;
GstClockID clock_id;
if (!sel->playing) {
GST_DEBUG_OBJECT (selpad, "Waiting for playing");
GST_INPUT_SELECTOR_WAIT (sel);
GST_DEBUG_OBJECT (selpad, "Done waiting");
continue;
}
base_time = gst_element_get_base_time (GST_ELEMENT_CAST (sel));
if (!GST_CLOCK_TIME_IS_VALID (base_time)) {
GST_DEBUG_OBJECT (selpad, "sync-mode=clock but no base time. Blocking");
@ -853,13 +860,6 @@ gst_input_selector_wait_running_time (GstInputSelector * sel,
continue;
}
if (!sel->playing) {
GST_DEBUG_OBJECT (selpad, "Waiting for playing");
GST_INPUT_SELECTOR_WAIT (sel);
GST_DEBUG_OBJECT (selpad, "Done waiting");
continue;
}
/* FIXME: If no upstream latency was queried yet, do one now */
clock_id =
gst_clock_new_single_shot_id (clock,