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

Commit e5127e44 authored by Satya Krishna Pindiproli's avatar Satya Krishna Pindiproli Committed by Linux Build Service Account
Browse files

audiopolicy: port existing fixes to AudioPolicyManager

This is a squashed commit of the following fixes in
AudioPolicyManager. Only some parts of the fixes have been
ported as the custom audio policy has the other required
changes.

audiopolicy: support extended feature in audiopolicymanager
Change-Id: I1925339b591cd29f11a71c287a2e53c0627e9e62

audiopolicy: additional change for extended feature
Change-Id: I9bad6a294ddd7aee72f6f6a314666b892b730c8e

audiopolicy: Add voip flag to output flag list
Change-Id: Ifccb78a7b8579da0a65eb3ea7347756c664246a8

audiopolicy: fix to play 6.1 channel ALAC clips
Change-Id: I6b820776c0dc6e68a402886f0931439edab24a8b

audiopolicy: Add audio proxy device in audio policy
Change-Id: Idf3856a373eb7a05362f19d6cb117e9d4fb757ef

Conflicts:
        services/audiopolicy/common/managerdefinitions/src/TypeConverter.cpp

Change-Id: I7738d4b0ac11ee6d93bfd67e2553eae8518ff719
parent 996e7cdd
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -72,6 +72,12 @@ LOCAL_SRC_FILES += \

endif #ifeq ($(USE_XML_AUDIO_POLICY_CONF), 1)

ifeq ($(call is-vendor-board-platform,QCOM),true)
ifeq ($(strip $(AUDIO_FEATURE_ENABLED_PROXY_DEVICE)),true)
LOCAL_CFLAGS += -DAUDIO_EXTN_AFE_PROXY_ENABLED
endif
endif

LOCAL_EXPORT_C_INCLUDE_DIRS := \
    $(LOCAL_PATH)/include

