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

Commit b2e9548a authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "audiopolicy: use an exact match for MMAP input"

parents b74ba734 4515129c
Loading
Loading
Loading
Loading
+12 −7
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#define LOG_TAG "APM::IOProfile"
//#define LOG_NDEBUG 0

#include <system/audio-base.h>
#include "IOProfile.h"
#include "HwModule.h"
#include "AudioGain.h"
@@ -66,19 +67,23 @@ bool IOProfile::isCompatibleProfile(audio_devices_t device,
    audio_format_t myUpdatedFormat = format;
    audio_channel_mask_t myUpdatedChannelMask = channelMask;
    uint32_t myUpdatedSamplingRate = samplingRate;
    if (isRecordThread)
    {
        if (checkCompatibleAudioProfile(
                myUpdatedSamplingRate, myUpdatedChannelMask, myUpdatedFormat) != NO_ERROR) {
            return false;
        }
    } else {
    const struct audio_port_config config = {
        .config_mask = AUDIO_PORT_CONFIG_ALL & ~AUDIO_PORT_CONFIG_GAIN,
        .sample_rate = samplingRate,
        .channel_mask = channelMask,
        .format = format,
    };
    if (isRecordThread)
    {
        if ((flags & AUDIO_INPUT_FLAG_MMAP_NOIRQ) != 0) {
            if (checkExactAudioProfile(&config) != NO_ERROR) {
                return false;
            }
        } else if (checkCompatibleAudioProfile(
                myUpdatedSamplingRate, myUpdatedChannelMask, myUpdatedFormat) != NO_ERROR) {
            return false;
        }
    } else {
        if (checkExactAudioProfile(&config) != NO_ERROR) {
            return false;
        }