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
This commit is contained in:
Tanu Kaskinen 2020-09-22 14:12:37 +03:00 committed by Arun Raghavan
parent 757eb26448
commit d5d0803591

View file

@ -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();