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

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

Merge "aaudio: fix USAGE, INPUT_PRESET and CONTENT_TYPE"

parents aa506590 a62fb956
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -112,6 +112,10 @@ aaudio_result_t AudioStreamInternal::open(const AudioStreamBuilder &builder) {
    request.getConfiguration().setDirection(getDirection());
    request.getConfiguration().setSharingMode(getSharingMode());

    request.getConfiguration().setUsage(getUsage());
    request.getConfiguration().setContentType(getContentType());
    request.getConfiguration().setInputPreset(getInputPreset());

    request.getConfiguration().setBufferCapacity(builder.getBufferCapacity());

    mServiceStreamHandle = mServiceInterface.openStream(request, configurationOutput);
@@ -131,6 +135,10 @@ aaudio_result_t AudioStreamInternal::open(const AudioStreamBuilder &builder) {
    setDeviceId(configurationOutput.getDeviceId());
    setSharingMode(configurationOutput.getSharingMode());

    setUsage(configurationOutput.getUsage());
    setContentType(configurationOutput.getContentType());
    setInputPreset(configurationOutput.getInputPreset());

    // Save device format so we can do format conversion and volume scaling together.
    mDeviceFormat = configurationOutput.getFormat();

+2 −0
Original line number Diff line number Diff line
@@ -112,6 +112,8 @@ aaudio_result_t AudioStream::open(const AudioStreamBuilder& builder)
          mDeviceId, mPerformanceMode,
          (isDataCallbackSet() ? "ON" : "OFF"),
          mFramesPerDataCallback);
    ALOGI("open() usage = %d, contentType = %d, inputPreset = %d",
          mUsage, mContentType, mInputPreset);

    return AAUDIO_OK;
}
+22 −0
Original line number Diff line number Diff line
@@ -420,6 +420,7 @@ protected:

    /**
     * This should not be called after the open() call.
     * TODO for multiple setters: assert(mState == AAUDIO_STREAM_STATE_UNINITIALIZED)
     */
    void setSampleRate(int32_t sampleRate) {
        mSampleRate = sampleRate;
@@ -468,6 +469,27 @@ protected:
        return mPeriodNanoseconds.load(std::memory_order_acquire);
    }

    /**
     * This should not be called after the open() call.
     */
    void setUsage(aaudio_usage_t usage) {
        mUsage = usage;
    }

    /**
     * This should not be called after the open() call.
     */
    void setContentType(aaudio_content_type_t contentType) {
        mContentType = contentType;
    }

    /**
     * This should not be called after the open() call.
     */
    void setInputPreset(aaudio_input_preset_t inputPreset) {
        mInputPreset = inputPreset;
    }

private:

    std::mutex                 mStreamLock;
+6 −2
Original line number Diff line number Diff line
@@ -55,11 +55,15 @@ std::string AAudioServiceEndpoint::dump() const {

    result << "    Direction:            " << ((getDirection() == AAUDIO_DIRECTION_OUTPUT)
                                   ? "OUTPUT" : "INPUT") << "\n";
    result << "    Requested Device Id:  " << mRequestedDeviceId << "\n";
    result << "    Device Id:            " << getDeviceId() << "\n";
    result << "    Sample Rate:          " << getSampleRate() << "\n";
    result << "    Channel Count:        " << getSamplesPerFrame() << "\n";
    result << "    Frames Per Burst:     " << mFramesPerBurst << "\n";
    result << "    Usage:                " << getUsage() << "\n";
    result << "    ContentType:          " << getContentType() << "\n";
    result << "    InputPreset:          " << getInputPreset() << "\n";
    result << "    Reference Count:      " << mOpenCount << "\n";
    result << "    Requested Device Id:  " << mRequestedDeviceId << "\n";
    result << "    Device Id:            " << getDeviceId() << "\n";
    result << "    Connected:            " << mConnected.load() << "\n";
    result << "    Registered Streams:" << "\n";
    result << AAudioServiceStreamShared::dumpHeader() << "\n";
+3 −0
Original line number Diff line number Diff line
@@ -98,6 +98,9 @@ aaudio_result_t AAudioServiceEndpointMMAP::open(const aaudio::AAudioStreamReques
            .flags = AUDIO_FLAG_LOW_LATENCY,
            .tags = ""
    };
    ALOGV("open() MMAP attributes.usage = %d, content_type = %d, source = %d",
          attributes.usage, attributes.content_type, attributes.source);

    mMmapClient.clientUid = request.getUserId();
    mMmapClient.clientPid = request.getProcessId();
    mMmapClient.packageName.setTo(String16(""));
Loading