summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTanu Kaskinen <tanuk@iki.fi>2020-09-22 14:12:37 +0300
committerArun Raghavan <arun@arunraghavan.net>2020-11-23 21:37:57 +0000
commitd5d08035913be89ad0dec99b4759ab9377bc1eea (patch)
tree81d745689af0033d923646ceb8572f7ec2dc58b9
parent757eb264485b11ca9163a260d8772c59ac3108a1 (diff)
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
-rw-r--r--src/daemon/main.c6
1 files changed, 6 insertions, 0 deletions
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();