diff options
author | Víctor Manuel Jáquez Leal <vjaquez@igalia.com> | 2019-01-12 12:27:27 +0100 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2019-05-01 17:36:45 +0100 |
commit | b408ac7862b435314489c6e6db9c529e0f2ff946 (patch) | |
tree | 2593e1de6a5586e764f7fd243389d906d4a3262b | |
parent | ad7d098572da9ee2ea17c4bddac6b5a8ad6e234c (diff) | |
download | gstreamer-plugins-base-b408ac7862b435314489c6e6db9c529e0f2ff946.tar.gz |
glsinkbin: validate property in internal sink
It might be the case that glgsinkbin would try to set a property to
its internal sink which doesn't exist in it, leading to a glib's
warning. For example, when playsink sets 'force-aspect-ratio' property
and glsinkbin has, as internal sink, appsink, which doesn't handle
that property.
The patch validates the incoming property to forward to internal sink
if it exists in the internal sink and both properties has the same
type.
-rw-r--r-- | ext/gl/gstglsinkbin.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/ext/gl/gstglsinkbin.c b/ext/gl/gstglsinkbin.c index 02511f56d..00164f284 100644 --- a/ext/gl/gstglsinkbin.c +++ b/ext/gl/gstglsinkbin.c @@ -343,6 +343,7 @@ gst_gl_sink_bin_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { GstGLSinkBin *self = GST_GL_SINK_BIN (object); + GParamSpec *sink_pspec; switch (prop_id) { case PROP_SINK: @@ -356,8 +357,17 @@ gst_gl_sink_bin_set_property (GObject * object, guint prop_id, g_object_set_property (G_OBJECT (self->balance), pspec->name, value); break; default: - if (self->sink) - g_object_set_property (G_OBJECT (self->sink), pspec->name, value); + if (self->sink) { + sink_pspec = + g_object_class_find_property (G_OBJECT_GET_CLASS (self->sink), + pspec->name); + if (sink_pspec + && G_PARAM_SPEC_TYPE (sink_pspec) == G_PARAM_SPEC_TYPE (pspec)) { + g_object_set_property (G_OBJECT (self->sink), pspec->name, value); + } else { + GST_INFO ("Failed to set unmatched property %s", pspec->name); + } + } break; } } |