From d5d08035913be89ad0dec99b4759ab9377bc1eea Mon Sep 17 00:00:00 2001 From: Tanu Kaskinen Date: Tue, 22 Sep 2020 14:12:37 +0300 Subject: [PATCH] main: set LC_NUMERIC to C The webrtc backend of module-echo-cancel uses sscanf() to parse floating point numbers from module arguments, which didn't work when the locale used a comma for the decimal point. Setting the LC_NUMERIC locale variable to C makes the pulseaudio process use a period as the decimal point regardless of the user's locale configuration. Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/89 --- src/daemon/main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/daemon/main.c b/src/daemon/main.c index 59f931219..c7c434288 100644 --- a/src/daemon/main.c +++ b/src/daemon/main.c @@ -480,7 +480,13 @@ int main(int argc, char *argv[]) { pa_unblock_sigs(-1); pa_reset_priority(); + /* Load locale from the environment. */ setlocale(LC_ALL, ""); + + /* Set LC_NUMERIC to C so that floating point strings are consistently + * formatted and parsed across locales. */ + setlocale(LC_NUMERIC, "C"); + pa_init_i18n(); conf = pa_daemon_conf_new();