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

Commit 9dcd34f4 authored by Kevin Rocard's avatar Kevin Rocard
Browse files

AAudio should not use legacy path if not allowed



Test: mmm frameworks/av/media/libaaudio/examples && adb sync data &&
      adb shell ! /data/nativetest64/write_sine_callback/write_sine_callback -m3
Change-Id: Ie17c4037c4b61caed07748a0ae79ec950da3c802
Signed-off-by: default avatarKevin Rocard <krocard@google.com>
parent 5f2136e6
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -272,7 +272,9 @@ public:
                    if (strlen(arg) > 2) {
                        policy = atoi(&arg[2]);
                    }
                    AAudio_setMMapPolicy(policy);
                    if (!AAudio_setMMapPolicy(policy)) {
                        printf("ERROR: invalid MMAP policy mode %i\n", policy);
                    }
                } break;
                case 'n':
                    setNumberOfBursts(atoi(&arg[2]));
@@ -363,7 +365,7 @@ public:
                mode = AAUDIO_PERFORMANCE_MODE_POWER_SAVING;
                break;
            default:
                printf("ERROR invalid performance mode %c\n", c);
                printf("ERROR: invalid performance mode %c\n", c);
                break;
        }
        return mode;
+5 −0
Original line number Diff line number Diff line
@@ -150,6 +150,11 @@ aaudio_result_t AudioStreamBuilder::build(AudioStream** streamPtr) {
        allowMMap = false;
    }

    if (!allowMMap && !allowLegacy) {
        ALOGE("%s() no backend available: neither MMAP nor legacy path are allowed", __func__);
        return AAUDIO_ERROR_ILLEGAL_ARGUMENT;
    }

    result = builder_createStream(getDirection(), sharingMode, allowMMap, &audioStream);
    if (result == AAUDIO_OK) {
        // Open the stream using the parameters from the builder.