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

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

Merge "Camera: Add support for extension dynamic latency estimation"

parents 80b01c7e 85685d79
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -17936,6 +17936,7 @@ package android.hardware.camera2 {
    method public int capture(@NonNull android.hardware.camera2.CaptureRequest, @NonNull java.util.concurrent.Executor, @NonNull android.hardware.camera2.CameraExtensionSession.ExtensionCaptureCallback) throws android.hardware.camera2.CameraAccessException;
    method public void close() throws android.hardware.camera2.CameraAccessException;
    method @NonNull public android.hardware.camera2.CameraDevice getDevice();
    method @Nullable public android.util.Pair<java.lang.Long,java.lang.Long> getRealtimeStillCaptureLatency() throws android.hardware.camera2.CameraAccessException;
    method public int setRepeatingRequest(@NonNull android.hardware.camera2.CaptureRequest, @NonNull java.util.concurrent.Executor, @NonNull android.hardware.camera2.CameraExtensionSession.ExtensionCaptureCallback) throws android.hardware.camera2.CameraAccessException;
    method public void stopRepeating() throws android.hardware.camera2.CameraAccessException;
  }
+27 −0
Original line number Diff line number Diff line
@@ -18,6 +18,11 @@ package android.hardware.camera2;

import android.annotation.IntRange;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.hardware.camera2.impl.PublicKey;
import android.hardware.camera2.utils.TypeReference;
import android.util.Pair;
import android.util.Range;

import java.util.concurrent.Executor;

@@ -423,6 +428,28 @@ public abstract class CameraExtensionSession implements AutoCloseable {
        throw new UnsupportedOperationException("Subclasses must override this method");
    }

    /**
     * Return the realtime still {@link #capture} latency.
     *
     * <p>The pair will be in milliseconds with the first value indicating the capture latency from
     * the {@link ExtensionCaptureCallback#onCaptureStarted} until
     * {@link ExtensionCaptureCallback#onCaptureProcessStarted}
     * and the second value containing the estimated post-processing latency from
     * {@link ExtensionCaptureCallback#onCaptureProcessStarted} until the processed frame returns
     * to the client.</p>
     *
     * <p>The estimations will take into account the current environment conditions, the camera
     * state and will include the time spent processing the multi-frame capture request along with
     * any additional time for encoding of the processed buffer if necessary.</p>
     *
     * @return The realtime still capture latency,
     * or {@code null} if the estimation is not supported.
     */
    @Nullable
    public Pair<Long, Long> getRealtimeStillCaptureLatency() throws CameraAccessException {
        throw new UnsupportedOperationException("Subclasses must override this method");
    }

    /**
     * Close this capture session asynchronously.
     *
+2 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ import android.hardware.camera2.impl.CameraMetadataNative;

import android.hardware.camera2.extension.CaptureStageImpl;
import android.hardware.camera2.extension.ICaptureProcessorImpl;
import android.hardware.camera2.extension.LatencyPair;
import android.hardware.camera2.extension.LatencyRange;
import android.hardware.camera2.extension.Size;
import android.hardware.camera2.extension.SizeList;
@@ -43,4 +44,5 @@ interface IImageCaptureExtenderImpl
    CameraMetadataNative getAvailableCaptureRequestKeys();
    CameraMetadataNative getAvailableCaptureResultKeys();
    boolean isCaptureProcessProgressAvailable();
    @nullable LatencyPair getRealtimeCaptureLatency();
}
+3 −0
Original line number Diff line number Diff line
@@ -19,6 +19,8 @@ import android.hardware.camera2.CaptureRequest;
import android.hardware.camera2.extension.CameraSessionConfig;
import android.hardware.camera2.extension.ICaptureCallback;
import android.hardware.camera2.extension.IRequestProcessorImpl;
import android.hardware.camera2.extension.LatencyPair;
import android.hardware.camera2.extension.LatencyRange;
import android.hardware.camera2.extension.OutputSurface;

/** @hide */
@@ -34,4 +36,5 @@ interface ISessionProcessorImpl
    int startCapture(in ICaptureCallback callback);
    void setParameters(in CaptureRequest captureRequest);
    int startTrigger(in CaptureRequest captureRequest, in ICaptureCallback callback);
    @nullable LatencyPair getRealtimeCaptureLatency();
}
+23 −0
Original line number Diff line number Diff line
/**
 * Copyright (c) 2022, 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.
 */
package android.hardware.camera2.extension;

/** @hide */
parcelable LatencyPair
{
    long first;
    long second;
}
Loading