camera2 (v)ndk: Add APIs for pre-allocation of surface buffers.
Clients may need to pre-allocate stream buffers in order to reduce
affects of buffer-allocation time such as frame jank till steady state
capture is reached (eg: for a repeating request).
The SDK already has an api which does this :
CameraCaptureSession.prepare(Surface). We're exposing a similar API to
the ndk/ vndk here.
Bug: 259735869
Test: NdkCameraDeviceTest.java
Change-Id: Iee8559fcebd61a6886f23779a05351b52633f851
Signed-off-by: Jayant Chowdhary <jchowdhary@google.com>
diff --git a/camera/ndk/impl/ACameraCaptureSession.h b/camera/ndk/impl/ACameraCaptureSession.h
index cd65e8c..145473b 100644
--- a/camera/ndk/impl/ACameraCaptureSession.h
+++ b/camera/ndk/impl/ACameraCaptureSession.h
@@ -130,6 +130,12 @@
camera_status_t updateOutputConfiguration(ACaptureSessionOutput *output);
+ void setWindowPreparedCallback(ACameraCaptureSession_prepareCallbacks *cb) {
+ Mutex::Autolock _l(mSessionLock);
+ mPreparedCb = *cb;
+ }
+ camera_status_t prepare(ACameraWindowType *window);
+
ACameraDevice* getDevice();
private:
@@ -156,6 +162,7 @@
bool mIsClosed = false;
bool mClosedByApp = false;
+ ACameraCaptureSession_prepareCallbacks mPreparedCb;
Mutex mSessionLock;
};