hal: adapt to new compressed format header
snd_enc_generic structure is used to pass the decoder type
and configuration. Reserved[0] contains the decoder type
and reserve[1] onwards the decoder configuration. Adapt
decoder parsing logic accordingly.
Change-Id: I6b27648e68bfc6b84f2bdaa247633788f38e2457
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 0cd849a..8a5df51 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -78,6 +78,11 @@
#include "ip_hdlr_intf.h"
#include "sound/compress_params.h"
+
+#ifdef AUDIO_GKI_ENABLED
+#include "sound/audio_compressed_formats.h"
+#endif
+
#include "sound/asound.h"
#ifdef DYNAMIC_LOG_ENABLED
@@ -7657,6 +7662,9 @@
bool force_haptic_path =
property_get_bool("vendor.audio.test_haptic", false);
bool is_voip_rx = flags & AUDIO_OUTPUT_FLAG_VOIP_RX;
+#ifdef AUDIO_GKI_ENABLED
+ __s32 *generic_dec;
+#endif
if (is_usb_dev && (!audio_extn_usb_connected(NULL))) {
is_usb_dev = false;
@@ -8082,8 +8090,16 @@
if (out->flags & AUDIO_OUTPUT_FLAG_TIMESTAMP) {
out->compr_config.fragment_size += sizeof(struct snd_codec_metadata);
}
- if (config->offload_info.format == AUDIO_FORMAT_FLAC)
+ if (config->offload_info.format == AUDIO_FORMAT_FLAC) {
+#ifdef AUDIO_GKI_ENABLED
+ generic_dec =
+ &(out->compr_config.codec->options.generic.reserved[1]);
+ ((struct snd_generic_dec_flac *)generic_dec)->sample_size =
+ AUDIO_OUTPUT_BIT_WIDTH;
+#else
out->compr_config.codec->options.flac_dec.sample_size = AUDIO_OUTPUT_BIT_WIDTH;
+#endif
+ }
if (config->offload_info.format == AUDIO_FORMAT_APTX) {
audio_extn_send_aptx_dec_bt_addr_to_dsp(out);