Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 753b1f31 authored by Satya Krishna Pindiproli's avatar Satya Krishna Pindiproli Committed by Gerrit - the friendly Code Review server
Browse files

policy_hal: allow direct output only for music streams

Ringtones/Alarms take direct PCM path which is not expected.

Allow only music streams to take direct path by forcefully
setting flags to none for other stream types.

CRs-Fixed: 2049687
Change-Id: I1994f3958b9b10991e45f1a8a28fb26764d0af13
parent ffe6cef0
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -1714,9 +1714,10 @@ audio_io_handle_t AudioPolicyManagerCustom::getOutputForDevice(
        ((offloadInfo->usage == AUDIO_USAGE_MEDIA) || (offloadInfo->usage == AUDIO_USAGE_GAME))) {
        audio_output_flags_t old_flags = flags;
        flags = (audio_output_flags_t)(AUDIO_OUTPUT_FLAG_DIRECT);
        ALOGD("AudioCustomHAL --> Force Direct Flag .. old flags(0x%x)", old_flags);
    } else if (flags == AUDIO_OUTPUT_FLAG_DIRECT && offload_disabled) {
        ALOGD("AudioCustomHAL --> offloading is disabled: Force Remove Direct Flag");
        ALOGD("Force Direct Flag .. old flags(0x%x)", old_flags);
    } else if (flags == AUDIO_OUTPUT_FLAG_DIRECT &&
                (offload_disabled || stream != AUDIO_STREAM_MUSIC)) {
        ALOGD("Offloading is disabled or Stream is not music --> Force Remove Direct Flag");
        flags = (audio_output_flags_t)(AUDIO_OUTPUT_FLAG_NONE);
    }