It's useful when the buffer pool stores QAbstractVideoBuffer
instances instead of underlying system buffers and
allows to avoid reallocation of QAbstractVideoBuffer instances.
The default implementation deletes the buffer,
so this change is source compatible.
Change-Id: I7dadd7dac529748b5eb33e5aa7c2d0578b8b1634
Reviewed-by: Lev Zelenskiy <lev.zelenskiy@nokia.com>
Reviewed-by: Jonas Rabbe <jonas.rabbe@gmail.com>
Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
delete d_ptr;
}
+/*!
+ Releases the video buffer.
+
+ QVideoFrame calls QAbstractVideoBuffer::release when the buffer is not used
+ any more and can be destroyed or returned to the buffer pool.
+
+ The default implementation deletes the buffer instance.
+*/
+void QAbstractVideoBuffer::release()
+{
+ delete this;
+}
+
/*!
Returns the type of a video buffer's handle.
QAbstractVideoBuffer(HandleType type);
virtual ~QAbstractVideoBuffer();
+ virtual void release();
HandleType handleType() const;
~QVideoFramePrivate()
{
- delete buffer;
+ if (buffer)
+ buffer->release();
}
QSize size;