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

Commit 01bcdfb1 authored by Manish Dewangan's avatar Manish Dewangan Committed by Linux Build Service Account
Browse files

frameworks/av: Changes to match exact format for input profile

-Currently a input profile for which device is matched is selected and
 for other parameters such as format, sample rate and channel mask
 it uses best match instead of exact match.
-Change done to check for exact format match and if fails then fall back to
 old approach(best match)

Change-Id: Ic1f839600906b2fb84867b4bcb3ab1d159aa0a67
parent bfc04e17
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -94,9 +94,11 @@ public:
    // parameters are input|output, returned value is the best match.
    status_t checkCompatibleAudioProfile(uint32_t &samplingRate,
                                         audio_channel_mask_t &channelMask,
                                         audio_format_t &format) const
                                         audio_format_t &format,
                                         bool checkExactFormat) const
    {
        return mProfiles.checkCompatibleProfile(samplingRate, channelMask, format, mType, mRole);
        return mProfiles.checkCompatibleProfile(samplingRate, channelMask, format, mType,
                                                  mRole, checkExactFormat);
    }

    void clearAudioProfiles() { return mProfiles.clearProfiles(); }
+2 −1
Original line number Diff line number Diff line
@@ -200,7 +200,8 @@ public:
    status_t checkCompatibleProfile(uint32_t &samplingRate, audio_channel_mask_t &channelMask,
                                    audio_format_t &format,
                                    audio_port_type_t portType,
                                    audio_port_role_t portRole) const;
                                    audio_port_role_t portRole,
                                    bool checkExactFormat = false) const;

    FormatVector getSupportedFormats() const
    {
+2 −1
Original line number Diff line number Diff line
@@ -51,7 +51,8 @@ public:
                             audio_format_t *updatedFormat,
                             audio_channel_mask_t channelMask,
                             audio_channel_mask_t *updatedChannelMask,
                             uint32_t flags) const;
                             uint32_t flags,
                             bool checkExactFormatMatch = false) const;

    void dump(int fd);
    void log();
+5 −1
Original line number Diff line number Diff line
@@ -246,7 +246,8 @@ status_t AudioProfileVector::checkCompatibleProfile(uint32_t &samplingRate,
                                                    audio_channel_mask_t &channelMask,
                                                    audio_format_t &format,
                                                    audio_port_type_t portType,
                                                    audio_port_role_t portRole) const
                                                    audio_port_role_t portRole,
                                                    bool checkExactFormat) const
{
    if (isEmpty()) {
        return NO_ERROR;
@@ -268,6 +269,9 @@ status_t AudioProfileVector::checkCompatibleProfile(uint32_t &samplingRate,
            // rate and channels as well
            audio_channel_mask_t updatedChannels;
            uint32_t updatedRate;

            if ((checkExactFormat) && (formatToCompare != format))
                continue;
            if (profile->checkCompatibleChannelMask(channelMask, updatedChannels,
                                                    portType, portRole) == NO_ERROR &&
                    profile->checkCompatibleSamplingRate(samplingRate, updatedRate) == NO_ERROR) {
+3 −2
Original line number Diff line number Diff line
@@ -35,7 +35,8 @@ bool IOProfile::isCompatibleProfile(audio_devices_t device,
                                    audio_format_t *updatedFormat,
                                    audio_channel_mask_t channelMask,
                                    audio_channel_mask_t *updatedChannelMask,
                                    uint32_t flags) const
                                    uint32_t flags,
                                    bool checkExactFormat) const
{
    const bool isPlaybackThread =
            getType() == AUDIO_PORT_TYPE_MIX && getRole() == AUDIO_PORT_ROLE_SOURCE;
@@ -67,7 +68,7 @@ bool IOProfile::isCompatibleProfile(audio_devices_t device,
    if (isRecordThread)
    {
        if (checkCompatibleAudioProfile(
                myUpdatedSamplingRate, myUpdatedChannelMask, myUpdatedFormat) != NO_ERROR) {
                myUpdatedSamplingRate, myUpdatedChannelMask, myUpdatedFormat, checkExactFormat) != NO_ERROR) {
            return false;
        }
    } else {
Loading