1
0
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:
tux3 2015-05-10 00:35:07 +02:00
parent 67e09de085
commit 8fed00cf55
No known key found for this signature in database
GPG Key ID: 7E086DD661263264

View File

@ -173,6 +173,8 @@ void CameraWorker::unsubscribe()
if (--refCount <= 0)
{
cam.release();
frame = cv::Mat3b();
queue.clear();
refCount = 0;
}
}
@ -201,7 +203,7 @@ void CameraWorker::doWork()
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});
}