Camera: Fix high speed recording failure due to prepare()
In case application sends 2 consecutive setRepeatingBurst, the first
request may be preparing the video stream, whiel the second request
fails the isPreparing check.
Fix this by distinguishing between internal and external prepare. For
internal prepare, allow new requests to come through to the request
thread.
Bug: 114422231
Bug: 109830370
Test: Camera CTS
Change-Id: I55a7271e3924f2cb8cf9c452e934b070a82bc4ca
diff --git a/services/camera/libcameraservice/device3/Camera3Stream.h b/services/camera/libcameraservice/device3/Camera3Stream.h
index e6fb7f9..9c0f4c0 100644
--- a/services/camera/libcameraservice/device3/Camera3Stream.h
+++ b/services/camera/libcameraservice/device3/Camera3Stream.h
@@ -232,6 +232,11 @@
*
* This call performs no allocation, so is quick to call.
*
+ * blockRequest specifies whether prepare will block upcoming capture
+ * request. This flag should only be set to false if the caller guarantees
+ * the whole buffer preparation process is done before capture request
+ * comes in.
+ *
* Returns:
* OK if no more buffers need to be preallocated
* NOT_ENOUGH_DATA if calls to prepareNextBuffer are needed to finish
@@ -240,12 +245,12 @@
* INVALID_OPERATION if called when not in CONFIGURED state, or a
* valid buffer has already been returned to this stream.
*/
- status_t startPrepare(int maxCount);
+ status_t startPrepare(int maxCount, bool blockRequest);
/**
- * Check if the stream is mid-preparing.
+ * Check if the request on a stream is blocked by prepare.
*/
- bool isPreparing() const;
+ bool isBlockedByPrepare() const;
/**
* Continue stream buffer preparation by allocating the next
@@ -534,6 +539,7 @@
// has been called sufficient number of times, or stream configuration
// had to register buffers with the HAL
bool mPrepared;
+ bool mPrepareBlockRequest;
Vector<camera3_stream_buffer_t> mPreparedBuffers;
size_t mPreparedBufferIdx;