mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-21 08:56:56 -05:00
channelmix: Improve unknown channel layout handling
Clamp position to valid range. so that AUX becomes UNKNOWN. If we have one mono source channel and unknown destination, copy it to all destination channels. If we have one mono destination channel and unknown source layout, average all channels. Otherwise, pair source and dest channels. See #538
This commit is contained in:
parent
376436fc2c
commit
6b0abd2057
3 changed files with 136 additions and 40 deletions
|
|
@ -177,9 +177,20 @@ static int make_matrix(struct channelmix *mix)
|
|||
dst_mask = _MASK(FC);
|
||||
|
||||
if (src_mask == 0 || dst_mask == 0) {
|
||||
if (src_mask == _MASK(FC) && mix->src_chan == 1) {
|
||||
/* one mono src goes everywhere */
|
||||
for (i = 0; i < NUM_CHAN; i++)
|
||||
matrix[i][0]= 1.0f;
|
||||
} else if (dst_mask == _MASK(FC) && mix->dst_chan == 1) {
|
||||
/* one mono dst get average of everything */
|
||||
for (i = 0; i < NUM_CHAN; i++)
|
||||
matrix[0][i]= 1.0f / mix->src_chan;
|
||||
} else {
|
||||
/* just pair channels */
|
||||
for (i = 0; i < NUM_CHAN; i++)
|
||||
matrix[i][i]= 1.0f;
|
||||
}
|
||||
src_mask = dst_mask = ~0LU;
|
||||
for (i = 0; i < NUM_CHAN; i++)
|
||||
matrix[i][i]= 1.0f;
|
||||
goto done;
|
||||
} else {
|
||||
for (i = 0; i < NUM_CHAN; i++) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue