android: jpeg: Use CameraBuffer::jpegBufferSize()

Use the newly introduced function to retrieve the size of
the JPEG encoding destination buffer, in order to calculate where
the JPEG_BLOB_ID should be placed.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
Jacopo Mondi 2021-03-02 14:34:27 +01:00
parent 1223da76a2
commit 00fec7d5ed

View file

@ -183,7 +183,7 @@ int PostProcessorJpeg::process(const FrameBuffer &source,
/* Fill in the JPEG blob header. */ /* Fill in the JPEG blob header. */
uint8_t *resultPtr = destination->plane(0).data() uint8_t *resultPtr = destination->plane(0).data()
+ destination->plane(0).size() + destination->jpegBufferSize(cameraDevice_->maxJpegBufferSize())
- sizeof(struct camera3_jpeg_blob); - sizeof(struct camera3_jpeg_blob);
auto *blob = reinterpret_cast<struct camera3_jpeg_blob *>(resultPtr); auto *blob = reinterpret_cast<struct camera3_jpeg_blob *>(resultPtr);
blob->jpeg_blob_id = CAMERA3_JPEG_BLOB_ID; blob->jpeg_blob_id = CAMERA3_JPEG_BLOB_ID;