File 0001-riff-media-Dont-divide-block-align-by-zero-channels.patch of Package gstreamer-0_10-plugins-base.26306
From 5d505d108800cef210f67dcfed2801ba36beac2a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= <sebastian@centricular.com>
Date: Fri, 20 Jan 2017 12:41:16 +0200
Subject: [PATCH] riff-media: Don't divide block align by zero channels
https://bugzilla.gnome.org/show_bug.cgi?id=777525
---
gst-libs/gst/riff/riff-media.c | 36 +++++++++++++++++++++---------------
1 file changed, 21 insertions(+), 15 deletions(-)
diff --git a/gst-libs/gst/riff/riff-media.c b/gst-libs/gst/riff/riff-media.c
index 3182bc3..c227835 100644
--- a/gst-libs/gst/riff/riff-media.c
+++ b/gst-libs/gst/riff/riff-media.c
@@ -1196,23 +1196,28 @@ gst_riff_create_audio_caps (guint16 code
if (strf != NULL) {
gint ba = strf->blockalign;
gint ch = strf->channels;
- gint wd = ba * 8 / ch;
+ 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-float",
- "endianness", G_TYPE_INT, G_LITTLE_ENDIAN,
- "channels", G_TYPE_INT, ch, "width", G_TYPE_INT, wd, NULL);
+ caps = gst_caps_new_simple ("audio/x-raw-float",
+ "endianness", G_TYPE_INT, G_LITTLE_ENDIAN,
+ "channels", G_TYPE_INT, ch, "width", G_TYPE_INT, wd, NULL);
- /* Add default channel layout. In theory this should be done
- * for 1 and 2 channels too but apparently breaks too many
- * things currently. Also we know no default layout for more than
- * 8 channels. */
- if (ch > 2) {
- if (ch > 8)
- GST_WARNING ("don't know default layout for %d channels", ch);
- else if (gst_riff_wave_add_default_channel_layout (caps))
- GST_DEBUG ("using default channel layout for %d channels", ch);
- else
- GST_WARNING ("failed to add channel layout");
+ /* Add default channel layout. In theory this should be done
+ * for 1 and 2 channels too but apparently breaks too many
+ * things currently. Also we know no default layout for more than
+ * 8 channels. */
+ if (ch > 2) {
+ if (ch > 8)
+ GST_WARNING ("don't know default layout for %d channels", ch);
+ else if (gst_riff_wave_add_default_channel_layout (caps))
+ 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 */