[common] Fix output channel conversion. JB#39594
AUDIO_DEVICE_IN_ALL contains AUDIO_DEVICE_BIT_DEFAULT, like AUDIO_DEVICE_OUT_ALL, which meant that config was always filled with input channels, even when device was output device. Fix the logic so that correct channel mask is generated for output device as well.
This commit is contained in:
parent
f0e679dbc1
commit
887177a194
1 changed files with 19 additions and 18 deletions
|
|
@ -1934,13 +1934,19 @@ static bool stream_config_fill(audio_devices_t devices,
|
|||
audio_format_t hal_audio_format = 0;
|
||||
audio_channel_mask_t hal_channel_mask = 0;
|
||||
bool voicecall_record = false;
|
||||
bool output = true;
|
||||
|
||||
pa_assert(sample_spec);
|
||||
pa_assert(channel_map);
|
||||
pa_assert(config);
|
||||
|
||||
#if AUDIO_API_VERSION_MAJ >= 2
|
||||
devices &= ~AUDIO_DEVICE_BIT_IN;
|
||||
if (devices & AUDIO_DEVICE_BIT_IN) {
|
||||
output = false;
|
||||
devices &= ~AUDIO_DEVICE_BIT_IN;
|
||||
}
|
||||
#else
|
||||
output = !(devices & AUDIO_DEVICE_IN_ALL);
|
||||
#endif
|
||||
|
||||
if (devices & AUDIO_DEVICE_IN_VOICE_CALL)
|
||||
|
|
@ -1951,24 +1957,19 @@ static bool stream_config_fill(audio_devices_t devices,
|
|||
goto fail;
|
||||
}
|
||||
|
||||
if (devices & AUDIO_DEVICE_IN_ALL) {
|
||||
for (int i = 0; i < channel_map->channels; i++) {
|
||||
audio_channel_mask_t c;
|
||||
if (!pa_convert_input_channel(channel_map->map[i], CONV_FROM_PA, &c)) {
|
||||
pa_log("Failed to convert channel map.");
|
||||
goto fail;
|
||||
}
|
||||
hal_channel_mask |= c;
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < channel_map->channels; i++) {
|
||||
audio_channel_mask_t c;
|
||||
if (!pa_convert_output_channel(channel_map->map[i], CONV_FROM_PA, &c)) {
|
||||
pa_log("Failed to convert channel map.");
|
||||
goto fail;
|
||||
}
|
||||
hal_channel_mask |= c;
|
||||
for (int i = 0; i < channel_map->channels; i++) {
|
||||
bool found;
|
||||
audio_channel_mask_t c;
|
||||
|
||||
found = output ? pa_convert_output_channel(channel_map->map[i], CONV_FROM_PA, &c)
|
||||
: pa_convert_input_channel(channel_map->map[i], CONV_FROM_PA, &c);
|
||||
|
||||
if (!found) {
|
||||
pa_log("Failed to convert %s channel map.", output ? "output" : "input");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
hal_channel_mask |= c;
|
||||
}
|
||||
|
||||
if (voicecall_record) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue