riff-media: Don't divide block align by zero channels

https://bugzilla.gnome.org/show_bug.cgi?id=777525
This commit is contained in:
Sebastian Dröge 2017-01-20 12:41:16 +02:00
parent d894c19db6
commit 5d505d1088

View file

@ -1299,6 +1299,8 @@ gst_riff_create_audio_caps (guint16 codec_id,
if (strf != NULL) {
gint ba = strf->blockalign;
gint ch = strf->channels;
if (ba > 0 && ch > 0 && (ba == (64 / 8) * ch || ba == (32 / 8) * ch)) {
gint wd = ba * 8 / ch;
caps = gst_caps_new_simple ("audio/x-raw",
@ -1315,6 +1317,10 @@ gst_riff_create_audio_caps (guint16 codec_id,
GST_DEBUG ("using default channel layout for %d channels", ch);
else
GST_WARNING ("failed to add channel layout");
} else {
GST_WARNING ("invalid block align %d or channel count %d", ba, ch);
return NULL;
}
} else {
/* FIXME: this is pretty useless - we need fixed caps */
caps = gst_caps_from_string ("audio/x-raw, "