@@ -19,6 +19,8 @@
namespace libcamera {
+class Stream;
+
class FrameBuffer::Private : public Extensible::Private
{
LIBCAMERA_DECLARE_PUBLIC(FrameBuffer)
@@ -39,6 +41,8 @@ public:
FrameMetadata &metadata() { return metadata_; }
+ const Stream *stream_ = nullptr;
+
private:
std::vector<Plane> planes_;
FrameMetadata metadata_;
@@ -232,6 +232,14 @@ FrameBuffer::Private::~Private()
* \brief Retrieve the dynamic metadata
* \return Dynamic metadata for the frame contained in the buffer
*/
+
+/**
+ * \var FrameBuffer::Private::stream_
+ * \brief The Stream the buffer belongs to
+ *
+ * This member designates the Stream of the Camera that the buffer belongs
+ * to at the moment.
+ */
#endif /* __DOXYGEN_PUBLIC__ */
/**
@@ -107,10 +107,13 @@ bool Request::Private::completeBuffer(FrameBuffer *buffer)
Request *request = LIBCAMERA_O_PTR();
camera_->bufferCompleted.emit(request, buffer);
+ ASSERT(request->findBuffer(buffer->_d()->stream_) == buffer);
+
int ret = pending_.erase(buffer);
ASSERT(ret == 1);
buffer->_d()->setRequest(nullptr);
+ buffer->_d()->stream_ = nullptr;
if (buffer->metadata().status == FrameMetadata::FrameCancelled)
cancelled_ = true;
@@ -147,6 +150,7 @@ void Request::Private::doCancelRequest()
buffer->_d()->cancel();
camera_->bufferCompleted.emit(request, buffer);
buffer->_d()->setRequest(nullptr);
+ buffer->_d()->stream_ = nullptr;
}
cancelled_ = true;
@@ -495,6 +499,7 @@ int Request::addBuffer(const Stream *stream, FrameBuffer *buffer,
}
buffer->_d()->setRequest(this);
+ buffer->_d()->stream_ = stream;
_d()->pending_.insert(buffer);
if (fence && fence->isValid())
Store the Stream of the Camera that will capture data into the buffer. Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> --- include/libcamera/internal/framebuffer.h | 4 ++++ src/libcamera/framebuffer.cpp | 8 ++++++++ src/libcamera/request.cpp | 5 +++++ 3 files changed, 17 insertions(+)