The only way for ALSA to expose a position-less multi channels is to
return an array full of SND_CHMAP_MONO. Converting this to a
GST_AUDIO_CHANNEL_POSITION_MONO array would be invalid as
GST_AUDIO_CHANNEL_POSITION_MONO is meant to be used only with one
channel.
Fix this by using GST_AUDIO_CHANNEL_POSITION_NONE which is meant to be
used for position-less channels.
https://bugzilla.gnome.org/show_bug.cgi?id=763799
GstAudioChannelPosition * pos)
{
int c;
+ gboolean all_mono = TRUE;
for (c = 0; c < chmap->channels; c++) {
if (chmap->pos[c] > SND_CHMAP_LAST)
if (!pos[c])
return FALSE;
pos[c]--;
+
+ if (pos[c] != GST_AUDIO_CHANNEL_POSITION_MONO)
+ all_mono = FALSE;
+ }
+
+ if (all_mono && chmap->channels > 1) {
+ /* GST_AUDIO_CHANNEL_POSITION_MONO can only be used with 1 channel and
+ * GST_AUDIO_CHANNEL_POSITION_NONE is meant to be used for position-less
+ * multi channels.
+ * Converting as ALSA can only express such configuration by using an array
+ * full of SND_CHMAP_MONO.
+ */
+ for (c = 0; c < chmap->channels; c++)
+ pos[c] = GST_AUDIO_CHANNEL_POSITION_NONE;
}
+
return TRUE;
}