module-rt: only call set_rlimit once

We can call this once after we know that we can use RTKit to get
the limits or not.
This commit is contained in:
Wim Taymans 2022-09-09 15:27:26 +02:00
parent 009e61f585
commit 633f9c2d5e

View file

@ -976,7 +976,6 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
if (set_nice(impl, impl->nice_level, !can_use_rtkit) < 0) if (set_nice(impl, impl->nice_level, !can_use_rtkit) < 0)
use_rtkit = can_use_rtkit; use_rtkit = can_use_rtkit;
} }
set_rlimit(impl);
#ifdef HAVE_DBUS #ifdef HAVE_DBUS
impl->use_rtkit = use_rtkit; impl->use_rtkit = use_rtkit;
@ -1007,12 +1006,12 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
goto error; goto error;
} }
} }
/* Retry set_nice and set_rlimit with rtkit */ /* Retry set_nice with rtkit */
if (IS_VALID_NICE_LEVEL(impl->nice_level)) if (IS_VALID_NICE_LEVEL(impl->nice_level))
set_nice(impl, impl->nice_level, true); set_nice(impl, impl->nice_level, true);
set_rlimit(impl);
} }
#endif #endif
set_rlimit(impl);
impl->thread_utils.iface = SPA_INTERFACE_INIT( impl->thread_utils.iface = SPA_INTERFACE_INIT(
SPA_TYPE_INTERFACE_ThreadUtils, SPA_TYPE_INTERFACE_ThreadUtils,