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

Commit 1645fc48 authored by Robert Wu's avatar Robert Wu Committed by Android (Google) Code Review
Browse files

Merge "aaudio: clean up MMAP volume TODO"

parents 7594a8de 4389ae64
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -37,12 +37,9 @@ class MmapStreamCallback : public virtual RefBase {

    /**
     * The volume to be applied to the use case specified when opening the stream has changed
     * \param[in] channels a channel mask containing all channels the volume should be applied to.
     * \param[in] values the volume values to be applied to each channel. The size of the vector
     *                   should correspond to the channel count retrieved with
     *                   audio_channel_count_from_in_mask() or audio_channel_count_from_out_mask()
     * \param[in] volume the new target volume
     */
    virtual void onVolumeChanged(audio_channel_mask_t channels, Vector<float> values) = 0;
    virtual void onVolumeChanged(float volume) = 0;

    /**
     * The device the stream is routed to/from has changed
+1 −11
Original line number Diff line number Diff line
@@ -10218,20 +10218,10 @@ void AudioFlinger::MmapPlaybackThread::processVolume_l()
        } else {
            sp<MmapStreamCallback> callback = mCallback.promote();
            if (callback != 0) {
                int channelCount;
                if (isOutput()) {
                    channelCount = audio_channel_count_from_out_mask(mChannelMask);
                } else {
                    channelCount = audio_channel_count_from_in_mask(mChannelMask);
                }
                Vector<float> values;
                for (int i = 0; i < channelCount; i++) {
                    values.add(volume);
                }
                mHalVolFloat = volume; // SW volume control worked, so update value.
                mNoCallbackWarningCount = 0;
                mLock.unlock();
                callback->onVolumeChanged(mChannelMask, values);
                callback->onVolumeChanged(volume);
                mLock.lock();
            } else {
                if (mNoCallbackWarningCount < kMaxNoCallbackWarnings) {
+2 −6
Original line number Diff line number Diff line
@@ -362,12 +362,8 @@ void AAudioServiceEndpointMMAP::onTearDown(audio_port_handle_t portHandle) {
    asyncTask.detach();
}

void AAudioServiceEndpointMMAP::onVolumeChanged(audio_channel_mask_t channels,
                                              android::Vector<float> values) {
    // TODO Do we really need a different volume for each channel?
    // We get called with an array filled with a single value!
    float volume = values[0];
    ALOGD("%s() volume[0] = %f", __func__, volume);
void AAudioServiceEndpointMMAP::onVolumeChanged(float volume) {
    ALOGD("%s() volume = %f", __func__, volume);
    std::lock_guard<std::mutex> lock(mLockStreams);
    for(const auto& stream : mRegisteredStreams) {
        stream->onVolumeChanged(volume);
+1 −2
Original line number Diff line number Diff line
@@ -77,8 +77,7 @@ public:
    // -------------- Callback functions for MmapStreamCallback ---------------------
    void onTearDown(audio_port_handle_t portHandle) override;

    void onVolumeChanged(audio_channel_mask_t channels,
                         android::Vector<float> values) override;
    void onVolumeChanged(float volume) override;

    void onRoutingChanged(audio_port_handle_t portHandle) override;
    // ------------------------------------------------------------------------------