Camera: Keep a list of outstanding buffers
Keep a list of outstanding buffers in Camera3Stream so that
it won't return invalid buffers or the same buffers twice back
to the buffer queue.
Bug: 27894484
Change-Id: I9f96629b4f531778433c2e1ec32a142f2040832b
diff --git a/services/camera/libcameraservice/device3/Camera3Stream.h b/services/camera/libcameraservice/device3/Camera3Stream.h
index c932e253..810383d 100644
--- a/services/camera/libcameraservice/device3/Camera3Stream.h
+++ b/services/camera/libcameraservice/device3/Camera3Stream.h
@@ -457,6 +457,12 @@
status_t cancelPrepareLocked();
+ // Return whether the buffer is in the list of outstanding buffers.
+ bool isOutstandingBuffer(const camera3_stream_buffer& buffer);
+
+ // Remove the buffer from the list of outstanding buffers.
+ void removeOutstandingBuffer(const camera3_stream_buffer& buffer);
+
// Tracking for PREPARING state
// State of buffer preallocation. Only true if either prepareNextBuffer
@@ -470,6 +476,9 @@
// Number of buffers allocated on last prepare call.
size_t mLastMaxCount;
+ // Outstanding buffers dequeued from the stream's buffer queue.
+ List<buffer_handle_t> mOutstandingBuffers;
+
}; // class Camera3Stream
}; // namespace camera3