Skip to content

Commit 6afd8ec

Browse files
committed
Don't load camera on the main thread. Preload them.
1 parent 34b7b27 commit 6afd8ec

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

SerialPrograms/Source/CommonFramework/Main.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#include "Common/Cpp/Concurrency/AsyncTask.h"
88
#include "Common/Cpp/Exceptions.h"
99
#include "Common/Cpp/ImageResolution.h"
10+
#include "Globals.h"
11+
#include "GlobalSettingsPanel.h"
1012
#include "PersistentSettings.h"
1113
#include "Tests/CommandLineTests.h"
1214
#include "ErrorReports/ProgramDumper.h"
@@ -18,11 +20,10 @@
1820
#include "Logging/Logger.h"
1921
#include "Logging/OutputRedirector.h"
2022
//#include "Tools/StatsDatabase.h"
21-
#include "Globals.h"
22-
#include "GlobalSettingsPanel.h"
2323
//#include "Windows/DpiScaler.h"
2424
#include "Startup/SetupSettings.h"
2525
#include "Startup/NewVersionCheck.h"
26+
#include "CommonFramework/VideoPipeline/Backends/CameraImplementations.h"
2627
#include "CommonTools/OCR/OCR_RawOCR.h"
2728
#include "Windows/MainWindow.h"
2829

@@ -73,6 +74,9 @@ int main(int argc, char *argv[]){
7374
OutputRedirector redirect_stdout(std::cout, "stdout", Color());
7475
OutputRedirector redirect_stderr(std::cerr, "stderr", COLOR_RED);
7576

77+
// Preload all the cameras now so we don't hang the UI later on.
78+
get_all_cameras();
79+
7680
QDir().mkpath(QString::fromStdString(SETTINGS_PATH()));
7781
QDir().mkpath(QString::fromStdString(SCREENSHOTS_PATH()));
7882

SerialPrograms/Source/CommonFramework/VideoPipeline/Backends/MediaServicesQt6.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ GlobalMediaServices::~GlobalMediaServices(){
2626
GlobalMediaServices::GlobalMediaServices()
2727
: m_refresh_cameras(true)
2828
{
29-
refresh_cameras();
29+
// refresh_cameras();
3030

3131
m_media_devices.connect(
3232
&m_media_devices, &QMediaDevices::videoInputsChanged,

0 commit comments

Comments
 (0)