Commit 5d505d10 authored by Sebastian Dröge's avatar Sebastian Dröge
Browse files

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

https://bugzilla.gnome.org/show_bug.cgi?id=777525
parent d894c19d
...@@ -1299,22 +1299,28 @@ gst_riff_create_audio_caps (guint16 codec_id, ...@@ -1299,22 +1299,28 @@ gst_riff_create_audio_caps (guint16 codec_id,
if (strf != NULL) { if (strf != NULL) {
gint ba = strf->blockalign; gint ba = strf->blockalign;
gint ch = strf->channels; gint ch = strf->channels;
gint wd = ba * 8 / ch;
caps = gst_caps_new_simple ("audio/x-raw", if (ba > 0 && ch > 0 && (ba == (64 / 8) * ch || ba == (32 / 8) * ch)) {
"format", G_TYPE_STRING, wd == 64 ? "F64LE" : "F32LE", gint wd = ba * 8 / ch;
"layout", G_TYPE_STRING, "interleaved",
"channels", G_TYPE_INT, ch, NULL); caps = gst_caps_new_simple ("audio/x-raw",
"format", G_TYPE_STRING, wd == 64 ? "F64LE" : "F32LE",
/* Add default channel layout. We know no default layout for more than "layout", G_TYPE_STRING, "interleaved",
* 8 channels. */ "channels", G_TYPE_INT, ch, NULL);
if (ch > 8)
GST_WARNING ("don't know default layout for %d channels", ch); /* Add default channel layout. We know no default layout for more than
else if (gst_riff_wave_add_default_channel_mask (caps, ch, * 8 channels. */
channel_reorder_map)) if (ch > 8)
GST_DEBUG ("using default channel layout for %d channels", ch); GST_WARNING ("don't know default layout for %d channels", ch);
else else if (gst_riff_wave_add_default_channel_mask (caps, ch,
GST_WARNING ("failed to add channel layout"); channel_reorder_map))
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 { } else {
/* FIXME: this is pretty useless - we need fixed caps */ /* FIXME: this is pretty useless - we need fixed caps */
caps = gst_caps_from_string ("audio/x-raw, " caps = gst_caps_from_string ("audio/x-raw, "
......
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