From 32fa99d3e078330480c64036e8a6ae492fc62a22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Fri, 19 Mar 2021 16:17:41 +0100 Subject: [PATCH] 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: --- sys/va/gstvavpp.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/sys/va/gstvavpp.c b/sys/va/gstvavpp.c index 5dd602c2ad..3fa4f0643e 100644 --- a/sys/va/gstvavpp.c +++ b/sys/va/gstvavpp.c @@ -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