timecodestamper: Don't fail the latency query in LTC mode if we have no framerate

Only in LTC mode we introduce additional latency that is depending on only on a
property and not on the framerate, so waiting for the framerate is not necessary.

In all other modes no latency is introduced at all and the latency query can
simply be proxied.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7831>
This commit is contained in:
Sebastian Dröge 2024-11-05 14:23:05 +02:00 committed by GStreamer Marge Bot
parent 39b2dd1dd1
commit d2d2a12aac

View file

@ -1037,31 +1037,27 @@ gst_timecodestamper_query (GstBaseTransform * trans,
res = res =
gst_pad_query_default (GST_BASE_TRANSFORM_SRC_PAD (trans), gst_pad_query_default (GST_BASE_TRANSFORM_SRC_PAD (trans),
GST_OBJECT_CAST (trans), query); GST_OBJECT_CAST (trans), query);
if (!res)
return FALSE;
gst_query_parse_latency (query, &live, &min_latency, &max_latency);
g_mutex_lock (&timecodestamper->mutex); g_mutex_lock (&timecodestamper->mutex);
if (res && timecodestamper->fps_n && timecodestamper->fps_d) { if (live && timecodestamper->ltcpad) {
gst_query_parse_latency (query, &live, &min_latency, &max_latency); /* Introduce additional LTC for waiting for LTC timecodes. The
if (live && timecodestamper->ltcpad) { * LTC library introduces some as well as the encoding of the LTC
/* Introduce additional LTC for waiting for LTC timecodes. The * signal. */
* LTC library introduces some as well as the encoding of the LTC latency = timecodestamper->ltc_extra_latency;
* signal. */ min_latency += latency;
latency = timecodestamper->ltc_extra_latency; if (max_latency != GST_CLOCK_TIME_NONE)
min_latency += latency; max_latency += latency;
if (max_latency != GST_CLOCK_TIME_NONE) timecodestamper->latency = min_latency;
max_latency += latency; GST_DEBUG_OBJECT (timecodestamper,
timecodestamper->latency = min_latency; "Reporting latency min %" GST_TIME_FORMAT " max %" GST_TIME_FORMAT
GST_DEBUG_OBJECT (timecodestamper, " ours %" GST_TIME_FORMAT, GST_TIME_ARGS (min_latency),
"Reporting latency min %" GST_TIME_FORMAT " max %" GST_TIME_FORMAT GST_TIME_ARGS (max_latency), GST_TIME_ARGS (latency));
" ours %" GST_TIME_FORMAT, GST_TIME_ARGS (min_latency), gst_query_set_latency (query, live, min_latency, max_latency);
GST_TIME_ARGS (max_latency), GST_TIME_ARGS (latency)); } else {
gst_query_set_latency (query, live, min_latency, max_latency); timecodestamper->latency = 0;
} else {
timecodestamper->latency = 0;
}
} else if (res) {
GST_ERROR_OBJECT (timecodestamper,
"Need a known, non-variable framerate to answer LATENCY query");
res = FALSE;
timecodestamper->latency = GST_CLOCK_TIME_NONE;
} }
g_mutex_unlock (&timecodestamper->mutex); g_mutex_unlock (&timecodestamper->mutex);