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

Commit bf05e947 authored by Phil Burk's avatar Phil Burk
Browse files

aaudio: do not allow SRC mismatch if flag off

The purpose of this CL is to skip several attempts at
opening a stream if we know it will fail due to a sample rate mismatch.
This will speed up the open and reduce log spam.

Bug: 219533889
Bug: 318893452
Test: OboeTester, TEST OUTPUT, SRate:16000
Change-Id: I5cba48bda5f60f861d08642be8d77d55ecbef860
parent 016cf79d
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -37,6 +37,8 @@
#include "AAudioServiceEndpointPlay.h"
#include "AAudioServiceEndpointMMAP.h"

#include <com_android_media_aaudio.h>

#define AAUDIO_BUFFER_CAPACITY_MIN    (4 * 512)
#define AAUDIO_SAMPLE_RATE_DEFAULT    48000

@@ -148,9 +150,15 @@ aaudio_result_t AAudioServiceEndpointMMAP::open(const aaudio::AAudioStreamReques

        // Try other formats if the config from APM is the same as our current config.
        // Some HALs may report its format support incorrectly.
        if ((previousConfig.format == config.format) &&
                (previousConfig.sample_rate == config.sample_rate)) {
        if (previousConfig.format == config.format) {
            if (previousConfig.sample_rate == config.sample_rate) {
                config.format = getNextFormatToTry(config.format);
            } else if (!com::android::media::aaudio::sample_rate_conversion()) {
                ALOGI("%s() - AAudio SRC feature not enabled, different rates! %d != %d",
                      __func__, previousConfig.sample_rate, config.sample_rate);
                result = AAUDIO_ERROR_INVALID_RATE;
                break;
            }
        }

        ALOGD("%s() %#x %d failed, perhaps due to format or sample rate. Try again with %#x %d",
+1 −0
Original line number Diff line number Diff line
@@ -97,6 +97,7 @@ cc_defaults {
        "framework-permission-aidl-cpp",
        "libaudioclient_aidl_conversion",
        "packagemanager_aidl-cpp",
        "com.android.media.aaudio-aconfig-cc",
    ],

    static_libs: [
+1 −0
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ cc_fuzz {
        "aaudio-aidl-cpp",
        "framework-permission-aidl-cpp",
        "libaudioclient_aidl_conversion",
        "com.android.media.aaudio-aconfig-cc",
    ],
    static_libs: [
        "libaaudioservice",