hal: Refactor HDMI backend configuration
-In current design HDMI backend configuration does not validate
incoming configuration against what is supported by the
connected sink ( using edid). This results in an incorrect
configuration of the HDMI backend, sometimes leading to no audio.
-Move HDMI backend configuration to
platform_check_and_set_codec_backend_cfg, this design ensures
that HDMI backend configuration happens with valid and only
supported parameters (sample rate, channels and bit width)
by the connected sink.
-Remove usleep from keep_alive and move to conditional timed wait,
this ensures to break from the keep_alive loop quickly, instead
of waiting for the complete usleep duration.
CRs-Fixed: 1039831
Change-Id: Id46ae76575f1b8169370cee817b505b97af8fe01
diff --git a/hal/audio_extn/passthru.c b/hal/audio_extn/passthru.c
index e6ac4dd..eaa8c0a 100644
--- a/hal/audio_extn/passthru.c
+++ b/hal/audio_extn/passthru.c
@@ -82,8 +82,14 @@
*/
bool audio_extn_passthru_should_drop_data(struct stream_out * out)
{
-
- if (out->usecase != USECASE_AUDIO_PLAYBACK_OFFLOAD) {
+ /*Drop data only
+ *stream is routed to HDMI and
+ *stream has PCM format or
+ *if a compress offload (DSP decode) session
+ */
+ if ((out->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL) &&
+ (((out->format & AUDIO_FORMAT_MAIN_MASK) == AUDIO_FORMAT_PCM) ||
+ ((out->compr_config.codec != NULL) && (out->compr_config.codec->compr_passthr == LEGACY_PCM)))) {
if (android_atomic_acquire_load(&compress_passthru_active) > 0) {
ALOGI("drop data as pass thru is active");
return true;
@@ -112,9 +118,6 @@
ALOGV("inc pass thru count to notify other streams");
android_atomic_inc(&compress_passthru_active);
- ALOGV("keep_alive_stop");
- audio_extn_keep_alive_stop();
-
while (true) {
/* find max period time among active playback use cases */
list_for_each(node, &adev->usecase_list) {