Set realtime priorities if available

This significantly reduces the latency with no real drawbacks from what
I've noticed. Wineserver is still run using the normal scheduling
policies because from my testing running that with realtime priority
that can actually increase latencies, although doing so will greatly
reduce the variance in processing time.
This commit is contained in:
Robbert van der Helm
2020-07-23 19:55:22 +02:00
parent 9d33b9989e
commit 6f5dae90a6
9 changed files with 83 additions and 4 deletions
+5 -1
View File
@@ -16,12 +16,13 @@
#include "plugin-bridge.h"
// Generated inside of build directory
// Generated inside of the build directory
#include <src/common/config/config.h>
#include <src/common/config/version.h>
#include "../common/communication.h"
#include "../common/events.h"
#include "../common/utils.h"
#include "utils.h"
namespace bp = boost::process;
@@ -78,6 +79,7 @@ PluginBridge::PluginBridge(audioMasterCallback host_callback)
logger,
vst_plugin_path,
socket_endpoint.path()))),
has_realtime_priority(set_realtime_priority()),
wine_io_handler([&]() { io_context.run(); }) {
log_init_message();
@@ -598,6 +600,8 @@ void PluginBridge::log_init_message() {
<< std::endl;
init_msg << "plugin: '" << vst_plugin_path.string() << "'"
<< std::endl;
init_msg << "realtime: '" << (has_realtime_priority ? "yes" : "no")
<< "'" << std::endl;
init_msg << "socket: '" << socket_endpoint.path() << "'" << std::endl;
init_msg << "wine prefix: '";
+8
View File
@@ -183,6 +183,14 @@ class PluginBridge {
* @see launch_vst_host
*/
std::unique_ptr<HostProcess> vst_host;
/**
* Whether this process runs with realtime priority. We'll set this _after_
* spawning the Wine process because from my testing running wineserver with
* realtime priority can actually increase latency.
*/
bool has_realtime_priority;
/**
* Runs the Boost.Asio `io_context` thread for logging the Wine process
* STDOUT and STDERR messages.
+1 -1
View File
@@ -25,7 +25,7 @@
#include <random>
#include <sstream>
// Generated inside of build directory
// Generated inside of the build directory
#include <src/common/config/config.h>
#include "../common/configuration.h"