aacparse: parse a bit more of the humongous LOAS data

https://bugzilla.gnome.org/show_bug.cgi?id=769278
This commit is contained in:
Vincent Penquerc'h 2016-09-05 09:39:33 +01:00
parent e66ee5491c
commit c974df1c06

View File

@ -542,7 +542,10 @@ static gboolean
gst_aac_parse_read_loas_audio_specific_config (GstAacParse * aacparse, gst_aac_parse_read_loas_audio_specific_config (GstAacParse * aacparse,
GstBitReader * br, gint * sample_rate, gint * channels, guint32 * bits) GstBitReader * br, gint * sample_rate, gint * channels, guint32 * bits)
{ {
guint8 audio_object_type, channel_configuration; guint8 audio_object_type;
guint8 G_GNUC_UNUSED extension_audio_object_type;
guint8 channel_configuration, extension_channel_configuration;
gboolean G_GNUC_UNUSED sbr = FALSE, ps = FALSE;
if (!gst_aac_parse_get_audio_object_type (aacparse, br, &audio_object_type)) if (!gst_aac_parse_get_audio_object_type (aacparse, br, &audio_object_type))
return FALSE; return FALSE;
@ -552,16 +555,38 @@ gst_aac_parse_read_loas_audio_specific_config (GstAacParse * aacparse,
if (!gst_bit_reader_get_bits_uint8 (br, &channel_configuration, 4)) if (!gst_bit_reader_get_bits_uint8 (br, &channel_configuration, 4))
return FALSE; return FALSE;
GST_LOG_OBJECT (aacparse, "channel_configuration: %d", channel_configuration);
*channels = loas_channels_table[channel_configuration]; *channels = loas_channels_table[channel_configuration];
GST_LOG_OBJECT (aacparse, "channel_configuration: %d", channel_configuration);
if (!*channels) if (!*channels)
return FALSE; return FALSE;
if (audio_object_type == 5) { if (audio_object_type == 5 || audio_object_type == 29) {
extension_audio_object_type = 5;
sbr = TRUE;
if (audio_object_type == 29)
ps = TRUE;
GST_LOG_OBJECT (aacparse, GST_LOG_OBJECT (aacparse,
"Audio object type 5, so rereading sampling rate..."); "Audio object type 5 or 29, so rereading sampling rate...");
if (!gst_aac_parse_get_audio_sample_rate (aacparse, br, sample_rate)) if (!gst_aac_parse_get_audio_sample_rate (aacparse, br, sample_rate))
return FALSE; return FALSE;
if (!gst_aac_parse_get_audio_object_type (aacparse, br, &audio_object_type))
return FALSE;
if (audio_object_type == 22) {
/* extension channel configuration */
if (!gst_bit_reader_get_bits_uint8 (br, &extension_channel_configuration,
4))
return FALSE;
GST_LOG_OBJECT (aacparse, "extension channel_configuration: %d",
extension_channel_configuration);
*channels = loas_channels_table[extension_channel_configuration];
if (!*channels)
return FALSE;
}
} else {
extension_audio_object_type = 0;
} }
GST_INFO_OBJECT (aacparse, "Found LOAS config: %d Hz, %d channels", GST_INFO_OBJECT (aacparse, "Found LOAS config: %d Hz, %d channels",