va: postproc: disable passthrough as soon as possible

After the VA filter creation, when changing the element's state from NULL
to READY, immediatly checks for any filter operation requested by the user.
If any, the passthrough mode is disabled early, so there's no need for a
future renegotiation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2094>
This commit is contained in:
Víctor Manuel Jáquez Leal 2021-03-19 16:17:41 +01:00
parent 594c1450da
commit 32fa99d3e0

View file

@ -170,6 +170,7 @@ static GQuark meta_tag_orientation_quark;
static GQuark meta_tag_video_quark;
static void gst_va_vpp_colorbalance_init (gpointer iface, gpointer data);
static void gst_va_vpp_rebuild_filters (GstVaVpp * self);
static void
gst_va_vpp_dispose (GObject * object)
@ -395,6 +396,7 @@ gst_va_vpp_change_state (GstElement * element, GstStateChange transition)
if (!gst_va_filter_open (self->filter))
goto open_failed;
_update_properties_unlocked (self);
gst_va_vpp_rebuild_filters (self);
gst_va_vpp_update_passthrough (self, FALSE);
break;
default:
@ -986,6 +988,17 @@ _build_filters (GstVaVpp * self)
GST_OBJECT_UNLOCK (self);
}
static void
gst_va_vpp_rebuild_filters (GstVaVpp * self)
{
if (!g_atomic_int_get (&self->rebuild_filters))
return;
gst_va_filter_drop_filter_buffers (self->filter);
_build_filters (self);
g_atomic_int_set (&self->rebuild_filters, FALSE);
}
static void
gst_va_vpp_before_transform (GstBaseTransform * trans, GstBuffer * inbuf)
{
@ -1001,12 +1014,8 @@ gst_va_vpp_before_transform (GstBaseTransform * trans, GstBuffer * inbuf)
if (GST_CLOCK_TIME_IS_VALID (stream_time))
gst_object_sync_values (GST_OBJECT (self), stream_time);
if (g_atomic_int_get (&self->rebuild_filters) == TRUE) {
gst_va_filter_drop_filter_buffers (self->filter);
_build_filters (self);
gst_va_vpp_update_passthrough (self, TRUE);
g_atomic_int_set (&self->rebuild_filters, FALSE);
}
gst_va_vpp_rebuild_filters (self);
gst_va_vpp_update_passthrough (self, TRUE);
}
static inline gsize