当前位置: 首页>>代码示例>>C++>>正文


C++ JNICameraContext::decStrong方法代码示例

本文整理汇总了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);
    }
}
开发者ID:AwaisKing,项目名称:mt6577_aosp_source,代码行数:34,代码来源:android_hardware_Camera.cpp

示例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
//!--
}
开发者ID:LuckJC,项目名称:pro-fw,代码行数:55,代码来源:android_hardware_Camera.cpp


注:本文中的JNICameraContext::decStrong方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。