Loading include/media/AudioEffect.h +2 −1 Original line number Diff line number Diff line Loading @@ -403,7 +403,7 @@ public: static status_t guidToString(const effect_uuid_t *guid, char *str, size_t maxLen); protected: volatile int32_t mEnabled; // enable state bool mEnabled; // enable state int32_t mSessionId; // audio session ID int32_t mPriority; // priority for effect control status_t mStatus; // effect status Loading @@ -412,6 +412,7 @@ protected: void* mUserData; // client context for callback function effect_descriptor_t mDescriptor; // effect descriptor int32_t mId; // system wide unique effect engine instance ID Mutex mLock; // Mutex for mEnabled access private: Loading include/media/AudioRecord.h +1 −1 Original line number Diff line number Diff line Loading @@ -356,7 +356,7 @@ private: sp<IAudioRecord> mAudioRecord; sp<IMemory> mCblkMemory; sp<ClientRecordThread> mClientRecordThread; Mutex mRecordThreadLock; Mutex mLock; uint32_t mFrameCount; Loading include/media/AudioTrack.h +1 −0 Original line number Diff line number Diff line Loading @@ -480,6 +480,7 @@ private: uint32_t mFlags; int mSessionId; int mAuxEffectId; Mutex mLock; }; Loading media/jni/soundpool/SoundPool.h +0 −1 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ #include <utils/Vector.h> #include <utils/KeyedVector.h> #include <media/AudioTrack.h> #include <cutils/atomic.h> namespace android { Loading media/libmedia/AudioEffect.cpp +27 −28 Original line number Diff line number Diff line Loading @@ -27,7 +27,6 @@ #include <media/AudioEffect.h> #include <utils/Log.h> #include <cutils/atomic.h> #include <binder/IPCThreadState.h> Loading Loading @@ -207,18 +206,22 @@ status_t AudioEffect::setEnabled(bool enabled) return INVALID_OPERATION; } status_t status = NO_ERROR; AutoMutex lock(mLock); if (enabled != mEnabled) { if (enabled) { LOGV("enable %p", this); if (android_atomic_or(1, &mEnabled) == 0) { return mIEffect->enable(); } status = mIEffect->enable(); } else { LOGV("disable %p", this); if (android_atomic_and(~1, &mEnabled) == 1) { return mIEffect->disable(); status = mIEffect->disable(); } if (status == NO_ERROR) { mEnabled = enabled; } return NO_ERROR; } return status; } status_t AudioEffect::command(uint32_t cmdCode, Loading @@ -232,26 +235,26 @@ status_t AudioEffect::command(uint32_t cmdCode, return INVALID_OPERATION; } if ((cmdCode == EFFECT_CMD_ENABLE || cmdCode == EFFECT_CMD_DISABLE) && (replySize == NULL || *replySize != sizeof(status_t) || replyData == NULL)) { if (cmdCode == EFFECT_CMD_ENABLE || cmdCode == EFFECT_CMD_DISABLE) { if (mEnabled == (cmdCode == EFFECT_CMD_ENABLE)) { return NO_ERROR; } if (replySize == NULL || *replySize != sizeof(status_t) || replyData == NULL) { return BAD_VALUE; } mLock.lock(); } status_t status = mIEffect->command(cmdCode, cmdSize, cmdData, replySize, replyData); if (status != NO_ERROR) { return status; } if (cmdCode == EFFECT_CMD_ENABLE || cmdCode == EFFECT_CMD_DISABLE) { if (status == NO_ERROR) { status = *(status_t *)replyData; if (status != NO_ERROR) { return status; } if (cmdCode == EFFECT_CMD_ENABLE) { android_atomic_or(1, &mEnabled); } else { android_atomic_and(~1, &mEnabled); if (status == NO_ERROR) { mEnabled = (cmdCode == EFFECT_CMD_ENABLE); } mLock.unlock(); } return status; Loading Loading @@ -370,11 +373,7 @@ void AudioEffect::enableStatusChanged(bool enabled) { LOGV("enableStatusChanged %p enabled %d mCbf %p", this, enabled, mCbf); if (mStatus == ALREADY_EXISTS) { if (enabled) { android_atomic_or(1, &mEnabled); } else { android_atomic_and(~1, &mEnabled); } mEnabled = enabled; if (mCbf) { mCbf(EVENT_ENABLE_STATUS_CHANGED, mUserData, &enabled); } Loading Loading
include/media/AudioEffect.h +2 −1 Original line number Diff line number Diff line Loading @@ -403,7 +403,7 @@ public: static status_t guidToString(const effect_uuid_t *guid, char *str, size_t maxLen); protected: volatile int32_t mEnabled; // enable state bool mEnabled; // enable state int32_t mSessionId; // audio session ID int32_t mPriority; // priority for effect control status_t mStatus; // effect status Loading @@ -412,6 +412,7 @@ protected: void* mUserData; // client context for callback function effect_descriptor_t mDescriptor; // effect descriptor int32_t mId; // system wide unique effect engine instance ID Mutex mLock; // Mutex for mEnabled access private: Loading
include/media/AudioRecord.h +1 −1 Original line number Diff line number Diff line Loading @@ -356,7 +356,7 @@ private: sp<IAudioRecord> mAudioRecord; sp<IMemory> mCblkMemory; sp<ClientRecordThread> mClientRecordThread; Mutex mRecordThreadLock; Mutex mLock; uint32_t mFrameCount; Loading
include/media/AudioTrack.h +1 −0 Original line number Diff line number Diff line Loading @@ -480,6 +480,7 @@ private: uint32_t mFlags; int mSessionId; int mAuxEffectId; Mutex mLock; }; Loading
media/jni/soundpool/SoundPool.h +0 −1 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ #include <utils/Vector.h> #include <utils/KeyedVector.h> #include <media/AudioTrack.h> #include <cutils/atomic.h> namespace android { Loading
media/libmedia/AudioEffect.cpp +27 −28 Original line number Diff line number Diff line Loading @@ -27,7 +27,6 @@ #include <media/AudioEffect.h> #include <utils/Log.h> #include <cutils/atomic.h> #include <binder/IPCThreadState.h> Loading Loading @@ -207,18 +206,22 @@ status_t AudioEffect::setEnabled(bool enabled) return INVALID_OPERATION; } status_t status = NO_ERROR; AutoMutex lock(mLock); if (enabled != mEnabled) { if (enabled) { LOGV("enable %p", this); if (android_atomic_or(1, &mEnabled) == 0) { return mIEffect->enable(); } status = mIEffect->enable(); } else { LOGV("disable %p", this); if (android_atomic_and(~1, &mEnabled) == 1) { return mIEffect->disable(); status = mIEffect->disable(); } if (status == NO_ERROR) { mEnabled = enabled; } return NO_ERROR; } return status; } status_t AudioEffect::command(uint32_t cmdCode, Loading @@ -232,26 +235,26 @@ status_t AudioEffect::command(uint32_t cmdCode, return INVALID_OPERATION; } if ((cmdCode == EFFECT_CMD_ENABLE || cmdCode == EFFECT_CMD_DISABLE) && (replySize == NULL || *replySize != sizeof(status_t) || replyData == NULL)) { if (cmdCode == EFFECT_CMD_ENABLE || cmdCode == EFFECT_CMD_DISABLE) { if (mEnabled == (cmdCode == EFFECT_CMD_ENABLE)) { return NO_ERROR; } if (replySize == NULL || *replySize != sizeof(status_t) || replyData == NULL) { return BAD_VALUE; } mLock.lock(); } status_t status = mIEffect->command(cmdCode, cmdSize, cmdData, replySize, replyData); if (status != NO_ERROR) { return status; } if (cmdCode == EFFECT_CMD_ENABLE || cmdCode == EFFECT_CMD_DISABLE) { if (status == NO_ERROR) { status = *(status_t *)replyData; if (status != NO_ERROR) { return status; } if (cmdCode == EFFECT_CMD_ENABLE) { android_atomic_or(1, &mEnabled); } else { android_atomic_and(~1, &mEnabled); if (status == NO_ERROR) { mEnabled = (cmdCode == EFFECT_CMD_ENABLE); } mLock.unlock(); } return status; Loading Loading @@ -370,11 +373,7 @@ void AudioEffect::enableStatusChanged(bool enabled) { LOGV("enableStatusChanged %p enabled %d mCbf %p", this, enabled, mCbf); if (mStatus == ALREADY_EXISTS) { if (enabled) { android_atomic_or(1, &mEnabled); } else { android_atomic_and(~1, &mEnabled); } mEnabled = enabled; if (mCbf) { mCbf(EVENT_ENABLE_STATUS_CHANGED, mUserData, &enabled); } Loading