android: camera_device: Generate ResultMetadata earlier
Generate the ResultMetadata before performing JPEG compression so that JPEG specific metadata can be added to the metadata when it has been processed. Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
9f07aebde8
commit
c09aee4ccb
1 changed files with 12 additions and 11 deletions
|
@ -1234,6 +1234,8 @@ void CameraDevice::requestComplete(Request *request)
|
||||||
const std::map<Stream *, FrameBuffer *> &buffers = request->buffers();
|
const std::map<Stream *, FrameBuffer *> &buffers = request->buffers();
|
||||||
camera3_buffer_status status = CAMERA3_BUFFER_STATUS_OK;
|
camera3_buffer_status status = CAMERA3_BUFFER_STATUS_OK;
|
||||||
std::unique_ptr<CameraMetadata> resultMetadata;
|
std::unique_ptr<CameraMetadata> resultMetadata;
|
||||||
|
Camera3RequestDescriptor *descriptor =
|
||||||
|
reinterpret_cast<Camera3RequestDescriptor *>(request->cookie());
|
||||||
|
|
||||||
if (request->status() != Request::RequestComplete) {
|
if (request->status() != Request::RequestComplete) {
|
||||||
LOG(HAL, Error) << "Request not successfully completed: "
|
LOG(HAL, Error) << "Request not successfully completed: "
|
||||||
|
@ -1241,9 +1243,17 @@ void CameraDevice::requestComplete(Request *request)
|
||||||
status = CAMERA3_BUFFER_STATUS_ERROR;
|
status = CAMERA3_BUFFER_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* \todo The timestamp used for the metadata is currently always taken
|
||||||
|
* from the first buffer (which may be the first stream) in the Request.
|
||||||
|
* It might be appropriate to return a 'correct' (as determined by
|
||||||
|
* pipeline handlers) timestamp in the Request itself.
|
||||||
|
*/
|
||||||
|
FrameBuffer *buffer = buffers.begin()->second;
|
||||||
|
resultMetadata = getResultMetadata(descriptor->frameNumber,
|
||||||
|
buffer->metadata().timestamp);
|
||||||
|
|
||||||
/* Prepare to call back the Android camera stack. */
|
/* Prepare to call back the Android camera stack. */
|
||||||
Camera3RequestDescriptor *descriptor =
|
|
||||||
reinterpret_cast<Camera3RequestDescriptor *>(request->cookie());
|
|
||||||
|
|
||||||
camera3_capture_result_t captureResult = {};
|
camera3_capture_result_t captureResult = {};
|
||||||
captureResult.frame_number = descriptor->frameNumber;
|
captureResult.frame_number = descriptor->frameNumber;
|
||||||
|
@ -1256,21 +1266,12 @@ void CameraDevice::requestComplete(Request *request)
|
||||||
captureResult.output_buffers =
|
captureResult.output_buffers =
|
||||||
const_cast<const camera3_stream_buffer_t *>(descriptor->buffers);
|
const_cast<const camera3_stream_buffer_t *>(descriptor->buffers);
|
||||||
|
|
||||||
/*
|
|
||||||
* \todo The timestamp used for the metadata is currently always taken
|
|
||||||
* from the first buffer (which may be the first stream) in the Request.
|
|
||||||
* It might be appropriate to return a 'correct' (as determined by
|
|
||||||
* pipeline handlers) timestamp in the Request itself.
|
|
||||||
*/
|
|
||||||
FrameBuffer *buffer = buffers.begin()->second;
|
|
||||||
|
|
||||||
if (status == CAMERA3_BUFFER_STATUS_OK) {
|
if (status == CAMERA3_BUFFER_STATUS_OK) {
|
||||||
notifyShutter(descriptor->frameNumber,
|
notifyShutter(descriptor->frameNumber,
|
||||||
buffer->metadata().timestamp);
|
buffer->metadata().timestamp);
|
||||||
|
|
||||||
captureResult.partial_result = 1;
|
captureResult.partial_result = 1;
|
||||||
resultMetadata = getResultMetadata(descriptor->frameNumber,
|
|
||||||
buffer->metadata().timestamp);
|
|
||||||
captureResult.result = resultMetadata->get();
|
captureResult.result = resultMetadata->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue