diff --git a/src/pulsecore/resampler.c b/src/pulsecore/resampler.c index d42cbc298..6a4ded690 100644 --- a/src/pulsecore/resampler.c +++ b/src/pulsecore/resampler.c @@ -914,6 +914,8 @@ static void setup_remap(const pa_resampler *r, pa_remap_t *m, bool *lfe_remixed) * The algorithm works basically like this: * * 1) Connect all channels with matching names. + * This also includes fixing confusion between "5.1" and + * "5.1 (Side)" layouts, done by mpv. * * 2) Mono Handling: * S:Mono: See setup_oc_mono_map(). @@ -1006,6 +1008,26 @@ static void setup_remap(const pa_resampler *r, pa_remap_t *m, bool *lfe_remixed) } } + if (!oc_connected) { + /* Maybe it is due to 5.1 rear/side confustion? */ + for (ic = 0; ic < n_ic; ic++) { + pa_channel_position_t a = r->i_cm.map[ic]; + if (ic_connected[ic]) + continue; + + if ((a == PA_CHANNEL_POSITION_REAR_LEFT && b == PA_CHANNEL_POSITION_SIDE_LEFT) || + (a == PA_CHANNEL_POSITION_SIDE_LEFT && b == PA_CHANNEL_POSITION_REAR_LEFT) || + (a == PA_CHANNEL_POSITION_REAR_RIGHT && b == PA_CHANNEL_POSITION_SIDE_RIGHT) || + (a == PA_CHANNEL_POSITION_SIDE_RIGHT && b == PA_CHANNEL_POSITION_REAR_RIGHT)) { + + m->map_table_f[oc][ic] = 1.0f; + + oc_connected = true; + ic_connected[ic] = true; + } + } + } + if (!oc_connected) { /* Try to find matching input ports for this output port */