mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-29 19:50:40 +00:00
validate:pipeline-monitor: Connect deep properties notification only when required
This is quite expensive and can lead to an overwhelm mainloop.
This commit is contained in:
parent
258453a169
commit
8498861a28
1 changed files with 64 additions and 3 deletions
|
@ -37,6 +37,12 @@
|
|||
|
||||
static gboolean output_is_tty = TRUE;
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_VERBOSITY,
|
||||
};
|
||||
|
||||
/**
|
||||
* SECTION:gst-validate-pipeline-monitor
|
||||
* @title: GstValidatePipelineMonitor
|
||||
|
@ -77,6 +83,54 @@ gst_validate_pipeline_monitor_dispose (GObject * object)
|
|||
G_OBJECT_CLASS (gst_validate_pipeline_monitor_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_validate_pipeline_monitor_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GstElement *pipeline = NULL;
|
||||
GstValidateMonitor *monitor = GST_VALIDATE_MONITOR_CAST (object);
|
||||
GstValidatePipelineMonitor *self = GST_VALIDATE_PIPELINE_MONITOR (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_VERBOSITY:
|
||||
pipeline = GST_ELEMENT (gst_validate_monitor_get_pipeline (monitor));
|
||||
monitor->verbosity = g_value_get_flags (value);
|
||||
if (monitor->verbosity & GST_VALIDATE_VERBOSITY_PROPS_CHANGES) {
|
||||
if (pipeline && !self->deep_notify_id) {
|
||||
self->deep_notify_id =
|
||||
gst_element_add_property_deep_notify_watch (pipeline, NULL, TRUE);
|
||||
}
|
||||
} else if (pipeline && self->deep_notify_id) {
|
||||
gst_element_remove_property_notify_watch (pipeline,
|
||||
self->deep_notify_id);
|
||||
self->deep_notify_id = 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
|
||||
gst_clear_object (&pipeline);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_validate_pipeline_monitor_get_property (GObject * object, guint prop_id,
|
||||
GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GstValidateMonitor *monitor = GST_VALIDATE_MONITOR_CAST (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_VERBOSITY:
|
||||
g_value_set_flags (value, monitor->verbosity);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
gst_validate_pipeline_monitor_class_init (GstValidatePipelineMonitorClass *
|
||||
klass)
|
||||
|
@ -84,6 +138,10 @@ gst_validate_pipeline_monitor_class_init (GstValidatePipelineMonitorClass *
|
|||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->dispose = gst_validate_pipeline_monitor_dispose;
|
||||
object_class->set_property = gst_validate_pipeline_monitor_set_property;
|
||||
object_class->get_property = gst_validate_pipeline_monitor_get_property;
|
||||
|
||||
g_object_class_override_property (object_class, PROP_VERBOSITY, "verbosity");
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
output_is_tty = isatty (1);
|
||||
|
@ -792,9 +850,12 @@ gst_validate_pipeline_monitor_new (GstPipeline * pipeline,
|
|||
gst_bus_enable_sync_message_emission (bus);
|
||||
g_signal_connect (bus, "sync-message", (GCallback) _bus_handler, monitor);
|
||||
|
||||
monitor->deep_notify_id =
|
||||
gst_element_add_property_deep_notify_watch ((GstElement *) pipeline, NULL,
|
||||
TRUE);
|
||||
if (GST_VALIDATE_MONITOR_CAST (monitor)->verbosity &
|
||||
GST_VALIDATE_VERBOSITY_PROPS_CHANGES) {
|
||||
monitor->deep_notify_id =
|
||||
gst_element_add_property_deep_notify_watch ((GstElement *) pipeline,
|
||||
NULL, TRUE);
|
||||
}
|
||||
|
||||
gst_object_unref (bus);
|
||||
|
||||
|
|
Loading…
Reference in a new issue