Merge "camera: allow to get size of JPEG after conversion"
diff --git a/modules/camera/3_4/arc/image_processor.cpp b/modules/camera/3_4/arc/image_processor.cpp
index f0fee91..7fb6219 100644
--- a/modules/camera/3_4/arc/image_processor.cpp
+++ b/modules/camera/3_4/arc/image_processor.cpp
@@ -85,6 +85,8 @@
case V4L2_PIX_FMT_BGR32:
case V4L2_PIX_FMT_RGB32:
return width * height * 4;
+ case V4L2_PIX_FMT_JPEG:
+ return 0; // For JPEG real size will be calculated after conversion.
default:
LOGF(ERROR) << "Pixel format " << FormatToString(fourcc)
<< " is unsupported.";
@@ -388,6 +390,9 @@
return false;
}
size_t buffer_length = compressor.GetCompressedImageSize();
+ if (out_frame->SetDataSize(buffer_length)) {
+ return false;
+ }
memcpy(out_frame->GetData(), compressor.GetCompressedImagePtr(),
buffer_length);
return true;