本文整理汇总了C++中JNICameraContext::decStrong方法的典型用法代码示例。如果您正苦于以下问题:C++ JNICameraContext::decStrong方法的具体用法?C++ JNICameraContext::decStrong怎么用?C++ JNICameraContext::decStrong使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JNICameraContext
的用法示例。
在下文中一共展示了JNICameraContext::decStrong方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: android_hardware_Camera_release
// disconnect from camera service
// It's okay to call this when the native camera context is already null.
// This handles the case where the user has called release() and the
// finalizer is invoked later.
static void android_hardware_Camera_release(JNIEnv *env, jobject thiz)
{
// TODO: Change to LOGV
LOGV("release camera");
JNICameraContext* context = NULL;
sp<Camera> camera;
{
Mutex::Autolock _l(sLock);
context = reinterpret_cast<JNICameraContext*>(env->GetIntField(thiz, fields.context));
// Make sure we do not attempt to callback on a deleted Java object.
env->SetIntField(thiz, fields.context, 0);
}
// clean up if release has not been called before
if (context != NULL) {
camera = context->getCamera();
context->release();
LOGV("native_release: context=%p camera=%p", context, camera.get());
// clear callbacks
if (camera != NULL) {
camera->setPreviewCallbackFlags(CAMERA_FRAME_CALLBACK_FLAG_NOOP);
camera->disconnect();
}
// remove context to prevent further Java access
context->decStrong(thiz);
}
}
示例2: android_hardware_Camera_release
// disconnect from camera service
// It's okay to call this when the native camera context is already null.
// This handles the case where the user has called release() and the
// finalizer is invoked later.
static void android_hardware_Camera_release(JNIEnv *env, jobject thiz)
{
// TODO: Change to ALOGV
ALOGV("release camera");
JNICameraContext* context = NULL;
sp<Camera> camera;
{
Mutex::Autolock _l(sLock);
context = reinterpret_cast<JNICameraContext*>(env->GetIntField(thiz, fields.context));
// Make sure we do not attempt to callback on a deleted Java object.
env->SetIntField(thiz, fields.context, 0);
}
// clean up if release has not been called before
if (context != NULL) {
camera = context->getCamera();
context->release();
ALOGV("native_release: context=%p camera=%p", context, camera.get());
//!++
//#ifdef MTK_CAMERA_BSP_SUPPORT
#if 1
ALOGD("(tid:%d)[native_release] + context=%p camera=%p \n", ::gettid(), context, camera.get());
// clear callbacks
if (camera != NULL) {
ALOGD("[native_release] context->getStrongCount(%d) camera->getStrongCount(%d) \n", context->getStrongCount(), camera->getStrongCount());
camera->setPreviewCallbackFlags(CAMERA_FRAME_CALLBACK_FLAG_NOOP);
camera->disconnect();
camera = NULL;
}
ALOGD("(tid:%d)[native_release] - context=%p camera=%p \n", ::gettid(), context, camera.get());
#else
// clear callbacks
if (camera != NULL) {
camera->setPreviewCallbackFlags(CAMERA_FRAME_CALLBACK_FLAG_NOOP);
camera->disconnect();
}
#endif //MTK_CAMERA_BSP_SUPPORT
//!--
// remove context to prevent further Java access
context->decStrong((void*)android_hardware_Camera_native_setup);
}
//!++
//#ifdef MTK_CAMERA_BSP_SUPPORT
ALOGD("(tid:%d)[release camera] - X context=%p \n", ::gettid(), context);
//#endif
//!--
}