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

Commit 8e365d8f authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "AAudio: Use one SRC per shared stream." into main

parents 468d4431 5fbadc89
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -75,6 +75,9 @@ aaudio_result_t AAudioServiceEndpointShared::open(const aaudio::AAudioStreamRequ

    builder.setBufferCapacity(DEFAULT_BUFFER_CAPACITY);

    // Each shared stream will use its own SRC.
    builder.setSampleRate(AAUDIO_UNSPECIFIED);

    result = mStreamInternal->open(builder);

    setSampleRate(mStreamInternal->getSampleRate());
+3 −10
Original line number Diff line number Diff line
@@ -144,6 +144,9 @@ aaudio_result_t AAudioServiceStreamShared::open(const aaudio::AAudioStreamReques
        goto error;
    }

    // Use the sample rate of the endpoint as each shared stream should use its own SRC.
    setSampleRate(endpoint->getSampleRate());

    // Is the request compatible with the shared endpoint?
    setFormat(configurationInput.getFormat());
    if (getFormat() == AUDIO_FORMAT_DEFAULT) {
@@ -154,16 +157,6 @@ aaudio_result_t AAudioServiceStreamShared::open(const aaudio::AAudioStreamReques
        goto error;
    }

    setSampleRate(configurationInput.getSampleRate());
    if (getSampleRate() == AAUDIO_UNSPECIFIED) {
        setSampleRate(endpoint->getSampleRate());
    } else if (getSampleRate() != endpoint->getSampleRate()) {
        ALOGD("%s() mSampleRate = %d, need %d",
              __func__, getSampleRate(), endpoint->getSampleRate());
        result = AAUDIO_ERROR_INVALID_RATE;
        goto error;
    }

    setChannelMask(configurationInput.getChannelMask());
    if (getChannelMask() == AAUDIO_UNSPECIFIED) {
        setChannelMask(endpoint->getChannelMask());