mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-20 14:18:34 +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);
|
guint channels = gst_discoverer_audio_info_get_channels (ainfo);
|
||||||
GEnumClass *enum_class = g_type_class_ref (GST_TYPE_AUDIO_CHANNEL_POSITION);
|
GEnumClass *enum_class = g_type_class_ref (GST_TYPE_AUDIO_CHANNEL_POSITION);
|
||||||
guint i;
|
guint i;
|
||||||
|
guint64 channel_mask;
|
||||||
|
|
||||||
if (channels == 0)
|
if (channels == 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
gst_audio_channel_positions_from_mask (channels,
|
channel_mask = gst_discoverer_audio_info_get_channel_mask (ainfo);
|
||||||
gst_discoverer_audio_info_get_channel_mask (ainfo), position);
|
|
||||||
|
|
||||||
for (i = 0; i < channels; i++) {
|
if (channel_mask != 0) {
|
||||||
GEnumValue *value = g_enum_get_value (enum_class, position[i]);
|
gst_audio_channel_positions_from_mask (channels, channel_mask, position);
|
||||||
my_g_string_append_printf (s, 0, "%s%s", value->value_nick,
|
|
||||||
i + 1 == channels ? "" : ", ");
|
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);
|
g_type_class_unref (enum_class);
|
||||||
|
|
Loading…
Reference in a new issue