From 51d85423d5f5dc967c97e18f10f89a45342787c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juho=20H=C3=A4m=C3=A4l=C3=A4inen?= Date: Thu, 24 Feb 2022 08:44:50 +0200 Subject: [PATCH] common: Force mono 16kHz with AUDIO_OUTPUT_FLAG_VOIP_RX. --- src/common/droid-util.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/common/droid-util.c b/src/common/droid-util.c index a352778..094e7ed 100644 --- a/src/common/droid-util.c +++ b/src/common/droid-util.c @@ -107,7 +107,7 @@ struct user_options { #define DEFAULT_PRIORITY (100) #define DEFAULT_AUDIO_FORMAT (AUDIO_FORMAT_PCM_16_BIT) - +#define DROID_VOIP_RX_SAMPLE_RATE (16000) #ifndef AUDIO_PARAMETER_VALUE_ON #define AUDIO_PARAMETER_VALUE_ON "on" @@ -1344,6 +1344,13 @@ static bool stream_config_fill(pa_droid_hw_module *hw, sample_spec->rate = 16000; } + if (output && mix_port->flags & AUDIO_OUTPUT_FLAG_VOIP_RX) { + pa_log_info("Override voip_rx channel map (mono) and sample rate (%d)", DROID_VOIP_RX_SAMPLE_RATE); + pa_channel_map_init_mono(channel_map); + sample_spec->channels = channel_map->channels; + sample_spec->rate = DROID_VOIP_RX_SAMPLE_RATE; + } + if (!compatible_port(mix_port, sample_spec, channel_map, NULL, &compatible_sample_spec, &compatible_channel_map, &hal_channel_mask)) { pa_log("Couldn't find compatible configuration for mix port \"%s\"", mix_port->name);