audio: Fixes for MPEG-2 LSF IEC61937 payloading

The low sample frequency case for MPEG-2 is <=12kHz (the 32kHz number
applies to MPEG-1).

https://bugzilla.gnome.org/show_bug.cgi?id=736797
This commit is contained in:
Arun Raghavan 2014-09-24 20:11:49 +05:30
parent 798ff6e561
commit 2965b796bc

View file

@ -114,12 +114,15 @@ gst_audio_iec61937_frame_size (const GstAudioRingBufferSpec * spec)
if (version == 1 && layer == 1)
frames = 384;
else if (version == 2 && layer == 1 && spec->info.rate < 32000)
else if (version == 2 && layer == 1 && spec->info.rate <= 12000)
frames = 768;
else if (version == 2 && layer == 2 && spec->info.rate < 32000)
else if (version == 2 && layer == 2 && spec->info.rate <= 12000)
frames = 2304;
else
else {
/* MPEG-1 layer 2,3, MPEG-2 with or without extension,
* MPEG-2 layer 3 low sample freq. */
frames = 1152;
}
return frames * 4;
}
@ -277,13 +280,13 @@ gst_audio_iec61937_payload (const guint8 * src, guint src_n, guint8 * dst,
if (version == 1 && layer == 1)
dst[five] = 0x04;
else if ((version == 1 && (layer == 2 || layer == 3)) ||
(version == 2 && spec->info.rate >= 32000))
(version == 2 && spec->info.rate >= 12000))
dst[five] = 0x05;
else if (version == 2 && layer == 1 && spec->info.rate < 32000)
else if (version == 2 && layer == 1 && spec->info.rate < 12000)
dst[five] = 0x08;
else if (version == 2 && layer == 2 && spec->info.rate < 32000)
else if (version == 2 && layer == 2 && spec->info.rate < 12000)
dst[five] = 0x09;
else if (version == 2 && layer == 3 && spec->info.rate < 32000)
else if (version == 2 && layer == 3 && spec->info.rate < 12000)
dst[five] = 0x0A;
else
g_return_val_if_reached (FALSE);