summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
authorDouglas Bagnall <douglas@halo.gen.nz>2017-03-31 23:40:05 +1300
committerSebastian Dröge <sebastian@centricular.com>2017-03-31 14:11:56 +0300
commite83573fd8d232a0b6defe99ca4ee28c4cbef0ff8 (patch)
tree8ade9f71736144922133738f3e5e37564c57581e /gst
parent0c4eb22a7db267fb0b94d8248a6ffbed6b346f51 (diff)
audiointerleave: don't overflow channel map with >64 channels
When there are more than 64 channels, we don't want to exceed the bounds of the ordering_map buffer, and in these cases we don't want to remap at all. Here we avoid doing that. Based on a patch originally for plugins-good/interleave in https://bugzilla.gnome.org/show_bug.cgi?id=780331
Diffstat (limited to 'gst')
-rw-r--r--gst/audiomixer/gstaudiointerleave.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/gst/audiomixer/gstaudiointerleave.c b/gst/audiomixer/gstaudiointerleave.c
index e91b6454b..f4e9fa107 100644
--- a/gst/audiomixer/gstaudiointerleave.c
+++ b/gst/audiomixer/gstaudiointerleave.c
@@ -330,7 +330,8 @@ gst_audio_interleave_get_channel_mask (GstAudioInterleave * self)
{
guint64 channel_mask = 0;
- if (self->channel_positions != NULL &&
+ if (self->channels <= 64 &&
+ self->channel_positions != NULL &&
self->channels == self->channel_positions->n_values) {
if (!gst_audio_interleave_channel_positions_to_mask
(self->channel_positions, self->default_channels_ordering_map,
@@ -338,7 +339,7 @@ gst_audio_interleave_get_channel_mask (GstAudioInterleave * self)
GST_WARNING_OBJECT (self, "Invalid channel positions, using NONE");
channel_mask = 0;
}
- } else {
+ } else if (self->channels <= 64) {
GST_WARNING_OBJECT (self, "Using NONE channel positions");
}
@@ -826,7 +827,7 @@ gst_audio_interleave_aggregate_one_buffer (GstAudioAggregator * aagg,
GstAudioInterleavePad *pad = GST_AUDIO_INTERLEAVE_PAD (aaggpad);
GstMapInfo inmap;
GstMapInfo outmap;
- gint out_width, in_bpf, out_bpf, out_channels;
+ gint out_width, in_bpf, out_bpf, out_channels, channel;
guint8 *outdata;
out_width = GST_AUDIO_INFO_WIDTH (&aagg->info) / 8;
@@ -840,8 +841,13 @@ gst_audio_interleave_aggregate_one_buffer (GstAudioAggregator * aagg,
" from offset %u", num_frames, pad->channel, out_channels,
out_offset * out_bpf, in_offset * in_bpf);
- outdata = outmap.data + (out_offset * out_bpf) +
- (out_width * self->default_channels_ordering_map[pad->channel]);
+ if (self->channels > 64) {
+ channel = pad->channel;
+ } else {
+ channel = self->default_channels_ordering_map[pad->channel];
+ }
+
+ outdata = outmap.data + (out_offset * out_bpf) + (out_width * channel);
self->func (outdata, inmap.data + (in_offset * in_bpf), out_channels,