am 880dfe4f: Merge "Fix issue 3007862" into gingerbread
Merge commit '880dfe4f675128188f8d598f2025a417ccabd1bf' into gingerbread-plus-aosp * commit '880dfe4f675128188f8d598f2025a417ccabd1bf': Fix issue 3007862
This commit is contained in:
@@ -4653,9 +4653,6 @@ sp<IEffect> AudioFlinger::createEffect(pid_t pid,
|
|||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
|
||||||
Mutex::Autolock _l(mLock);
|
|
||||||
|
|
||||||
// check audio settings permission for global effects
|
// check audio settings permission for global effects
|
||||||
if (sessionId == AudioSystem::SESSION_OUTPUT_MIX && !settingsAllowed()) {
|
if (sessionId == AudioSystem::SESSION_OUTPUT_MIX && !settingsAllowed()) {
|
||||||
lStatus = PERMISSION_DENIED;
|
lStatus = PERMISSION_DENIED;
|
||||||
@@ -4677,6 +4674,24 @@ sp<IEffect> AudioFlinger::createEffect(pid_t pid,
|
|||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (output == 0) {
|
||||||
|
if (sessionId == AudioSystem::SESSION_OUTPUT_STAGE) {
|
||||||
|
// output must be specified by AudioPolicyManager when using session
|
||||||
|
// AudioSystem::SESSION_OUTPUT_STAGE
|
||||||
|
lStatus = BAD_VALUE;
|
||||||
|
goto Exit;
|
||||||
|
} else if (sessionId == AudioSystem::SESSION_OUTPUT_MIX) {
|
||||||
|
// if the output returned by getOutputForEffect() is removed before we lock the
|
||||||
|
// mutex below, the call to checkPlaybackThread_l(output) below will detect it
|
||||||
|
// and we will exit safely
|
||||||
|
output = AudioSystem::getOutputForEffect(&desc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
Mutex::Autolock _l(mLock);
|
||||||
|
|
||||||
|
|
||||||
if (!EffectIsNullUuid(&pDesc->uuid)) {
|
if (!EffectIsNullUuid(&pDesc->uuid)) {
|
||||||
// if uuid is specified, request effect descriptor
|
// if uuid is specified, request effect descriptor
|
||||||
lStatus = EffectGetDescriptor(&pDesc->uuid, &desc);
|
lStatus = EffectGetDescriptor(&pDesc->uuid, &desc);
|
||||||
@@ -4744,17 +4759,9 @@ sp<IEffect> AudioFlinger::createEffect(pid_t pid,
|
|||||||
|
|
||||||
// If output is not specified try to find a matching audio session ID in one of the
|
// If output is not specified try to find a matching audio session ID in one of the
|
||||||
// output threads.
|
// output threads.
|
||||||
// TODO: allow attachment of effect to inputs
|
// If output is 0 here, sessionId is neither SESSION_OUTPUT_STAGE nor SESSION_OUTPUT_MIX
|
||||||
|
// because of code checking output when entering the function.
|
||||||
if (output == 0) {
|
if (output == 0) {
|
||||||
if (sessionId == AudioSystem::SESSION_OUTPUT_STAGE) {
|
|
||||||
// output must be specified by AudioPolicyManager when using session
|
|
||||||
// AudioSystem::SESSION_OUTPUT_STAGE
|
|
||||||
lStatus = BAD_VALUE;
|
|
||||||
goto Exit;
|
|
||||||
} else if (sessionId == AudioSystem::SESSION_OUTPUT_MIX) {
|
|
||||||
output = AudioSystem::getOutputForEffect(&desc);
|
|
||||||
LOGV("createEffect() got output %d for effect %s", output, desc.name);
|
|
||||||
} else {
|
|
||||||
// look for the thread where the specified audio session is present
|
// look for the thread where the specified audio session is present
|
||||||
for (size_t i = 0; i < mPlaybackThreads.size(); i++) {
|
for (size_t i = 0; i < mPlaybackThreads.size(); i++) {
|
||||||
if (mPlaybackThreads.valueAt(i)->hasAudioSession(sessionId) != 0) {
|
if (mPlaybackThreads.valueAt(i)->hasAudioSession(sessionId) != 0) {
|
||||||
@@ -4769,7 +4776,7 @@ sp<IEffect> AudioFlinger::createEffect(pid_t pid,
|
|||||||
output = mPlaybackThreads.keyAt(0);
|
output = mPlaybackThreads.keyAt(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
LOGV("createEffect() got output %d for effect %s", output, desc.name);
|
||||||
PlaybackThread *thread = checkPlaybackThread_l(output);
|
PlaybackThread *thread = checkPlaybackThread_l(output);
|
||||||
if (thread == NULL) {
|
if (thread == NULL) {
|
||||||
LOGE("createEffect() unknown output thread");
|
LOGE("createEffect() unknown output thread");
|
||||||
@@ -4777,6 +4784,8 @@ sp<IEffect> AudioFlinger::createEffect(pid_t pid,
|
|||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: allow attachment of effect to inputs
|
||||||
|
|
||||||
wclient = mClients.valueFor(pid);
|
wclient = mClients.valueFor(pid);
|
||||||
|
|
||||||
if (wclient != NULL) {
|
if (wclient != NULL) {
|
||||||
|
|||||||
Reference in New Issue
Block a user