audioconvert: Consider channel=1, channel-mask=0x0 as mono

channels=1 is always mono, having it 'unpositioned' does not make
sense.

This fixes pipeline such as:

  gst-validate-1.0 audiotestsrc ! audio/x-raw,channels=2,rate=44100,layout=interleaved ! audioconvert ! audioresample ! audio/x-raw, rate=44100, channels=1 ! avenc_mp2 ! fakesink

https://bugzilla.gnome.org/show_bug.cgi?id=785407
This commit is contained in:
Thibault Saunier 2017-07-25 12:37:19 -04:00
parent 01f4d6494a
commit ffd4c990c1

View file

@ -244,7 +244,7 @@ static GstCaps *
gst_audio_convert_caps_remove_format_info (GstCaps * caps, gboolean channels)
{
GstStructure *st;
gint i, n;
gint i, n, n_channels;
GstCaps *res;
guint64 channel_mask;
@ -267,7 +267,9 @@ gst_audio_convert_caps_remove_format_info (GstCaps * caps, gboolean channels)
/* Only remove the channels and channel-mask for non-NONE layouts */
if (gst_structure_get (st, "channel-mask", GST_TYPE_BITMASK, &channel_mask,
NULL)) {
if (channel_mask != 0)
if (channel_mask != 0
|| (gst_structure_get_int (st, "channels", &n_channels)
&& (n_channels == 1)))
remove_channels = TRUE;
} else {
remove_channels = TRUE;