[libcamera-devel,v4,4/7] libcamera: V4L2BufferCache: Use the entry reference

Message ID 20200305203808.536050-5-niklas.soderlund@ragnatech.se
State Accepted
Headers show
Series
  • libcamera: V4L2BufferCache: Improve cache eviction strategy
Related show

Commit Message

Niklas Söderlund March 5, 2020, 8:38 p.m. UTC
Instead of looking up the index in the storage vector use the reference
to it created at the beginning of the loop.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/libcamera/v4l2_videodevice.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp
index d88cb0bd0771e545..268de60bc7965f58 100644
--- a/src/libcamera/v4l2_videodevice.cpp
+++ b/src/libcamera/v4l2_videodevice.cpp
@@ -216,7 +216,7 @@  int V4L2BufferCache::get(const FrameBuffer &buffer)
 			use = index;
 
 		/* Try to find a cache hit by comparing the planes. */
-		if (cache_[index] == buffer) {
+		if (entry == buffer) {
 			hit = true;
 			use = index;
 			break;