am 9627847d
: Merge "Fix error in AudioEffect command status reporting." into gingerbread
Merge commit '9627847d588cd969f60dcc79d165209184a90069' into gingerbread-plus-aosp * commit '9627847d588cd969f60dcc79d165209184a90069': Fix error in AudioEffect command status reporting.
This commit is contained in:
@ -65,8 +65,8 @@ void Visualizer_reset(VisualizerContext *pContext)
|
||||
{
|
||||
pContext->mCaptureIdx = 0;
|
||||
pContext->mCurrentBuf = 0;
|
||||
memset(pContext->mCaptureBuf[0], 0, VISUALIZER_CAPTURE_SIZE_MAX);
|
||||
memset(pContext->mCaptureBuf[1], 0, VISUALIZER_CAPTURE_SIZE_MAX);
|
||||
memset(pContext->mCaptureBuf[0], 0x80, VISUALIZER_CAPTURE_SIZE_MAX);
|
||||
memset(pContext->mCaptureBuf[1], 0x80, VISUALIZER_CAPTURE_SIZE_MAX);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
if ((cmdCode == EFFECT_CMD_ENABLE || cmdCode == EFFECT_CMD_DISABLE) &&
|
||||
(replySize == NULL || *replySize != sizeof(status_t) || replyData == NULL)) {
|
||||
return BAD_VALUE;
|
||||
}
|
||||
|
||||
status_t status = mIEffect->command(cmdCode, cmdSize, cmdData, replySize, replyData);
|
||||
if (status != NO_ERROR) {
|
||||
return status;
|
||||
}
|
||||
status = *(status_t *)replyData;
|
||||
if (status != NO_ERROR) {
|
||||
return status;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
if (cmdCode == EFFECT_CMD_ENABLE) {
|
||||
android_atomic_or(1, &mEnabled);
|
||||
}
|
||||
if (cmdCode == EFFECT_CMD_DISABLE) {
|
||||
android_atomic_and(~1, &mEnabled);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user