[ACR-1813] Add new return value for preview callback APIs
[platform/core/api/camera.git] / src / camera.c
index ecd9e82..d10029f 100644 (file)
@@ -3837,6 +3837,9 @@ int camera_set_preview_cb(camera_h camera, camera_preview_cb callback, void *use
                return CAMERA_ERROR_INVALID_PARAMETER;
        }
 
+       CAMERA_CHECK_THREAD_RETURN_VAL(pc->cb_info->preview_cb_info.thread,
+               CAMERA_ERROR_INVALID_OPERATION, "should not be called within a invoked callback");
+
        CAM_LOG_INFO("Enter");
 
        _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
@@ -3863,6 +3866,8 @@ int camera_unset_preview_cb(camera_h camera)
        muse_camera_api_e api = MUSE_CAMERA_API_UNSET_PREVIEW_CB;
 
        CAMERA_CHECK_HANDLE_RETURN_VAL(pc, CAMERA_ERROR_INVALID_PARAMETER);
+       CAMERA_CHECK_THREAD_RETURN_VAL(pc->cb_info->preview_cb_info.thread,
+               CAMERA_ERROR_INVALID_OPERATION, "should not be called within a invoked callback");
 
        CAM_LOG_INFO("Enter");
 
@@ -3901,6 +3906,9 @@ int camera_set_media_packet_preview_cb(camera_h camera, camera_media_packet_prev
                return CAMERA_ERROR_INVALID_PARAMETER;
        }
 
+       CAMERA_CHECK_THREAD_RETURN_VAL(pc->cb_info->preview_cb_info.thread,
+               CAMERA_ERROR_INVALID_OPERATION, "should not be called within a invoked callback");
+
        CAM_LOG_INFO("Enter");
 
        _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
@@ -3933,6 +3941,9 @@ int camera_unset_media_packet_preview_cb(camera_h camera)
                return CAMERA_ERROR_NOT_SUPPORTED;
        }
 
+       CAMERA_CHECK_THREAD_RETURN_VAL(pc->cb_info->preview_cb_info.thread,
+               CAMERA_ERROR_INVALID_OPERATION, "should not be called within a invoked callback");
+
        CAM_LOG_INFO("Enter");
 
        _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
@@ -6606,6 +6617,9 @@ int camera_set_extra_preview_cb(camera_h camera, camera_extra_preview_cb callbac
                return CAMERA_ERROR_INVALID_PARAMETER;
        }
 
+       CAMERA_CHECK_THREAD_RETURN_VAL(pc->cb_info->preview_cb_info.thread,
+               CAMERA_ERROR_INVALID_OPERATION, "should not be called within a invoked callback");
+
        CAM_LOG_INFO("Enter");
 
        _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
@@ -6638,6 +6652,9 @@ int camera_unset_extra_preview_cb(camera_h camera)
                return CAMERA_ERROR_NOT_SUPPORTED;
        }
 
+       CAMERA_CHECK_THREAD_RETURN_VAL(pc->cb_info->preview_cb_info.thread,
+               CAMERA_ERROR_INVALID_OPERATION, "should not be called within a invoked callback");
+
        CAM_LOG_INFO("Enter");
 
        _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);