1
0
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:
Tux3 / Mlkj / !Lev.uXFMLA 2015-05-16 04:00:41 +02:00 committed by tux3
parent b20ecf056d
commit b463028536
2 changed files with 4 additions and 2 deletions

View File

@ -191,6 +191,7 @@ bool VideoFrame::convertToYUV420()
void VideoFrame::releaseFrame()
{
QMutexLocker locker(&biglock);
freelistCallback = nullptr;
releaseFrameLockless();
}

View File

@ -27,7 +27,8 @@ struct vpx_image;
/// 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
/// 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
{
public:
@ -36,7 +37,7 @@ public:
VideoFrame(AVFrame* frame, int w, int h, int fmt, std::function<void()> freelistCallback);
~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
void releaseFrame();