hal: Add NULL check for PCM streams in pass though module
- HAL restart is observed for PCM stream playback
over display port
- Codec info is not available for PCM stream on updating
passthough type
- Add NULL check while updating stream configuration
on pass through module
Change-Id: If8b0f6757610535aa079b88abfa505d5cd1a6e31
diff --git a/hal/audio_extn/passthru.c b/hal/audio_extn/passthru.c
index 99949fc..72b9d80 100755
--- a/hal/audio_extn/passthru.c
+++ b/hal/audio_extn/passthru.c
@@ -441,18 +441,20 @@
struct audio_device *adev, struct stream_out *out,
const void *buffer __unused, size_t bytes __unused)
{
- if (audio_extn_passthru_is_passt_supported(adev, out)) {
- ALOGV("%s:PASSTHROUGH", __func__);
- out->compr_config.codec->compr_passthr = PASSTHROUGH;
- } else if (audio_extn_passthru_is_convert_supported(adev, out)) {
- ALOGV("%s:PASSTHROUGH CONVERT", __func__);
- out->compr_config.codec->compr_passthr = PASSTHROUGH_CONVERT;
- } else if (out->format == AUDIO_FORMAT_IEC61937) {
- ALOGV("%s:PASSTHROUGH IEC61937", __func__);
- out->compr_config.codec->compr_passthr = PASSTHROUGH_IEC61937;
- } else {
- ALOGV("%s:NO PASSTHROUGH", __func__);
- out->compr_config.codec->compr_passthr = LEGACY_PCM;
+ if(out->compr_config.codec != NULL) {
+ if (audio_extn_passthru_is_passt_supported(adev, out)) {
+ ALOGV("%s:PASSTHROUGH", __func__);
+ out->compr_config.codec->compr_passthr = PASSTHROUGH;
+ } else if (audio_extn_passthru_is_convert_supported(adev, out)) {
+ ALOGV("%s:PASSTHROUGH CONVERT", __func__);
+ out->compr_config.codec->compr_passthr = PASSTHROUGH_CONVERT;
+ } else if (out->format == AUDIO_FORMAT_IEC61937) {
+ ALOGV("%s:PASSTHROUGH IEC61937", __func__);
+ out->compr_config.codec->compr_passthr = PASSTHROUGH_IEC61937;
+ } else {
+ ALOGV("%s:NO PASSTHROUGH", __func__);
+ out->compr_config.codec->compr_passthr = LEGACY_PCM;
+ }
}
}