mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-21 21:46:22 +00:00
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
This commit is contained in:
parent
0c4eb22a7d
commit
e83573fd8d
1 changed files with 11 additions and 5 deletions
|
@ -330,7 +330,8 @@ gst_audio_interleave_get_channel_mask (GstAudioInterleave * self)
|
||||||
{
|
{
|
||||||
guint64 channel_mask = 0;
|
guint64 channel_mask = 0;
|
||||||
|
|
||||||
if (self->channel_positions != NULL &&
|
if (self->channels <= 64 &&
|
||||||
|
self->channel_positions != NULL &&
|
||||||
self->channels == self->channel_positions->n_values) {
|
self->channels == self->channel_positions->n_values) {
|
||||||
if (!gst_audio_interleave_channel_positions_to_mask
|
if (!gst_audio_interleave_channel_positions_to_mask
|
||||||
(self->channel_positions, self->default_channels_ordering_map,
|
(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");
|
GST_WARNING_OBJECT (self, "Invalid channel positions, using NONE");
|
||||||
channel_mask = 0;
|
channel_mask = 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else if (self->channels <= 64) {
|
||||||
GST_WARNING_OBJECT (self, "Using NONE channel positions");
|
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);
|
GstAudioInterleavePad *pad = GST_AUDIO_INTERLEAVE_PAD (aaggpad);
|
||||||
GstMapInfo inmap;
|
GstMapInfo inmap;
|
||||||
GstMapInfo outmap;
|
GstMapInfo outmap;
|
||||||
gint out_width, in_bpf, out_bpf, out_channels;
|
gint out_width, in_bpf, out_bpf, out_channels, channel;
|
||||||
guint8 *outdata;
|
guint8 *outdata;
|
||||||
|
|
||||||
out_width = GST_AUDIO_INFO_WIDTH (&aagg->info) / 8;
|
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,
|
" from offset %u", num_frames, pad->channel, out_channels,
|
||||||
out_offset * out_bpf, in_offset * in_bpf);
|
out_offset * out_bpf, in_offset * in_bpf);
|
||||||
|
|
||||||
outdata = outmap.data + (out_offset * out_bpf) +
|
if (self->channels > 64) {
|
||||||
(out_width * self->default_channels_ordering_map[pad->channel]);
|
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,
|
self->func (outdata, inmap.data + (in_offset * in_bpf), out_channels,
|
||||||
|
|
Loading…
Reference in a new issue