GstEnginePipeline: Increase thread priority
This commit is contained in:
parent
8e4b4d6e41
commit
54c42b276f
|
@ -102,12 +102,12 @@ endif()
|
|||
option(USE_ICU "Use ICU" ON)
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
find_package(Boost REQUIRED)
|
||||
find_package(Threads)
|
||||
find_package(Threads REQUIRED)
|
||||
find_package(Backtrace)
|
||||
if(Backtrace_FOUND)
|
||||
set(HAVE_BACKTRACE ON)
|
||||
endif()
|
||||
find_package(Boost REQUIRED)
|
||||
if(USE_ICU)
|
||||
find_package(ICU COMPONENTS uc i18n REQUIRED)
|
||||
if(ICU_FOUND)
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <cmath>
|
||||
|
@ -30,7 +32,13 @@
|
|||
#include <gst/gst.h>
|
||||
#include <gst/audio/audio.h>
|
||||
|
||||
#include <QtGlobal>
|
||||
#ifdef Q_OS_UNIX
|
||||
# include <pthread.h>
|
||||
#endif
|
||||
#ifdef Q_OS_WIN32
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <QObject>
|
||||
#include <QCoreApplication>
|
||||
#include <QtConcurrent>
|
||||
|
@ -1288,16 +1296,17 @@ void GstEnginePipeline::TaskEnterCallback(GstTask *task, GThread *thread, gpoint
|
|||
Q_UNUSED(thread)
|
||||
Q_UNUSED(self)
|
||||
|
||||
// Bump the priority of the thread only on macOS
|
||||
|
||||
#ifdef Q_OS_MACOS
|
||||
sched_param param;
|
||||
#ifdef Q_OS_UNIX
|
||||
sched_param param{};
|
||||
memset(¶m, 0, sizeof(param));
|
||||
|
||||
param.sched_priority = 99;
|
||||
param.sched_priority = 40;
|
||||
pthread_setschedparam(pthread_self(), SCHED_RR, ¶m);
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void GstEnginePipeline::ElementMessageReceived(GstMessage *msg) {
|
||||
|
|
Loading…
Reference in New Issue