代码拉取完成,页面将自动刷新
--- a/gst-libs/gst/riff/riff-media.c 2019-04-10 17:19:15.918000000 +0800
+++ b/gst-libs/gst/riff/riff-media-change.c 2019-04-10 17:25:28.619000000 +0800
@@ -1196,24 +1196,30 @@ gst_riff_create_audio_caps (guint16 code
if (strf != NULL) {
gint ba = strf->blockalign;
gint ch = strf->channels;
- 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);
+ if (ba > 0 && ch > 0 && (ba == (64 / 8) * ch || ba == (32 / 8) * ch)) {
+ gint wd = ba * 8 / ch;
- /* 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");
- }
+ 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");
+ }
+ } 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-float, "
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。