Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4f04e831 authored by Austin Borger's avatar Austin Borger Committed by Android (Google) Code Review
Browse files

Merge "CameraService: Check Thread::run for failed threads."

parents fea0c3b9 7b129548
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -79,7 +79,13 @@ public:
                    new CameraServiceWatchdog(cycles, cycleLength, mEnabled);
            mEnabledLock.unlock();

            tempWatchdog->run("CameraServiceWatchdog");
            status_t status = tempWatchdog->run("CameraServiceWatchdog");
            if (status != OK) {
                ALOGE("Unable to watch thread: %s (%d)", strerror(-status), status);
                res = watchThread(func, tid);
                return res;
            }

            res = tempWatchdog->watchThread(func, tid);
            tempWatchdog->requestExit();
            tempWatchdog.clear();
+30 −5
Original line number Diff line number Diff line
@@ -140,28 +140,53 @@ status_t Camera2Client::initializeImpl(TProviderPtr providerPtr, const String8&
    mFrameProcessor = new FrameProcessor(mDevice, this);
    threadName = String8::format("C2-%d-FrameProc",
            mCameraId);
    mFrameProcessor->run(threadName.string());
    res = mFrameProcessor->run(threadName.string());
    if (res != OK) {
        ALOGE("%s: Unable to start frame processor thread: %s (%d)",
                __FUNCTION__, strerror(-res), res);
        return res;
    }

    mCaptureSequencer = new CaptureSequencer(this);
    threadName = String8::format("C2-%d-CaptureSeq",
            mCameraId);
    mCaptureSequencer->run(threadName.string());
    res = mCaptureSequencer->run(threadName.string());
    if (res != OK) {
        ALOGE("%s: Unable to start capture sequencer thread: %s (%d)",
                __FUNCTION__, strerror(-res), res);
        return res;
    }

    mJpegProcessor = new JpegProcessor(this, mCaptureSequencer);
    threadName = String8::format("C2-%d-JpegProc",
            mCameraId);
    mJpegProcessor->run(threadName.string());
    res = mJpegProcessor->run(threadName.string());
    if (res != OK) {
        ALOGE("%s: Unable to start jpeg processor thread: %s (%d)",
                __FUNCTION__, strerror(-res), res);
        return res;
    }

    mZslProcessor = new ZslProcessor(this, mCaptureSequencer);

    threadName = String8::format("C2-%d-ZslProc",
            mCameraId);
    mZslProcessor->run(threadName.string());
    res = mZslProcessor->run(threadName.string());
    if (res != OK) {
        ALOGE("%s: Unable to start zsl processor thread: %s (%d)",
                __FUNCTION__, strerror(-res), res);
        return res;
    }

    mCallbackProcessor = new CallbackProcessor(this);
    threadName = String8::format("C2-%d-CallbkProc",
            mCameraId);
    mCallbackProcessor->run(threadName.string());
    res = mCallbackProcessor->run(threadName.string());
    if (res != OK) {
        ALOGE("%s: Unable to start callback processor thread: %s (%d)",
                __FUNCTION__, strerror(-res), res);
        return res;
    }

    if (gLogLevel >= 1) {
        SharedParameters::Lock l(mParameters);
+6 −1
Original line number Diff line number Diff line
@@ -127,7 +127,12 @@ status_t CameraDeviceClient::initializeImpl(TProviderPtr providerPtr, const Stri
    String8 threadName;
    mFrameProcessor = new FrameProcessorBase(mDevice);
    threadName = String8::format("CDU-%s-FrameProc", mCameraIdStr.string());
    mFrameProcessor->run(threadName.string());
    res = mFrameProcessor->run(threadName.string());
    if (res != OK) {
        ALOGE("%s: Unable to start frame processor thread: %s (%d)",
                __FUNCTION__, strerror(-res), res);
        return res;
    }

    mFrameProcessor->registerListener(camera2::FrameProcessorBase::FRAME_PROCESSOR_LISTENER_MIN_ID,
                                      camera2::FrameProcessorBase::FRAME_PROCESSOR_LISTENER_MAX_ID,
+6 −1
Original line number Diff line number Diff line
@@ -44,7 +44,12 @@ status_t CameraOfflineSessionClient::initialize(sp<CameraProviderManager>, const
    String8 threadName;
    mFrameProcessor = new camera2::FrameProcessorBase(mOfflineSession);
    threadName = String8::format("Offline-%s-FrameProc", mCameraIdStr.string());
    mFrameProcessor->run(threadName.string());
    res = mFrameProcessor->run(threadName.string());
    if (res != OK) {
        ALOGE("%s: Unable to start frame processor thread: %s (%d)",
                __FUNCTION__, strerror(-res), res);
        return res;
    }

    mFrameProcessor->registerListener(camera2::FrameProcessorBase::FRAME_PROCESSOR_LISTENER_MIN_ID,
                                      camera2::FrameProcessorBase::FRAME_PROCESSOR_LISTENER_MAX_ID,
+11 −1
Original line number Diff line number Diff line
@@ -147,10 +147,20 @@ status_t Camera2ClientBase<TClientBase>::initializeImpl(TProviderPtr providerPtr

    wp<NotificationListener> weakThis(this);
    res = mDevice->setNotifyCallback(weakThis);
    if (res != OK) {
        ALOGE("%s: Camera %s: Unable to set notify callback: %s (%d)",
                __FUNCTION__, TClientBase::mCameraIdStr.string(), strerror(-res), res);
        return res;
    }

    /** Start watchdog thread */
    mCameraServiceWatchdog = new CameraServiceWatchdog();
    mCameraServiceWatchdog->run("Camera2ClientBaseWatchdog");
    res = mCameraServiceWatchdog->run("Camera2ClientBaseWatchdog");
    if (res != OK) {
        ALOGE("%s: Unable to start camera service watchdog thread: %s (%d)",
                __FUNCTION__, strerror(-res), res);
        return res;
    }

    return OK;
}
Loading