Skip to content

Commit

Permalink
tracker: trying to reduce the amount of work done by the main thread
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmm committed Oct 15, 2024
1 parent 6c03346 commit b34f995
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions src/tracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,27 +68,31 @@ Backend::Backend(QObject* parent)
std::lock_guard<std::mutex> trackers_lock_guard(trackers_mutex);

if (!pause_preview && !exiting) {
QMetaObject::invokeMethod(
this,
[this, frame] {
input_video_frame = frame;
process_frame();
},
Qt::QueuedConnection);
// QMetaObject::invokeMethod(
// this,
// [this, frame] {
// input_video_frame = frame;
// process_frame();
// },
// Qt::QueuedConnection);
input_video_frame = frame;
process_frame();
}
});

connect(media_player_video_sink.get(), &QVideoSink::videoFrameChanged, [this](const QVideoFrame& frame) {
std::lock_guard<std::mutex> trackers_lock_guard(trackers_mutex);

if (!pause_preview && !exiting) {
QMetaObject::invokeMethod(
this,
[this, frame] {
input_video_frame = frame;
process_frame();
},
Qt::QueuedConnection);
// QMetaObject::invokeMethod(
// this,
// [this, frame] {
// input_video_frame = frame;
// process_frame();
// },
// Qt::QueuedConnection);
input_video_frame = frame;
process_frame();
}
});

Expand Down

0 comments on commit b34f995

Please sign in to comment.