[v2,2/3] libcamera: virtual: Query number of planes correctly
diff mbox series

Message ID 20241217174707.174777-2-pobrn@protonmail.com
State New
Headers show
Series
  • [v2,1/3] libcamera: virtual: Avoid some copies
Related show

Commit Message

Barnabás Pőcze Dec. 17, 2024, 5:47 p.m. UTC
`PixelFormatInfo::planes.size()` always returns 3 since `planes` is
an array, but that is not the number of planes of the pixel format.
Use the `numPlanes()` getter instead.

Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 src/libcamera/pipeline/virtual/virtual.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/virtual/virtual.cpp b/src/libcamera/pipeline/virtual/virtual.cpp
index ce0c38813..987b192c8 100644
--- a/src/libcamera/pipeline/virtual/virtual.cpp
+++ b/src/libcamera/pipeline/virtual/virtual.cpp
@@ -277,7 +277,7 @@  int PipelineHandlerVirtual::exportFrameBuffers([[maybe_unused]] Camera *camera,
 	const PixelFormatInfo &info = PixelFormatInfo::info(config.pixelFormat);
 
 	std::vector<unsigned int> planeSizes;
-	for (size_t i = 0; i < info.planes.size(); ++i)
+	for (size_t i = 0; i < info.numPlanes(); ++i)
 		planeSizes.push_back(info.planeSize(config.size, i));
 
 	return dmaBufAllocator_.exportBuffers(config.bufferCount, planeSizes, buffers);