audio: Set the correct audio format for ADTS
- Widevine sends ADTS data, set ADTS based on the parameter
Change-Id: I4c2376408e2998354db583a9f54649476a880f01
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 60b38a5..348508a 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -1337,11 +1337,21 @@
struct compr_gapless_mdata tmp_mdata;
tmp_mdata.encoder_delay = 0;
tmp_mdata.encoder_padding = 0;
+
if (!out || !parms) {
ALOGE("%s: return invalid ",__func__);
return -EINVAL;
}
+ ret = str_parms_get_str(parms, AUDIO_OFFLOAD_CODEC_FORMAT, value, sizeof(value));
+ if (ret >= 0) {
+ if (atoi(value) == SND_AUDIOSTREAMFORMAT_MP4ADTS) {
+ out->compr_config.codec->format = SND_AUDIOSTREAMFORMAT_MP4ADTS;
+ ALOGV("ADTS format is set in offload mode");
+ }
+ out->send_new_metadata = 1;
+ }
+
ret = str_parms_get_str(parms, AUDIO_OFFLOAD_CODEC_SAMPLE_RATE, value, sizeof(value));
if(ret >= 0)
is_meta_data_params = true;
@@ -2167,6 +2177,7 @@
out->compr_config.codec->ch_in =
popcount(config->channel_mask);
out->compr_config.codec->ch_out = out->compr_config.codec->ch_in;
+ out->compr_config.codec->format = SND_AUDIOSTREAMFORMAT_RAW;
if (config->offload_info.format == AUDIO_FORMAT_PCM_16_BIT_OFFLOAD)
out->compr_config.codec->format = SNDRV_PCM_FORMAT_S16_LE;