I made a small patch, added "rtio_priority" config option into mpd.conf, so my friend can play with this option.
Code: Select all
diff --git a/src/config/ConfigDefaults.hxx b/src/config/ConfigDefaults.hxx
index 09380f4..4c0e491 100644
--- a/src/config/ConfigDefaults.hxx
+++ b/src/config/ConfigDefaults.hxx
@@ -22,5 +22,6 @@
static constexpr unsigned DEFAULT_PLAYLIST_MAX_LENGTH = 16 * 1024;
static constexpr bool DEFAULT_PLAYLIST_SAVE_ABSOLUTE_PATHS = false;
+static constexpr unsigned DEFAULT_RTIO_PRIORITY = 50;
#endif
diff --git a/src/config/ConfigOption.hxx b/src/config/ConfigOption.hxx
index 6979095..ce25417 100644
--- a/src/config/ConfigOption.hxx
+++ b/src/config/ConfigOption.hxx
@@ -78,6 +78,7 @@ enum class ConfigOption {
DESPOTIFY_USER,
DESPOTIFY_PASSWORD,
DESPOTIFY_HIGH_BITRATE,
+ RTIO_PRIORITY,
MAX
};
diff --git a/src/config/ConfigTemplates.cxx b/src/config/ConfigTemplates.cxx
index 683e30c..9c382dc 100644
--- a/src/config/ConfigTemplates.cxx
+++ b/src/config/ConfigTemplates.cxx
@@ -73,6 +73,7 @@ const ConfigTemplate config_param_templates[] = {
{ "despotify_user", false, true },
{ "despotify_password", false, true },
{ "despotify_high_bitrate", false, true },
+ { "rtio_priority" },
};
static constexpr unsigned n_config_param_templates =
diff --git a/src/thread/Util.cxx b/src/thread/Util.cxx
index 5b61b62..a4336a5 100644
--- a/src/thread/Util.cxx
+++ b/src/thread/Util.cxx
@@ -29,6 +29,13 @@
#include "Util.hxx"
#include "system/Error.hxx"
+#include "config.h"
+#include "config/ConfigGlobal.hxx"
+#include "config/Param.hxx"
+#include "config/ConfigDefaults.hxx"
+#include "config/ConfigOption.hxx"
+#include "config/ConfigError.hxx"
+
#ifdef __linux__
#include <sched.h>
@@ -101,7 +108,11 @@ SetThreadRealtime()
{
#ifdef __linux__
struct sched_param sched_param;
- sched_param.sched_priority = 50;
+ sched_param.sched_priority = config_get_unsigned(ConfigOption::RTIO_PRIORITY, DEFAULT_RTIO_PRIORITY);
+ if ( sched_param.sched_priority > 99 )
+ sched_param.sched_priority = 99;
+ if (sched_param.sched_priority < 1 )
+ sched_param.sched_priority = DEFAULT_RTIO_PRIORITY;
int policy = SCHED_FIFO;
#ifdef SCHED_RESET_ON_FORK