matroskademux: fix crash with 24-bit raw audio
authorMatej Knopp <matej.knopp@gmail.com>
Sun, 23 Feb 2014 18:09:24 +0000 (19:09 +0100)
committerTim-Philipp Müller <tim@centricular.com>
Thu, 27 Feb 2014 00:46:28 +0000 (00:46 +0000)
Do not try to align audio buffers to odd numbers,
which will get us a NULL buffer which we then
crash on.

https://bugzilla.gnome.org/show_bug.cgi?id=725008

gst/matroska/matroska-demux.c

index aaa60a9..f7eb034 100644 (file)
@@ -5265,6 +5265,8 @@ gst_matroska_demux_audio_caps (GstMatroskaTrackAudioContext *
     *codec_name = g_strdup_printf ("Raw %d-bit PCM audio",
         audiocontext->bitdepth);
     context->alignment = audiocontext->bitdepth / 8;
+    if (context->alignment > 1 && context->alignment % 2)
+      ++context->alignment;
   } else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_PCM_FLOAT)) {
     const gchar *format;
     if (audiocontext->bitdepth == 32)
@@ -5278,6 +5280,8 @@ gst_matroska_demux_audio_caps (GstMatroskaTrackAudioContext *
     *codec_name = g_strdup_printf ("Raw %d-bit floating-point audio",
         audiocontext->bitdepth);
     context->alignment = audiocontext->bitdepth / 8;
+    if (context->alignment > 1 && context->alignment % 2)
+      ++context->alignment;
   } else if (!strncmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_AC3,
           strlen (GST_MATROSKA_CODEC_ID_AUDIO_AC3))) {
     caps = gst_caps_new_simple ("audio/x-ac3",