From 00fec7d5edaf190429654191a651a180b02d56f9 Mon Sep 17 00:00:00 2001
From: Jacopo Mondi <jacopo@jmondi.org>
Date: Tue, 2 Mar 2021 14:34:27 +0100
Subject: 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>
---
 src/android/jpeg/post_processor_jpeg.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src/android/jpeg')

diff --git a/src/android/jpeg/post_processor_jpeg.cpp b/src/android/jpeg/post_processor_jpeg.cpp
index 83244ce6..3bf16996 100644
--- a/src/android/jpeg/post_processor_jpeg.cpp
+++ b/src/android/jpeg/post_processor_jpeg.cpp
@@ -183,7 +183,7 @@ int PostProcessorJpeg::process(const FrameBuffer &source,
 
 	/* Fill in the JPEG blob header. */
 	uint8_t *resultPtr = destination->plane(0).data()
-			   + destination->plane(0).size()
+			   + destination->jpegBufferSize(cameraDevice_->maxJpegBufferSize())
 			   - sizeof(struct camera3_jpeg_blob);
 	auto *blob = reinterpret_cast<struct camera3_jpeg_blob *>(resultPtr);
 	blob->jpeg_blob_id = CAMERA3_JPEG_BLOB_ID;
-- 
cgit v1.2.1