basetransform: Avoid useless codepath

If QoS is disabled, skip the whole computation (avoids calculating values which
won't be needed)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3034>
This commit is contained in:
Edward Hervey 2022-09-15 16:22:23 +02:00 committed by GStreamer Marge Bot
parent 3890e49772
commit b2701418d7

View file

@ -2034,6 +2034,7 @@ default_submit_input_buffer (GstBaseTransform * trans, gboolean is_discont,
GstFlowReturn ret = GST_FLOW_OK;
GstClockTime running_time;
GstClockTime timestamp;
gboolean qos_enabled;
if (G_UNLIKELY (!gst_base_transform_reconfigure_unlocked (trans)))
goto not_negotiated;
@ -2056,6 +2057,14 @@ default_submit_input_buffer (GstBaseTransform * trans, gboolean is_discont,
if (!priv->negotiated && !priv->passthrough && (bclass->set_caps != NULL))
goto not_negotiated;
GST_OBJECT_LOCK (trans);
qos_enabled = priv->qos_enabled;
GST_OBJECT_UNLOCK (trans);
/* Skip all qos handling if disabled */
if (!qos_enabled)
goto no_qos;
/* can only do QoS if the segment is in TIME */
if (trans->segment.format != GST_FORMAT_TIME)
goto no_qos;
@ -2077,8 +2086,7 @@ default_submit_input_buffer (GstBaseTransform * trans, gboolean is_discont,
proportion = priv->proportion;
/* check for QoS, don't perform conversion for buffers
* that are known to be late. */
need_skip = priv->qos_enabled &&
earliest_time != -1 && running_time <= earliest_time;
need_skip = earliest_time != -1 && running_time <= earliest_time;
GST_OBJECT_UNLOCK (trans);
if (need_skip) {