mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-02 22:46:35 +00:00
matroskademux: align raw audio memory to powers of two
https://bugzilla.gnome.org/show_bug.cgi?id=725008
This commit is contained in:
parent
c3dc53e551
commit
f3163fb45f
1 changed files with 14 additions and 4 deletions
|
@ -5200,6 +5200,18 @@ aac_profile_idx (const gchar * codec_id)
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static guint
|
||||||
|
round_up_pow2 (guint n)
|
||||||
|
{
|
||||||
|
n = n - 1;
|
||||||
|
n = n | (n >> 1);
|
||||||
|
n = n | (n >> 2);
|
||||||
|
n = n | (n >> 4);
|
||||||
|
n = n | (n >> 8);
|
||||||
|
n = n | (n >> 16);
|
||||||
|
return n + 1;
|
||||||
|
}
|
||||||
|
|
||||||
#define AAC_SYNC_EXTENSION_TYPE 0x02b7
|
#define AAC_SYNC_EXTENSION_TYPE 0x02b7
|
||||||
|
|
||||||
static GstCaps *
|
static GstCaps *
|
||||||
|
@ -5265,8 +5277,7 @@ gst_matroska_demux_audio_caps (GstMatroskaTrackAudioContext *
|
||||||
*codec_name = g_strdup_printf ("Raw %d-bit PCM audio",
|
*codec_name = g_strdup_printf ("Raw %d-bit PCM audio",
|
||||||
audiocontext->bitdepth);
|
audiocontext->bitdepth);
|
||||||
context->alignment = GST_ROUND_UP_8 (audiocontext->bitdepth) / 8;
|
context->alignment = GST_ROUND_UP_8 (audiocontext->bitdepth) / 8;
|
||||||
if (context->alignment > 1 && context->alignment % 2)
|
context->alignment = round_up_pow2 (context->alignment);
|
||||||
++context->alignment;
|
|
||||||
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_PCM_FLOAT)) {
|
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_PCM_FLOAT)) {
|
||||||
const gchar *format;
|
const gchar *format;
|
||||||
if (audiocontext->bitdepth == 32)
|
if (audiocontext->bitdepth == 32)
|
||||||
|
@ -5280,8 +5291,7 @@ gst_matroska_demux_audio_caps (GstMatroskaTrackAudioContext *
|
||||||
*codec_name = g_strdup_printf ("Raw %d-bit floating-point audio",
|
*codec_name = g_strdup_printf ("Raw %d-bit floating-point audio",
|
||||||
audiocontext->bitdepth);
|
audiocontext->bitdepth);
|
||||||
context->alignment = audiocontext->bitdepth / 8;
|
context->alignment = audiocontext->bitdepth / 8;
|
||||||
if (context->alignment > 1 && context->alignment % 2)
|
context->alignment = round_up_pow2 (context->alignment);
|
||||||
++context->alignment;
|
|
||||||
} else if (!strncmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_AC3,
|
} else if (!strncmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_AC3,
|
||||||
strlen (GST_MATROSKA_CODEC_ID_AUDIO_AC3))) {
|
strlen (GST_MATROSKA_CODEC_ID_AUDIO_AC3))) {
|
||||||
caps = gst_caps_new_simple ("audio/x-ac3",
|
caps = gst_caps_new_simple ("audio/x-ac3",
|
||||||
|
|
Loading…
Reference in a new issue