diff options
author | Eric Laurent <elaurent@google.com> | 2010-09-27 08:48:40 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-09-27 08:48:40 -0700 |
commit | c425ffbfdca80c663b16a875228c15a1147a75f4 (patch) | |
tree | 98e05d9e0bcf0b7089cf60092dcfb5c7f21e9fa8 /media/libmedia | |
parent | 9b4e14edf6c20bcb5830b692121042cccffedfe6 (diff) | |
parent | da4b9bdd4682fb3a20964908cb18d02c943b7f35 (diff) | |
download | frameworks_av-c425ffbfdca80c663b16a875228c15a1147a75f4.zip frameworks_av-c425ffbfdca80c663b16a875228c15a1147a75f4.tar.gz frameworks_av-c425ffbfdca80c663b16a875228c15a1147a75f4.tar.bz2 |
am 1b37df95: am 9627847d: Merge "Fix error in AudioEffect command status reporting." into gingerbread
Merge commit '1b37df95ec9d03aaa5f4055c6cd86db42f9c9727'
* commit '1b37df95ec9d03aaa5f4055c6cd86db42f9c9727':
Fix error in AudioEffect command status reporting.
Diffstat (limited to 'media/libmedia')
-rw-r--r-- | media/libmedia/AudioEffect.cpp | 26 | ||||
-rw-r--r-- | media/libmedia/Visualizer.cpp | 6 |
2 files changed, 21 insertions, 11 deletions
diff --git a/media/libmedia/AudioEffect.cpp b/media/libmedia/AudioEffect.cpp index 0f3e245..88b8c86 100644 --- a/media/libmedia/AudioEffect.cpp +++ b/media/libmedia/AudioEffect.cpp @@ -228,24 +228,32 @@ status_t AudioEffect::command(uint32_t cmdCode, void *replyData) { if (mStatus != NO_ERROR && mStatus != ALREADY_EXISTS) { + LOGV("command() bad status %d", mStatus); return INVALID_OPERATION; } - 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) && + (replySize == NULL || *replySize != sizeof(status_t) || replyData == NULL)) { + return BAD_VALUE; } - status = *(status_t *)replyData; + + status_t status = mIEffect->command(cmdCode, cmdSize, cmdData, replySize, replyData); if (status != NO_ERROR) { return status; } - if (cmdCode == EFFECT_CMD_ENABLE) { - android_atomic_or(1, &mEnabled); - } - if (cmdCode == EFFECT_CMD_DISABLE) { - android_atomic_and(~1, &mEnabled); + if (cmdCode == EFFECT_CMD_ENABLE || cmdCode == EFFECT_CMD_DISABLE) { + 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); + } } + return status; } diff --git a/media/libmedia/Visualizer.cpp b/media/libmedia/Visualizer.cpp index 39552b6..68f2e9b 100644 --- a/media/libmedia/Visualizer.cpp +++ b/media/libmedia/Visualizer.cpp @@ -169,11 +169,13 @@ status_t Visualizer::getWaveForm(uint8_t *waveform) status_t status = NO_ERROR; if (mEnabled) { uint32_t replySize = mCaptureSize; - status_t status = command(VISU_CMD_CAPTURE, 0, NULL, &replySize, waveform); + status = command(VISU_CMD_CAPTURE, 0, NULL, &replySize, waveform); + LOGV("getWaveForm() command returned %d", status); if (replySize == 0) { status = NOT_ENOUGH_DATA; } } else { + LOGV("getWaveForm() disabled"); memset(waveform, 0x80, mCaptureSize); } return status; @@ -191,7 +193,7 @@ status_t Visualizer::getFft(uint8_t *fft) status_t status = NO_ERROR; if (mEnabled) { uint8_t buf[mCaptureSize]; - status_t status = getWaveForm(buf); + status = getWaveForm(buf); if (status == NO_ERROR) { status = doFft(fft, buf); } |