+4 −0
Original line number Diff line number Diff line
@@ -52,6 +52,9 @@ const DeviceConverter::Table DeviceConverter::mTable[] = {
        MAKE_STRING_FROM_ENUM(AUDIO_DEVICE_OUT_IP),
        MAKE_STRING_FROM_ENUM(AUDIO_DEVICE_OUT_BUS),
        MAKE_STRING_FROM_ENUM(AUDIO_DEVICE_OUT_STUB),
#ifdef AUDIO_EXTN_AFE_PROXY_ENABLED
        MAKE_STRING_FROM_ENUM(AUDIO_DEVICE_OUT_PROXY),
#endif
        MAKE_STRING_FROM_ENUM(AUDIO_DEVICE_IN_AMBIENT),
        MAKE_STRING_FROM_ENUM(AUDIO_DEVICE_IN_BUILTIN_MIC),
        MAKE_STRING_FROM_ENUM(AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET),
@@ -95,6 +98,7 @@ const OutputFlagConverter::Table OutputFlagConverter::mTable[] = {
    MAKE_STRING_FROM_ENUM(AUDIO_OUTPUT_FLAG_TTS),
    MAKE_STRING_FROM_ENUM(AUDIO_OUTPUT_FLAG_RAW),
    MAKE_STRING_FROM_ENUM(AUDIO_OUTPUT_FLAG_SYNC),
    MAKE_STRING_FROM_ENUM(AUDIO_OUTPUT_FLAG_VOIP_RX),
};
template<>
const size_t OutputFlagConverter::mSize = sizeof(OutputFlagConverter::mTable) /
+6 −0
Original line number Diff line number Diff line
@@ -31,6 +31,12 @@ LOCAL_C_INCLUDES := \

LOCAL_MULTILIB := $(AUDIOSERVER_MULTILIB)

ifeq ($(call is-vendor-board-platform,QCOM),true)
ifeq ($(strip $(AUDIO_FEATURE_ENABLED_PROXY_DEVICE)),true)
LOCAL_CFLAGS += -DAUDIO_EXTN_AFE_PROXY_ENABLED
endif
endif

LOCAL_MODULE := libaudiopolicyenginedefault
LOCAL_MODULE_TAGS := optional

+18 −2
Original line number Diff line number Diff line
@@ -453,6 +453,13 @@ audio_devices_t Engine::getDeviceForStrategyInt(routing_strategy strategy,
    case STRATEGY_REROUTING:
    case STRATEGY_MEDIA: {
        uint32_t device2 = AUDIO_DEVICE_NONE;

        if (isInCall() && (device == AUDIO_DEVICE_NONE)) {
            // when in call, get the device for Phone strategy
            device = getDeviceForStrategy(STRATEGY_PHONE);
            break;
        }

        if (strategy != STRATEGY_SONIFICATION) {
            // no sonification on remote submix (e.g. WFD)
            if (availableOutputDevices.getDevice(AUDIO_DEVICE_OUT_REMOTE_SUBMIX,
@@ -498,14 +505,23 @@ audio_devices_t Engine::getDeviceForStrategyInt(routing_strategy strategy,
        if (device2 == AUDIO_DEVICE_NONE) {
            device2 = availableOutputDevicesType & AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET;
        }
        if ((device2 == AUDIO_DEVICE_NONE) && (strategy != STRATEGY_SONIFICATION)) {
        if ((strategy != STRATEGY_SONIFICATION) && (device == AUDIO_DEVICE_NONE)
            && (device2 == AUDIO_DEVICE_NONE)) {
            // no sonification on aux digital (e.g. HDMI)
            device2 = availableOutputDevicesType & AUDIO_DEVICE_OUT_AUX_DIGITAL;
        }
        if ((device2 == AUDIO_DEVICE_NONE) &&
                (mForceUse[AUDIO_POLICY_FORCE_FOR_DOCK] == AUDIO_POLICY_FORCE_ANALOG_DOCK)) {
                (mForceUse[AUDIO_POLICY_FORCE_FOR_DOCK] == AUDIO_POLICY_FORCE_ANALOG_DOCK)
                && (strategy != STRATEGY_SONIFICATION)) {
            device2 = availableOutputDevicesType & AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET;
        }
#ifdef AUDIO_EXTN_AFE_PROXY_ENABLED
        if ((strategy != STRATEGY_SONIFICATION) && (device == AUDIO_DEVICE_NONE)
            && (device2 == AUDIO_DEVICE_NONE)) {
            // no sonification on WFD sink
            device2 = availableOutputDevicesType & AUDIO_DEVICE_OUT_PROXY;
        }
#endif
        if (device2 == AUDIO_DEVICE_NONE) {
            device2 = availableOutputDevicesType & AUDIO_DEVICE_OUT_SPEAKER;
        }
+3 −2
Original line number Diff line number Diff line
@@ -629,7 +629,8 @@ sp<IOProfile> AudioPolicyManager::getProfileForDirectOutput(
    // only retain flags that will drive the direct output profile selection
    // if explicitly requested
    static const uint32_t kRelevantFlags =
            (AUDIO_OUTPUT_FLAG_HW_AV_SYNC | AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD);
            (AUDIO_OUTPUT_FLAG_HW_AV_SYNC | AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD |
               AUDIO_OUTPUT_FLAG_VOIP_RX);
    flags =
        (audio_output_flags_t)((flags & kRelevantFlags) | AUDIO_OUTPUT_FLAG_DIRECT);

@@ -4139,7 +4140,7 @@ void AudioPolicyManager::checkOutputForStrategy(routing_strategy strategy)
{
    audio_devices_t oldDevice = getDeviceForStrategy(strategy, true /*fromCache*/);
    audio_devices_t newDevice = getDeviceForStrategy(strategy, false /*fromCache*/);
    SortedVector<audio_io_handle_t> srcOutputs = getOutputsForDevice(oldDevice, mPreviousOutputs);
    SortedVector<audio_io_handle_t> srcOutputs = getOutputsForDevice(oldDevice, mOutputs);
    SortedVector<audio_io_handle_t> dstOutputs = getOutputsForDevice(newDevice, mOutputs);

    // also take into account external policy-related changes: add all outputs which are