Commit b0876438 authored by Vivia Nikolaidou's avatar Vivia Nikolaidou 🦆 Committed by Tim-Philipp Müller

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
parent 78689433
......@@ -153,17 +153,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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment