CAM_LOG_WARNING("unhandled event %d", event);
break;
}
+
+ CAM_LOG_DEBUG("done - event[%d]", event);
}
static gboolean __camera_idle_event_callback(gpointer data)
g_mutex_clear(&cb_info->mp_data_lock);
g_mutex_clear(&cb_info->bridge_lock);
- for (i = 0 ; i < MUSE_CAMERA_EVENT_TYPE_NUM ; i++)
+ for (i = 0 ; i < MUSE_CAMERA_EVENT_TYPE_NUM ; i++) {
+ /* The mutex can be locked when the user callback is called in idle callback.
+ This code will wait until it's unlocked and avoid crash by clearing locked mutex. */
+ if (!g_mutex_trylock(&cb_info->user_cb_lock[i])) {
+ CAM_LOG_WARNING("user_cb_lock[%d] is locked somewhere", i);
+ g_mutex_lock(&cb_info->user_cb_lock[i]);
+ }
+
+ g_mutex_unlock(&cb_info->user_cb_lock[i]);
g_mutex_clear(&cb_info->user_cb_lock[i]);
+ }
for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
g_mutex_clear(&cb_info->api_lock[i]);