mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-25 03:01:03 +00:00
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:
parent
798ff6e561
commit
2965b796bc
1 changed files with 10 additions and 7 deletions
|
@ -114,12 +114,15 @@ gst_audio_iec61937_frame_size (const GstAudioRingBufferSpec * spec)
|
||||||
|
|
||||||
if (version == 1 && layer == 1)
|
if (version == 1 && layer == 1)
|
||||||
frames = 384;
|
frames = 384;
|
||||||
else if (version == 2 && layer == 1 && spec->info.rate < 32000)
|
else if (version == 2 && layer == 1 && spec->info.rate <= 12000)
|
||||||
frames = 768;
|
frames = 768;
|
||||||
else if (version == 2 && layer == 2 && spec->info.rate < 32000)
|
else if (version == 2 && layer == 2 && spec->info.rate <= 12000)
|
||||||
frames = 2304;
|
frames = 2304;
|
||||||
else
|
else {
|
||||||
|
/* MPEG-1 layer 2,3, MPEG-2 with or without extension,
|
||||||
|
* MPEG-2 layer 3 low sample freq. */
|
||||||
frames = 1152;
|
frames = 1152;
|
||||||
|
}
|
||||||
|
|
||||||
return frames * 4;
|
return frames * 4;
|
||||||
}
|
}
|
||||||
|
@ -277,13 +280,13 @@ gst_audio_iec61937_payload (const guint8 * src, guint src_n, guint8 * dst,
|
||||||
if (version == 1 && layer == 1)
|
if (version == 1 && layer == 1)
|
||||||
dst[five] = 0x04;
|
dst[five] = 0x04;
|
||||||
else if ((version == 1 && (layer == 2 || layer == 3)) ||
|
else if ((version == 1 && (layer == 2 || layer == 3)) ||
|
||||||
(version == 2 && spec->info.rate >= 32000))
|
(version == 2 && spec->info.rate >= 12000))
|
||||||
dst[five] = 0x05;
|
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;
|
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;
|
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;
|
dst[five] = 0x0A;
|
||||||
else
|
else
|
||||||
g_return_val_if_reached (FALSE);
|
g_return_val_if_reached (FALSE);
|
||||||
|
|
Loading…
Reference in a new issue