g_mutex_init(&(hcamcorder->mtsafe).lock);
g_cond_init(&(hcamcorder->mtsafe).cond);
g_mutex_init(&(hcamcorder->mtsafe).cmd_lock);
+ g_cond_init(&(hcamcorder->mtsafe).cmd_cond);
g_mutex_init(&(hcamcorder->mtsafe).asm_lock);
g_mutex_init(&(hcamcorder->mtsafe).state_lock);
g_mutex_init(&(hcamcorder->mtsafe).gst_state_lock);
goto _ERR_DEFAULT_VALUE_INIT;
}
+ /* get DPM context for camera/microphone restriction */
+ hcamcorder->dpm_context = dpm_context_create();
+ if (hcamcorder->dpm_context) {
+ hcamcorder->dpm_policy = dpm_context_acquire_restriction_policy(hcamcorder->dpm_context);
+ if (hcamcorder->dpm_policy == NULL) {
+ _mmcam_dbg_err("dpm_context_acquire_restriction_policy failed");
+ dpm_context_destroy(hcamcorder->dpm_context);
+ hcamcorder->dpm_context = NULL;
+ }
+ }
+
+ _mmcam_dbg_warn("DPM context %p, policy %p", hcamcorder->dpm_context, hcamcorder->dpm_policy);
+
if (info->videodev_type != MM_VIDEO_DEVICE_NONE) {
_mmcamcorder_conf_get_value_int((MMHandleType)hcamcorder, hcamcorder->conf_main,
CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
hcamcorder->conf_ctrl = NULL;
}
- /* get DPM context for camera restriction */
- hcamcorder->dpm_context = dpm_context_create();
+ /* add DPM camera policy changed callback */
if (hcamcorder->dpm_context) {
- hcamcorder->dpm_policy = dpm_context_acquire_restriction_policy(hcamcorder->dpm_context);
- if (hcamcorder->dpm_policy == NULL) {
- _mmcam_dbg_err("dpm_context_acquire_restriction_policy failed");
- dpm_context_destroy(hcamcorder->dpm_context);
- hcamcorder->dpm_context = NULL;
- }
-
- /* add DPM camera policy changed callback */
if (dpm_context_add_policy_changed_cb(hcamcorder->dpm_context,
"camera", _mmcamcorder_dpm_camera_policy_changed_cb,
(void *)hcamcorder, &hcamcorder->dpm_camera_cb_id) != DPM_ERROR_NONE) {
_mmcam_dbg_log("DPM camera changed cb id %d", hcamcorder->dpm_camera_cb_id);
}
-
- _mmcam_dbg_log("DPM context %p, policy %p", hcamcorder->dpm_context, hcamcorder->dpm_policy);
} else {
_mmcamcorder_conf_get_value_int((MMHandleType)hcamcorder, hcamcorder->conf_main,
CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
g_mutex_clear(&(hcamcorder->mtsafe).lock);
g_cond_clear(&(hcamcorder->mtsafe).cond);
g_mutex_clear(&(hcamcorder->mtsafe).cmd_lock);
+ g_cond_clear(&(hcamcorder->mtsafe).cmd_cond);
g_mutex_clear(&(hcamcorder->mtsafe).asm_lock);
g_mutex_clear(&(hcamcorder->mtsafe).state_lock);
g_mutex_clear(&(hcamcorder->mtsafe).gst_state_lock);
g_mutex_clear(&(hcamcorder->mtsafe).lock);
g_cond_clear(&(hcamcorder->mtsafe).cond);
g_mutex_clear(&(hcamcorder->mtsafe).cmd_lock);
+ g_cond_clear(&(hcamcorder->mtsafe).cmd_cond);
g_mutex_clear(&(hcamcorder->mtsafe).asm_lock);
g_mutex_clear(&(hcamcorder->mtsafe).state_lock);
g_mutex_clear(&(hcamcorder->mtsafe).gst_state_lock);
int dpm_camera_state = DPM_ALLOWED;
/* check camera policy from DPM */
- if (dpm_restriction_get_camera_state(hcamcorder->dpm_policy, &dpm_camera_state) == DPM_ERROR_NONE) {
- _mmcam_dbg_log("DPM camera state %d", dpm_camera_state);
- if (dpm_camera_state == DPM_DISALLOWED) {
- _mmcam_dbg_err("CAMERA DISALLOWED by DPM");
- ret = MM_ERROR_COMMON_INVALID_PERMISSION;
- goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
+ if (hcamcorder->dpm_policy) {
+ if (dpm_restriction_get_camera_state(hcamcorder->dpm_policy, &dpm_camera_state) == DPM_ERROR_NONE) {
+ _mmcam_dbg_log("DPM camera state %d", dpm_camera_state);
+ if (dpm_camera_state == DPM_DISALLOWED) {
+ _mmcam_dbg_err("CAMERA DISALLOWED by DPM");
+ ret = MM_ERROR_COMMON_INVALID_PERMISSION;
+ goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
+ }
+ } else {
+ _mmcam_dbg_err("get DPM camera state failed, keep going...");
}
} else {
- _mmcam_dbg_err("get DPM camera state failed, keep going...");
+ _mmcam_dbg_warn("NULL dpm_policy");
}
/* prepare resource manager for camera */
- ret = _mmcamcorder_resource_manager_prepare(&hcamcorder->resource_manager, RESOURCE_TYPE_CAMERA);
+ ret = _mmcamcorder_resource_manager_prepare(&hcamcorder->resource_manager, MM_CAMCORDER_RESOURCE_TYPE_CAMERA);
if (ret != MM_ERROR_NONE) {
_mmcam_dbg_err("could not prepare for camera resource");
ret = MM_ERROR_CAMCORDER_INTERNAL;
NULL);
if (display_surface_type == MM_DISPLAY_SURFACE_OVERLAY) {
- ret = _mmcamcorder_resource_manager_prepare(&hcamcorder->resource_manager, RESOURCE_TYPE_VIDEO_OVERLAY);
+ ret = _mmcamcorder_resource_manager_prepare(&hcamcorder->resource_manager, MM_CAMCORDER_RESOURCE_TYPE_VIDEO_OVERLAY);
if(ret != MM_ERROR_NONE) {
_mmcam_dbg_err("could not prepare for video overlay resource");
ret = MM_ERROR_CAMCORDER_INTERNAL;
hcamcorder->error_code = MM_ERROR_NONE;
/* check mic policy from DPM */
- if (dpm_restriction_get_microphone_state(hcamcorder->dpm_policy, &dpm_mic_state) == DPM_ERROR_NONE) {
- _mmcam_dbg_log("DPM mic state %d", dpm_mic_state);
- if (dpm_mic_state == DPM_DISALLOWED) {
- _mmcam_dbg_err("MIC DISALLOWED by DPM");
- ret = MM_ERROR_COMMON_INVALID_PERMISSION;
- goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
+ if (hcamcorder->dpm_policy) {
+ if (dpm_restriction_get_microphone_state(hcamcorder->dpm_policy, &dpm_mic_state) == DPM_ERROR_NONE) {
+ _mmcam_dbg_log("DPM mic state %d", dpm_mic_state);
+ if (dpm_mic_state == DPM_DISALLOWED) {
+ _mmcam_dbg_err("MIC DISALLOWED by DPM");
+ ret = MM_ERROR_COMMON_INVALID_PERMISSION;
+ goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
+ }
+ } else {
+ _mmcam_dbg_err("get DPM mic state failed, keep going...");
}
} else {
- _mmcam_dbg_err("get DPM mic state failed, keep going...");
+ _mmcam_dbg_warn("NULL dpm_policy");
}
ret = hcamcorder->command((MMHandleType)hcamcorder, _MMCamcorder_CMD_RECORD);