mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 14:26:43 +00:00
discoverer: Don't crash when running with -v if channel-mask==0 and >7 channels
For e.g. 16-channel audio, if the channel mask is 0 (which it usually is), gst_audio_channel_positions_from_mask would get confused, ultimately leading into a crash. https://bugzilla.gnome.org/show_bug.cgi?id=796578
This commit is contained in:
parent
1208ef637a
commit
effd892021
1 changed files with 12 additions and 6 deletions
|
@ -157,17 +157,23 @@ format_channel_mask (GstDiscovererAudioInfo * ainfo)
|
|||
guint channels = gst_discoverer_audio_info_get_channels (ainfo);
|
||||
GEnumClass *enum_class = g_type_class_ref (GST_TYPE_AUDIO_CHANNEL_POSITION);
|
||||
guint i;
|
||||
guint64 channel_mask;
|
||||
|
||||
if (channels == 0)
|
||||
goto done;
|
||||
|
||||
gst_audio_channel_positions_from_mask (channels,
|
||||
gst_discoverer_audio_info_get_channel_mask (ainfo), position);
|
||||
channel_mask = gst_discoverer_audio_info_get_channel_mask (ainfo);
|
||||
|
||||
for (i = 0; i < channels; i++) {
|
||||
GEnumValue *value = g_enum_get_value (enum_class, position[i]);
|
||||
my_g_string_append_printf (s, 0, "%s%s", value->value_nick,
|
||||
i + 1 == channels ? "" : ", ");
|
||||
if (channel_mask != 0) {
|
||||
gst_audio_channel_positions_from_mask (channels, channel_mask, position);
|
||||
|
||||
for (i = 0; i < channels; i++) {
|
||||
GEnumValue *value = g_enum_get_value (enum_class, position[i]);
|
||||
my_g_string_append_printf (s, 0, "%s%s", value->value_nick,
|
||||
i + 1 == channels ? "" : ", ");
|
||||
}
|
||||
} else {
|
||||
g_string_append (s, "unknown layout");
|
||||
}
|
||||
|
||||
g_type_class_unref (enum_class);
|
||||
|
|
Loading…
Reference in a new issue