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

Commit 1b29d704 authored by Vlad Popa's avatar Vlad Popa
Browse files

Set the piid for legacy aaudio streams.

The playback mute notifications need the method AudioTrack#setPlayerIId to be called. This enables it to send the mapping between portId and piid to the AudioService. Therefore, as a side effect this change will enable the playback mute notifications for the legacy aaudio streams.

Test: dumpsys audio
Bug: 235521198
Change-Id: Idd25d5c05b1eda9077ef6f1327ce41b720e1513a
parent ed977f7f
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -410,7 +410,7 @@ public:
     * This should only be called for client streams and not for streams
     * that run in the service.
     */
    void registerPlayerBase() {
    virtual void registerPlayerBase() {
        if (getDirection() == AAUDIO_DIRECTION_OUTPUT) {
            mPlayerBase->registerWithAudioManager(this);
        }
@@ -664,6 +664,8 @@ protected:

    std::mutex                 mStreamLock;

    const android::sp<MyPlayerBase>   mPlayerBase;

private:

    aaudio_result_t safeStop_l() REQUIRES(mStreamLock);
@@ -679,8 +681,6 @@ private:
        close_l();
    }

    const android::sp<MyPlayerBase>   mPlayerBase;

    std::atomic<aaudio_stream_state_t>          mState{AAUDIO_STREAM_STATE_UNINITIALIZED};

    // These do not change after open().
+10 −0
Original line number Diff line number Diff line
@@ -552,6 +552,16 @@ status_t AudioStreamTrack::doSetVolume() {
    return status;
}

void AudioStreamTrack::registerPlayerBase() {
    AudioStream::registerPlayerBase();

    if (mAudioTrack == nullptr) {
        ALOGW("%s: cannot set piid, AudioTrack is null", __func__);
        return;
    }
    mAudioTrack->setPlayerIId(mPlayerBase->getPlayerIId());
}

#if AAUDIO_USE_VOLUME_SHAPER

using namespace android::media::VolumeShaper;
+2 −0
Original line number Diff line number Diff line
@@ -87,6 +87,8 @@ public:

    android::status_t doSetVolume() override;

    void registerPlayerBase() override;

#if AAUDIO_USE_VOLUME_SHAPER
    virtual android::binder::Status applyVolumeShaper(
            const android::media::VolumeShaper::Configuration& configuration,