mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Avoid unecessary copying of video frames
And release some more data when possible
This commit is contained in:
parent
67e09de085
commit
8fed00cf55
|
@ -173,6 +173,8 @@ void CameraWorker::unsubscribe()
|
||||||
if (--refCount <= 0)
|
if (--refCount <= 0)
|
||||||
{
|
{
|
||||||
cam.release();
|
cam.release();
|
||||||
|
frame = cv::Mat3b();
|
||||||
|
queue.clear();
|
||||||
refCount = 0;
|
refCount = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -201,7 +203,7 @@ void CameraWorker::doWork()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray frameData(reinterpret_cast<char*>(frame.data), frame.total() * frame.channels());
|
QByteArray frameData = QByteArray::fromRawData(reinterpret_cast<char*>(frame.data), frame.total() * frame.channels());
|
||||||
|
|
||||||
emit newFrameAvailable(VideoFrame{frameData, QSize(frame.cols, frame.rows), VideoFrame::BGR});
|
emit newFrameAvailable(VideoFrame{frameData, QSize(frame.cols, frame.rows), VideoFrame::BGR});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user