diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index 23dde1cfaf98..34c60556e5fa 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -1281,30 +1281,6 @@ int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Reques
 	return 0;
 }
 
-static CompressedImage mapAndroidBlobBuffer(const buffer_handle_t camera3buffer)
-{
-	CompressedImage img;
-
-	/* ANDROID_JPEG_MAX_SIZE */
-	unsigned int length = int32_t{13 << 20};
-
-	/* Take only the first plane */
-	void *memory = mmap(NULL, length, PROT_READ|PROT_WRITE, MAP_SHARED,
-			    camera3buffer->data[0], 0);
-
-	img.length = length;
-	img.data = static_cast<unsigned char*>(memory);
-
-	return img;
-}
-
-static void unmapAndroidBlobBuffer(CompressedImage *img)
-{
-	munmap(img->data, img->length);
-	img->data = nullptr;
-	img->length = 0;
-}
-
 void CameraDevice::requestComplete(Request *request)
 {
 	const std::map<Stream *, FrameBuffer *> &buffers = request->buffers();
@@ -1341,19 +1317,22 @@ void CameraDevice::requestComplete(Request *request)
 			continue;
 		}
 
-		CompressedImage output = mapAndroidBlobBuffer(*descriptor->buffers[i].buffer);
-		if (output.data == MAP_FAILED) {
-			LOG(HAL, Error) << "Failed to mmap android blob buffer of length " << output.length;
+		MappedCamera3Buffer mapped(*descriptor->buffers[i].buffer, PROT_READ|PROT_WRITE);
+		if (!mapped.isValid()) {
+			LOG(HAL, Error) << "Failed to mmap android blob buffer";
 			continue;
 		}
 
+		CompressedImage output;
+		output.data = static_cast<unsigned char *>(mapped.maps()[0].address);
+		output.length = mapped.maps()[0].length;
+
 		int ret = compressor->compress(buffer, &output);
 		if (ret) {
 			LOG(HAL, Error) << "Failed to compress stream image";
 			status = CAMERA3_BUFFER_STATUS_ERROR;
 		}
 
-		unmapAndroidBlobBuffer(&output);
 	}
 
 	/* Prepare to call back the Android camera stack. */
