module-rt: fall back to some defaults in case of error

This commit is contained in:
Wim Taymans 2023-07-20 15:57:31 +02:00
parent 7b24b3b687
commit 163fde0a69

View file

@ -968,12 +968,21 @@ static int do_rtkit_setup(struct spa_loop *loop, bool async, uint32_t seq,
} }
} }
/* get some properties */ /* get some properties */
if (rtkit_get_int_property(impl, "MaxRealtimePriority", &retval) >= 0) if (rtkit_get_int_property(impl, "MaxRealtimePriority", &retval) < 0) {
impl->max_rtprio = retval; retval = 1;
if (rtkit_get_int_property(impl, "MinNiceLevel", &retval) >= 0) pw_log_warn("RTKit does not give us MaxRealtimePriority, using %lld", retval);
impl->min_nice_level = retval; }
if (rtkit_get_int_property(impl, "RTTimeUSecMax", &retval) >= 0) impl->max_rtprio = retval;
impl->rttime_max = retval; if (rtkit_get_int_property(impl, "MinNiceLevel", &retval) < 0) {
retval = 0;
pw_log_warn("RTKit does not give us MinNiceLevel, using %lld", retval);
}
impl->min_nice_level = retval;
if (rtkit_get_int_property(impl, "RTTimeUSecMax", &retval) < 0) {
retval = impl->rl.rlim_cur;
pw_log_warn("RTKit does not give us RTTimeUSecMax, using %lld", retval);
}
impl->rttime_max = retval;
/* Retry set_nice with rtkit */ /* Retry set_nice with rtkit */
if (IS_VALID_NICE_LEVEL(impl->nice_level)) if (IS_VALID_NICE_LEVEL(impl->nice_level))