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

Commit dc2e6ddc authored by Eino-Ville Talvala's avatar Eino-Ville Talvala
Browse files

Camera2Client: Revert HALv2 device behavior back to MR2

- Do not idle device before video snapshot stream configuration, to
  avoid deadlock during waiting.
- Do not tear down ZSL stream
- Don't refresh ZSL stream after deletion was requested.
  The v2 HAL implementations really don't like the ZSL stream being
  touched ever.

Bug: 17634430
Bug: 17628507

Change-Id: I36b44a395e697be9802c4bd917a82b77c8d04be2
parent a67ced97
Loading
Loading
Loading
Loading
+68 −46
Original line number Original line Diff line number Diff line
@@ -1049,6 +1049,8 @@ status_t Camera2Client::startRecordingL(Parameters &params, bool restart) {
        }
        }
    }
    }


    // On current HALs, clean up ZSL before transitioning into recording
    if (mDeviceVersion != CAMERA_DEVICE_API_VERSION_2_0) {
        if (mZslProcessor->getStreamId() != NO_STREAM) {
        if (mZslProcessor->getStreamId() != NO_STREAM) {
            ALOGV("%s: Camera %d: Clearing out zsl stream before "
            ALOGV("%s: Camera %d: Clearing out zsl stream before "
                    "creating recording stream", __FUNCTION__, mCameraId);
                    "creating recording stream", __FUNCTION__, mCameraId);
@@ -1077,11 +1079,16 @@ status_t Camera2Client::startRecordingL(Parameters &params, bool restart) {
                return res;
                return res;
            }
            }
        }
        }
    }


    // Disable callbacks if they're enabled; can't record and use callbacks,
    // Disable callbacks if they're enabled; can't record and use callbacks,
    // and we can't fail record start without stagefright asserting.
    // and we can't fail record start without stagefright asserting.
    params.previewCallbackFlags = 0;
    params.previewCallbackFlags = 0;


    if (mDeviceVersion != CAMERA_DEVICE_API_VERSION_2_0) {
        // For newer devices, may need to reconfigure video snapshot JPEG sizes
        // during recording startup, so need a more complex sequence here to
        // ensure an early stream reconfiguration doesn't happen
        bool recordingStreamNeedsUpdate;
        bool recordingStreamNeedsUpdate;
        res = mStreamingProcessor->recordingStreamNeedsUpdate(params, &recordingStreamNeedsUpdate);
        res = mStreamingProcessor->recordingStreamNeedsUpdate(params, &recordingStreamNeedsUpdate);
        if (res != OK) {
        if (res != OK) {
@@ -1096,20 +1103,35 @@ status_t Camera2Client::startRecordingL(Parameters &params, bool restart) {
            // when device is streaming
            // when device is streaming
            res = mStreamingProcessor->stopStream();
            res = mStreamingProcessor->stopStream();
            if (res != OK) {
            if (res != OK) {
            ALOGE("%s: Camera %d: Can't stop streaming to update record stream",
                ALOGE("%s: Camera %d: Can't stop streaming to update record "
                    __FUNCTION__, mCameraId);
                        "stream", __FUNCTION__, mCameraId);
                return res;
                return res;
            }
            }
            res = mDevice->waitUntilDrained();
            res = mDevice->waitUntilDrained();
            if (res != OK) {
            if (res != OK) {
            ALOGE("%s: Camera %d: Waiting to stop streaming failed: %s (%d)",
                ALOGE("%s: Camera %d: Waiting to stop streaming failed: "
                    __FUNCTION__, mCameraId, strerror(-res), res);
                        "%s (%d)", __FUNCTION__, mCameraId,
                        strerror(-res), res);
            }

            res = updateProcessorStream<
                    StreamingProcessor,
                    &StreamingProcessor::updateRecordingStream>(
                        mStreamingProcessor,
                        params);
            if (res != OK) {
                ALOGE("%s: Camera %d: Unable to update recording stream: "
                        "%s (%d)", __FUNCTION__, mCameraId,
                        strerror(-res), res);
                return res;
            }
        }
        }
    } else {
        // Maintain call sequencing for HALv2 devices.
        res = updateProcessorStream<
        res = updateProcessorStream<
                StreamingProcessor,
                StreamingProcessor,
                &StreamingProcessor::updateRecordingStream>(mStreamingProcessor,
                &StreamingProcessor::updateRecordingStream>(mStreamingProcessor,
                    params);
                    params);

        if (res != OK) {
        if (res != OK) {
            ALOGE("%s: Camera %d: Unable to update recording stream: %s (%d)",
            ALOGE("%s: Camera %d: Unable to update recording stream: %s (%d)",
                    __FUNCTION__, mCameraId, strerror(-res), res);
                    __FUNCTION__, mCameraId, strerror(-res), res);
+1 −1
Original line number Original line Diff line number Diff line
@@ -154,7 +154,7 @@ status_t ZslProcessor::updateStream(const Parameters &params) {
                    mId, strerror(-res), res);
                    mId, strerror(-res), res);
            return res;
            return res;
        }
        }
        if (mDeleted || currentWidth != (uint32_t)params.fastInfo.arrayWidth ||
        if (currentWidth != (uint32_t)params.fastInfo.arrayWidth ||
                currentHeight != (uint32_t)params.fastInfo.arrayHeight) {
                currentHeight != (uint32_t)params.fastInfo.arrayHeight) {
            res = device->deleteReprocessStream(mZslReprocessStreamId);
            res = device->deleteReprocessStream(mZslReprocessStreamId);
            if (res != OK) {
            if (res != OK) {