From 961cf17c97a2e302a19e24277874a93dc30bd553 Mon Sep 17 00:00:00 2001 From: Philippe Normand Date: Mon, 11 May 2015 10:17:18 +0200 Subject: [PATCH] rpicamsrc: colorbalance: protect with config_lock mutex --- sys/rpicamsrc/gstrpicamsrc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/rpicamsrc/gstrpicamsrc.c b/sys/rpicamsrc/gstrpicamsrc.c index 570eeb3..edc9d84 100644 --- a/sys/rpicamsrc/gstrpicamsrc.c +++ b/sys/rpicamsrc/gstrpicamsrc.c @@ -519,7 +519,7 @@ gst_rpi_cam_src_colorbalance_set_value (GstColorBalance * balance, g_return_if_fail (GST_IS_RPICAMSRC (src)); g_return_if_fail (channel->label != NULL); - GST_OBJECT_LOCK (src); + g_mutex_lock (&src->config_lock); if (!g_ascii_strcasecmp (channel->label, "SATURATION")) { changed = value != src->capture_config.camera_parameters.saturation; src->capture_config.camera_parameters.saturation = value; @@ -534,7 +534,7 @@ gst_rpi_cam_src_colorbalance_set_value (GstColorBalance * balance, if (changed) src->capture_config.change_flags |= PROP_CHANGE_COLOURBALANCE; - GST_OBJECT_UNLOCK (src); + g_mutex_unlock (&src->config_lock); if (changed) { gst_color_balance_value_changed (balance, channel, @@ -553,6 +553,8 @@ gst_rpi_cam_src_colorbalance_get_value (GstColorBalance * balance, g_return_val_if_fail (GST_IS_RPICAMSRC (src), 0); g_return_val_if_fail (channel->label != NULL, 0); + g_mutex_lock (&src->config_lock); + if (!g_ascii_strcasecmp (channel->label, "SATURATION")) { value = src->capture_config.camera_parameters.saturation; } else if (!g_ascii_strcasecmp (channel->label, "BRIGHTNESS")) { @@ -561,6 +563,8 @@ gst_rpi_cam_src_colorbalance_get_value (GstColorBalance * balance, value = src->capture_config.camera_parameters.contrast; } + g_mutex_unlock (&src->config_lock); + return value; } -- 2.7.4