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

Commit 4bcbb07b authored by Ruben Brunk's avatar Ruben Brunk Committed by Android (Google) Code Review
Browse files

Merge "camera2: Fix video snapshot for HAL 2.* devices." into lmp-dev

parents 83ee5564 6551e1ed
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ LOCAL_SRC_FILES:= \
    api1/client2/JpegProcessor.cpp \
    api1/client2/CallbackProcessor.cpp \
    api1/client2/ZslProcessor.cpp \
    api1/client2/ZslProcessorInterface.cpp \
    api1/client2/BurstCapture.cpp \
    api1/client2/JpegCompressor.cpp \
    api1/client2/CaptureSequencer.cpp \
+3 −0
Original line number Diff line number Diff line
@@ -434,6 +434,9 @@ void Camera2Client::disconnect() {
    mCallbackProcessor->deleteStream();
    mZslProcessor->deleteStream();

    // Remove all ZSL stream state before disconnect; needed to work around b/15408128.
    mZslProcessor->disconnect();

    ALOGV("Camera %d: Disconnecting device", mCameraId);

    mDevice->disconnect();
+13 −2
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ ZslProcessor::ZslProcessor(
        mDevice(client->getCameraDevice()),
        mSequencer(sequencer),
        mId(client->getCameraId()),
        mDeleted(false),
        mZslBufferAvailable(false),
        mZslStreamId(NO_STREAM),
        mZslReprocessStreamId(NO_STREAM),
@@ -62,7 +63,7 @@ ZslProcessor::ZslProcessor(

ZslProcessor::~ZslProcessor() {
    ALOGV("%s: Exit", __FUNCTION__);
    deleteStream();
    disconnect();
}

void ZslProcessor::onFrameAvailable() {
@@ -153,7 +154,7 @@ status_t ZslProcessor::updateStream(const Parameters &params) {
                    mId, strerror(-res), res);
            return res;
        }
        if (currentWidth != (uint32_t)params.fastInfo.arrayWidth ||
        if (mDeleted || currentWidth != (uint32_t)params.fastInfo.arrayWidth ||
                currentHeight != (uint32_t)params.fastInfo.arrayHeight) {
            res = device->deleteReprocessStream(mZslReprocessStreamId);
            if (res != OK) {
@@ -175,6 +176,8 @@ status_t ZslProcessor::updateStream(const Parameters &params) {
        }
    }

    mDeleted = false;

    if (mZslStreamId == NO_STREAM) {
        // Create stream for HAL production
        // TODO: Sort out better way to select resolution for ZSL
@@ -208,6 +211,14 @@ status_t ZslProcessor::updateStream(const Parameters &params) {
}

status_t ZslProcessor::deleteStream() {
    ATRACE_CALL();
    Mutex::Autolock l(mInputMutex);
    // WAR(b/15408128): do not delete stream unless client is being disconnected.
    mDeleted = true;
    return OK;
}

status_t ZslProcessor::disconnect() {
    ATRACE_CALL();
    status_t res;

+3 −0
Original line number Diff line number Diff line
@@ -67,6 +67,7 @@ class ZslProcessor:

    status_t updateStream(const Parameters &params);
    status_t deleteStream();
    status_t disconnect();
    int getStreamId() const;

    status_t pushToReprocess(int32_t requestId);
@@ -86,6 +87,8 @@ class ZslProcessor:
    wp<CaptureSequencer> mSequencer;
    int mId;

    bool mDeleted;

    mutable Mutex mInputMutex;
    bool mZslBufferAvailable;
    Condition mZslBufferAvailableSignal;
+28 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2014 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "ZslProcessorInterface.h"

namespace android {
namespace camera2 {

status_t ZslProcessorInterface::disconnect() {
    return OK;
}

}; //namespace camera2
}; //namespace android
Loading