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

Commit da976b07 authored by Yin-Chia Yeh's avatar Yin-Chia Yeh Committed by android-build-merger
Browse files

Merge "Camera: stop streaming before deleting jpeg stream" into pi-dev am: 0f701171

am: 14229c56

Change-Id: I4cead69b3f574e87bdf0222d8193cf4d3fe71871
parents cb645111 14229c56
Loading
Loading
Loading
Loading
+29 −1
Original line number Diff line number Diff line
@@ -779,7 +779,35 @@ status_t Camera2Client::startPreviewL(Parameters &params, bool restart) {
    int lastJpegStreamId = mJpegProcessor->getStreamId();
    // If jpeg stream will slow down preview, make sure we remove it before starting preview
    if (params.slowJpegMode) {
        mJpegProcessor->deleteStream();
        // Pause preview if we are streaming
        int32_t activeRequestId = mStreamingProcessor->getActiveRequestId();
        if (activeRequestId != 0) {
            res = mStreamingProcessor->togglePauseStream(/*pause*/true);
            if (res != OK) {
                ALOGE("%s: Camera %d: Can't pause streaming: %s (%d)",
                        __FUNCTION__, mCameraId, strerror(-res), res);
            }
            res = mDevice->waitUntilDrained();
            if (res != OK) {
                ALOGE("%s: Camera %d: Waiting to stop streaming failed: %s (%d)",
                        __FUNCTION__, mCameraId, strerror(-res), res);
            }
        }

        res = mJpegProcessor->deleteStream();

        if (res != OK) {
            ALOGE("%s: Camera %d: delete Jpeg stream failed: %s (%d)",
                    __FUNCTION__, mCameraId,  strerror(-res), res);
        }

        if (activeRequestId != 0) {
            res = mStreamingProcessor->togglePauseStream(/*pause*/false);
            if (res != OK) {
                ALOGE("%s: Camera %d: Can't unpause streaming: %s (%d)",
                        __FUNCTION__, mCameraId, strerror(-res), res);
            }
        }
    } else {
        res = updateProcessorStream(mJpegProcessor, params);
        if (res != OK) {
+5 −1
Original line number Diff line number Diff line
@@ -199,7 +199,11 @@ status_t JpegProcessor::deleteStream() {
            return INVALID_OPERATION;
        }

        device->deleteStream(mCaptureStreamId);
        status_t res = device->deleteStream(mCaptureStreamId);
        if (res != OK) {
            ALOGE("%s: delete stream %d failed!", __FUNCTION__, mCaptureStreamId);
            return res;
        }

        mCaptureHeap.clear();
        mCaptureWindow.clear();
+1 −1
Original line number Diff line number Diff line
@@ -1550,7 +1550,7 @@ status_t Camera3Device::deleteStream(int id) {
    // CameraDevice semantics require device to already be idle before
    // deleteStream is called, unlike for createStream.
    if (mStatus == STATUS_ACTIVE) {
        ALOGV("%s: Camera %s: Device not idle", __FUNCTION__, mId.string());
        ALOGW("%s: Camera %s: Device not idle", __FUNCTION__, mId.string());
        return -EBUSY;
    }