diff --git a/gst/interleave/interleave.c b/gst/interleave/interleave.c index cbfff2832a..76b7945bd9 100644 --- a/gst/interleave/interleave.c +++ b/gst/interleave/interleave.c @@ -308,20 +308,22 @@ gst_interleave_channel_positions_to_mask (GValueArray * positions, static void gst_interleave_set_channel_positions (GstInterleave * self, GstStructure * s) { - guint64 channel_mask = 0; - if (self->channels <= 64 && self->channel_positions != NULL && self->channels == self->channel_positions->n_values) { if (!gst_interleave_channel_positions_to_mask (self->channel_positions, - self->default_channels_ordering_map, &channel_mask)) { + self->default_channels_ordering_map, &self->channel_mask)) { GST_WARNING_OBJECT (self, "Invalid channel positions, using NONE"); - channel_mask = 0; + self->channel_mask = 0; + } + } else { + self->channel_mask = 0; + if (self->channels <= 64) { + GST_WARNING_OBJECT (self, "Using NONE channel positions"); } - } else if (self->channels <= 64) { - GST_WARNING_OBJECT (self, "Using NONE channel positions"); } - gst_structure_set (s, "channel-mask", GST_TYPE_BITMASK, channel_mask, NULL); + gst_structure_set (s, "channel-mask", GST_TYPE_BITMASK, self->channel_mask, + NULL); } static void @@ -1229,7 +1231,7 @@ gst_interleave_collected (GstCollectPads * pads, GstInterleave * self) empty = FALSE; channel = GST_INTERLEAVE_PAD_CAST (cdata->pad)->channel; - if (self->channels <= 64) { + if (self->channels <= 64 && self->channel_mask) { channel = self->default_channels_ordering_map[channel]; } outdata = write_info.data + width * channel; diff --git a/gst/interleave/interleave.h b/gst/interleave/interleave.h index e69936ac93..05ebe3b70d 100644 --- a/gst/interleave/interleave.h +++ b/gst/interleave/interleave.h @@ -61,6 +61,7 @@ struct _GstInterleave gboolean channel_positions_from_input; gint default_channels_ordering_map[64]; + guint64 channel_mask; GstCaps *sinkcaps; gint configured_sinkpads_counter;