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

Commit 69a74297 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "camera: Drop pending preview for enableZsl shots" into oc-mr1-dev

parents 39fdbd09 63068520
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -859,6 +859,12 @@ status_t Camera2Client::startPreviewL(Parameters &params, bool restart) {

    outputStreams.push(getPreviewStreamId());

    if (params.isDeviceZslSupported) {
        // If device ZSL is supported, resume preview buffers that may be paused
        // during last takePicture().
        mDevice->dropStreamBuffers(false, getPreviewStreamId());
    }

    if (!params.recordingHint) {
        if (!restart) {
            res = mStreamingProcessor->updatePreviewRequest(params);
+6 −0
Original line number Diff line number Diff line
@@ -553,6 +553,12 @@ CaptureSequencer::CaptureState CaptureSequencer::manageStandardCapture(
        return DONE;
    }

    if (l.mParameters.isDeviceZslSupported) {
        // If device ZSL is supported, drop all pending preview buffers to reduce the chance of
        // rendering preview frames newer than the still frame.
        client->getCameraDevice()->dropStreamBuffers(true, client->getPreviewStreamId());
    }

    /**
     * Clear the streaming request for still-capture pictures
     *   (as opposed to i.e. video snapshots)
+5 −0
Original line number Diff line number Diff line
@@ -349,6 +349,11 @@ class CameraDeviceBase : public virtual RefBase {
    virtual status_t setConsumerSurfaces(int streamId,
            const std::vector<sp<Surface>>& consumers) = 0;

    /**
     * Drop buffers for stream of streamId if dropping is true. If dropping is false, do not
     * drop buffers for stream of streamId.
     */
    virtual status_t dropStreamBuffers(bool /*dropping*/, int /*streamId*/) = 0;
};

}; // namespace android
+14 −0
Original line number Diff line number Diff line
@@ -1977,6 +1977,20 @@ status_t Camera3Device::setConsumerSurfaces(int streamId,
    return OK;
}

status_t Camera3Device::dropStreamBuffers(bool dropping, int streamId) {
    Mutex::Autolock il(mInterfaceLock);
    Mutex::Autolock l(mLock);

    int idx = mOutputStreams.indexOfKey(streamId);
    if (idx == NAME_NOT_FOUND) {
        ALOGE("%s: Stream %d is not found.", __FUNCTION__, streamId);
        return BAD_VALUE;
    }

    sp<Camera3OutputStreamInterface> stream = mOutputStreams.editValueAt(idx);
    return stream->dropBuffers(dropping);
}

/**
 * Camera3Device private methods
 */
+6 −0
Original line number Diff line number Diff line
@@ -178,6 +178,12 @@ class Camera3Device :
     */
    status_t setConsumerSurfaces(int streamId, const std::vector<sp<Surface>>& consumers) override;

    /**
     * Drop buffers for stream of streamId if dropping is true. If dropping is false, do not
     * drop buffers for stream of streamId.
     */
    status_t dropStreamBuffers(bool dropping, int streamId) override;

  private:

    // internal typedefs
Loading