Enhance session backward compatibility
[platform/core/multimedia/libmm-camcorder.git] / src / mm_camcorder_attribute.c
index 4e80004..c92fcc8 100644 (file)
@@ -1747,7 +1747,7 @@ _mmcamcorder_set_attributes(MMHandleType handle, char **err_attr_name, const cha
        if (attrs) {
                ret = __mmcamcorder_check_valid_pair(handle, err_attr_name, attribute_name, var_args);
        } else {
-               _mmcam_dbg_err("handle 0x%x, attrs is NULL, attr name [%s]", handle, attribute_name);
+               _mmcam_dbg_err("handle %p, attrs is NULL, attr name [%s]", handle, attribute_name);
                ret = MM_ERROR_CAMCORDER_NOT_INITIALIZED;
        }
 
@@ -2575,9 +2575,7 @@ bool _mmcamcorder_commit_camera_ptz_type(MMHandleType handle, int attr_idx, cons
                        }
                }
 
-               if (item == NULL) {
-                       _mmcam_dbg_warn("failed to find tilt control channel");
-               }
+               _mmcam_dbg_warn("failed to find tilt control channel");
        }
 
        return FALSE;
@@ -2642,9 +2640,7 @@ bool _mmcamcorder_commit_camera_pan(MMHandleType handle, int attr_idx, const mmf
                        }
                }
 
-               if (item == NULL) {
-                       _mmcam_dbg_warn("failed to find pan control channel");
-               }
+               _mmcam_dbg_warn("failed to find pan control channel");
        }
 
        return FALSE;
@@ -2709,9 +2705,7 @@ bool _mmcamcorder_commit_camera_tilt(MMHandleType handle, int attr_idx, const mm
                        }
                }
 
-               if (item == NULL) {
-                       _mmcam_dbg_warn("failed to find tilt control channel");
-               }
+               _mmcam_dbg_warn("failed to find tilt control channel");
        }
 
        return FALSE;
@@ -4552,6 +4546,17 @@ bool _mmcamcorder_commit_pid_for_sound_focus(MMHandleType handle, int attr_idx,
                        hcamcorder->sound_focus_register = FALSE;
                        _mmcam_dbg_warn("no need to use sound focus internally");
                } else {
+                       /* check my session type : allow only media & call series here */
+                       if ((hcamcorder->session_type != MM_SESSION_TYPE_MEDIA) &&
+                               (hcamcorder->session_type != MM_SESSION_TYPE_MEDIA_RECORD) &&
+                               (hcamcorder->session_type != MM_SESSION_TYPE_CALL) &&
+                               (hcamcorder->session_type != MM_SESSION_TYPE_VIDEOCALL) &&
+                               (hcamcorder->session_type != MM_SESSION_TYPE_VOIP)) {
+                               _mmcam_dbg_err("Blocked by session policy, my session_type[%s]", hcamcorder->session_type);
+                               hcamcorder->error_code = MM_ERROR_POLICY_BLOCKED;
+                               return FALSE;
+                       }
+
                        ret = mm_sound_focus_get_id(&hcamcorder->sound_focus_id);
                        if (ret != MM_ERROR_NONE) {
                                _mmcam_dbg_err("mm_sound_focus_get_id failed");