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

Commit c8fc4803 authored by Eric Laurent's avatar Eric Laurent Committed by Android (Google) Code Review
Browse files

Merge "audiopolicy: Synchronize calls to Effects state" into nyc-dev

parents f214d693 bab7bf46
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -482,6 +482,7 @@ status_t AudioPolicyService::registerEffect(const effect_descriptor_t *desc,
    if (mAudioPolicyManager == NULL) {
        return NO_INIT;
    }
    Mutex::Autolock _l(mEffectsLock);
    return mAudioPolicyManager->registerEffect(desc, io, strategy, session, id);
}

@@ -490,6 +491,7 @@ status_t AudioPolicyService::unregisterEffect(int id)
    if (mAudioPolicyManager == NULL) {
        return NO_INIT;
    }
    Mutex::Autolock _l(mEffectsLock);
    return mAudioPolicyManager->unregisterEffect(id);
}

@@ -498,6 +500,7 @@ status_t AudioPolicyService::setEffectEnabled(int id, bool enabled)
    if (mAudioPolicyManager == NULL) {
        return NO_INIT;
    }
    Mutex::Autolock _l(mEffectsLock);
    return mAudioPolicyManager->setEffectEnabled(id, enabled);
}

@@ -561,6 +564,8 @@ bool AudioPolicyService::isOffloadSupported(const audio_offload_info_t& info)
        return false;
    }
    Mutex::Autolock _l(mLock);
    Mutex::Autolock _le(mEffectsLock); // isOffloadSupported queries for
                                      // non-offloadable effects
    return mAudioPolicyManager->isOffloadSupported(info);
}

+4 −0
Original line number Diff line number Diff line
@@ -553,6 +553,10 @@ private:

    mutable Mutex mLock;    // prevents concurrent access to AudioPolicy manager functions changing
                            // device connection state  or routing
    mutable Mutex mEffectsLock; // serialize access to Effect state within APM.
    // Note: lock acquisition order is always mLock > mEffectsLock:
    // mLock protects AudioPolicyManager methods that can call into audio flinger
    // and possibly back in to audio policy service and acquire mEffectsLock.
    sp<AudioCommandThread> mAudioCommandThread;     // audio commands thread
    sp<AudioCommandThread> mTonePlaybackThread;     // tone playback thread
    sp<AudioCommandThread> mOutputCommandThread;    // process stop and release output