Prepare and cache desktop video codecs once at application startup
This commit is contained in:
1 parent
0cd1955606
commit
e3b74de7ef
3 files changed
+53
-5
No files matched your search
@@ -19,11 +19,13 @@
|
||||
#include <QVBoxLayout>
|
||||
#include "gui_language.h"
|
||||
#include "call_camera_capture.h"
|
||||
#include "call_video_engine.h"
|
||||
#include "single_instance.h"
|
||||
#include "config_parser.h"
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <cerrno>
|
||||
#include <future>
|
||||
#ifdef _WIN32
|
||||
#include <QStandardPaths>
|
||||
#include <windows.h>
|
||||
@@ -342,6 +344,14 @@ int main(int argc, char *argv[]) {
|
||||
cfg.debugLevel(), cfg.debugCategories());
|
||||
instance.setWindow(&w);
|
||||
if (minimized) w.showMinimized(); else w.show();
|
||||
// Пробы не используют камеры и сеть; будущие звонки берут общий кэш без повторной подготовки.
|
||||
std::atomic<bool> prepareVideo{true};
|
||||
std::future<void> videoPreparation;
|
||||
try {
|
||||
videoPreparation = std::async(std::launch::async, [&prepareVideo] { CallVideoEngine::capabilities(&prepareVideo); });
|
||||
} catch (const std::exception& error) {
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_CALL, "video codec background preparation could not start: %s", error.what());
|
||||
}
|
||||
DEBUG_INFO(DEBUG_CATEGORY_GENERAL, "GUI startup: minimized_requested=%d minimized=%d activation_server=%s",
|
||||
minimized, w.isMinimized(), qPrintable(instance.serverName()));
|
||||
|
||||
@@ -352,6 +362,11 @@ int main(int argc, char *argv[]) {
|
||||
#endif
|
||||
|
||||
int ret = app.exec();
|
||||
prepareVideo = false;
|
||||
if (videoPreparation.valid()) {
|
||||
try { videoPreparation.get(); }
|
||||
catch (const std::exception& error) { DEBUG_ERROR(DEBUG_CATEGORY_CALL, "video codec background preparation failed: %s", error.what()); }
|
||||
}
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_GENERAL, "main: app.exec() returned %d", ret);
|
||||
return ret;
|
||||
}
|
||||
Reference in new issue
Block a user