Fix a recording performance issue

This is why dev is a thing
This commit is contained in:
ArsenArsen 2017-07-20 14:18:28 +02:00
parent afbe278155
commit 9ef6aa562a
1 changed files with 4 additions and 2 deletions

View File

@ -58,13 +58,15 @@ bool Worker::ended() {
void Worker::process() { void Worker::process() {
while (!ended()) { while (!ended()) {
QMutexLocker ml(&lock); lock.lock();
if (!qqueue.isEmpty()) { if (!qqueue.isEmpty()) {
_WorkerContext *c = qqueue.dequeue(); _WorkerContext *c = qqueue.dequeue();
lock.unlock();
c->consumer(c->image.convertToFormat(c->targetFormat)); c->consumer(c->image.convertToFormat(c->targetFormat));
delete c->underlyingThing; delete c->underlyingThing;
delete c; delete c;
} } else
lock.unlock();
std::this_thread::sleep_for(std::chrono::milliseconds(10)); // STL likes it's scopes std::this_thread::sleep_for(std::chrono::milliseconds(10)); // STL likes it's scopes
} }
emit finished(); emit finished();