diff options
author | Víctor Manuel Jáquez Leal <vjaquez@igalia.com> | 2021-03-11 18:53:09 +0100 |
---|---|---|
committer | Víctor Manuel Jáquez Leal <vjaquez@igalia.com> | 2021-03-12 12:34:46 +0100 |
commit | 0b2848fc32192ff2df951fb9e8ea4d853c29a3d0 (patch) | |
tree | acffb13edf3057b6fec9f0c6944460caf7bed3d4 /sys/va/gstvavpp.c | |
parent | 451c875d40a92ade05389cb62ef885eefd29be4a (diff) | |
download | gstreamer-plugins-bad-0b2848fc32192ff2df951fb9e8ea4d853c29a3d0.tar.gz |
va: postproc: update passthrough and reconfigure pads
Added helper function _update_passthrough() which will define and set
the pass-through mode of the filter, and it'll either reconfigure both
pads or it will just mark the src pad for renegotiation or nothing at
all.
There are cases where both pads have to be reconfigured (direction
changed, for example), other when just src pad has to (filters
updated) or none (changing to ready state).
The requirement of renegotiation depends on the need to enable/disable
its VA buffer pools.
This patch sets pass-through mode by default, so the buffer pools
aren't allocated if no filtering/direction operations are defined,
which is the correct behavior.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2074>
Diffstat (limited to 'sys/va/gstvavpp.c')
-rw-r--r-- | sys/va/gstvavpp.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/sys/va/gstvavpp.c b/sys/va/gstvavpp.c index cd2b62791..76cea8d54 100644 --- a/sys/va/gstvavpp.c +++ b/sys/va/gstvavpp.c @@ -198,6 +198,26 @@ gst_va_vpp_dispose (GObject * object) } static void +_update_passthrough (GstVaVpp * self, gboolean reconf) +{ + GstBaseTransform *trans = GST_BASE_TRANSFORM (self); + gboolean old, new; + + old = gst_base_transform_is_passthrough (trans); + + GST_OBJECT_LOCK (self); + new = (self->op_flags == 0); + GST_OBJECT_UNLOCK (self); + + if (old != new) { + GST_INFO_OBJECT (self, "%s passthrough", new ? "enabling" : "disabling"); + if (reconf) + gst_base_transform_reconfigure_src (trans); + gst_base_transform_set_passthrough (trans, new); + } +} + +static void _update_properties_unlocked (GstVaVpp * self) { if (!self->filter) @@ -290,6 +310,10 @@ gst_va_vpp_set_property (GObject * object, guint prop_id, _update_properties_unlocked (self); GST_OBJECT_UNLOCK (object); + + /* no reconfig here because it's done in + * _update_properties_unlocked() */ + _update_passthrough (self, FALSE); } static void @@ -360,6 +384,7 @@ gst_va_vpp_change_state (GstElement * element, GstStateChange transition) if (!gst_va_filter_open (self->filter)) goto open_failed; _update_properties_unlocked (self); + _update_passthrough (self, FALSE); break; default: break; @@ -776,6 +801,9 @@ gst_va_vpp_set_caps (GstBaseTransform * trans, GstCaps * incaps, self->negotiated = gst_va_filter_set_formats (self->filter, &self->in_info, &self->out_info); + if (self->negotiated) + _update_passthrough (self, FALSE); + return self->negotiated; /* ERRORS */ @@ -947,7 +975,7 @@ gst_va_vpp_before_transform (GstBaseTransform * trans, GstBuffer * inbuf) self->op_flags &= ~VPP_CONVERT_FILTERS; GST_OBJECT_UNLOCK (self); - gst_base_transform_set_passthrough (trans, self->op_flags == 0); + _update_passthrough (self, TRUE); } static inline gsize @@ -2182,6 +2210,11 @@ gst_va_vpp_sink_event (GstBaseTransform * trans, GstEvent * event) _update_properties_unlocked (self); GST_OBJECT_UNLOCK (self); + + /* no reconfig here because it's done in + * _update_properties_unlocked */ + _update_passthrough (self, FALSE); + break; default: break; |