mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Released frames are out of the freelist
So they shouldn't call the freelistCallback. VideoFrame now forgets about the callback when it is being released.
This commit is contained in:
parent
b20ecf056d
commit
b463028536
|
@ -191,6 +191,7 @@ bool VideoFrame::convertToYUV420()
|
||||||
void VideoFrame::releaseFrame()
|
void VideoFrame::releaseFrame()
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&biglock);
|
QMutexLocker locker(&biglock);
|
||||||
|
freelistCallback = nullptr;
|
||||||
releaseFrameLockless();
|
releaseFrameLockless();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,8 @@ struct vpx_image;
|
||||||
/// Ownership of all video frame buffers is kept by the VideoFrame, even after conversion
|
/// Ownership of all video frame buffers is kept by the VideoFrame, even after conversion
|
||||||
/// All references to the frame data become invalid when the VideoFrame is deleted
|
/// All references to the frame data become invalid when the VideoFrame is deleted
|
||||||
/// We try to avoid pixel format conversions as much as possible, at the cost of some memory
|
/// We try to avoid pixel format conversions as much as possible, at the cost of some memory
|
||||||
/// All methods are thread-safe. If provided freelistCallback will be called by the destructor.
|
/// All methods are thread-safe. If provided freelistCallback will be called by the destructor,
|
||||||
|
/// unless releaseFrame was called in between.
|
||||||
class VideoFrame
|
class VideoFrame
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -36,7 +37,7 @@ public:
|
||||||
VideoFrame(AVFrame* frame, int w, int h, int fmt, std::function<void()> freelistCallback);
|
VideoFrame(AVFrame* frame, int w, int h, int fmt, std::function<void()> freelistCallback);
|
||||||
~VideoFrame();
|
~VideoFrame();
|
||||||
|
|
||||||
/// Frees all internal buffers and frame data
|
/// Frees all internal buffers and frame data, removes the freelistCallback
|
||||||
/// This makes all converted objects that shares our internal buffers invalid
|
/// This makes all converted objects that shares our internal buffers invalid
|
||||||
void releaseFrame();
|
void releaseFrame();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user