diff options
author | Haynes Mathew George <hgeorge@codeaurora.org> | 2014-10-13 13:05:22 -0700 |
---|---|---|
committer | Jean-Michel Trivi <jmtrivi@google.com> | 2014-10-15 16:42:11 -0700 |
commit | a2d4a6dac432f0c4f543d79b9a63c55ae91f81d6 (patch) | |
tree | 501b884b67bceb06a4d5ab01ecd519560fd14290 /services/audiopolicy | |
parent | 05c0d7d71be9578ad59d71f07f84e08c09e8d73a (diff) | |
download | frameworks_av-a2d4a6dac432f0c4f543d79b9a63c55ae91f81d6.zip frameworks_av-a2d4a6dac432f0c4f543d79b9a63c55ae91f81d6.tar.gz frameworks_av-a2d4a6dac432f0c4f543d79b9a63c55ae91f81d6.tar.bz2 |
audio policy: Fix for voice call audio loss
Audio Policy service filters out one of the create patch
commands when it finds two pending commands with the same
patch handles. Due to this routing command is not received
to audio HAL and the voice call set up fails.
Fix this by filtering create patch commands only when
they are issued on the same output.
authored-by: Karthik Reddy Katta <a_katta@codeaurora.org>
Bug: 17787282
Change-Id: If36f0ab71e9b72d6a8eb61d31f762bc5e1683b89
Diffstat (limited to 'services/audiopolicy')
-rw-r--r-- | services/audiopolicy/AudioPolicyService.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/services/audiopolicy/AudioPolicyService.cpp b/services/audiopolicy/AudioPolicyService.cpp index 06a7e84..dd4067f 100644 --- a/services/audiopolicy/AudioPolicyService.cpp +++ b/services/audiopolicy/AudioPolicyService.cpp @@ -839,18 +839,38 @@ void AudioPolicyService::AudioCommandThread::insertCommand_l(sp<AudioCommand>& c case CREATE_AUDIO_PATCH: case RELEASE_AUDIO_PATCH: { audio_patch_handle_t handle; + struct audio_patch patch; if (command->mCommand == CREATE_AUDIO_PATCH) { handle = ((CreateAudioPatchData *)command->mParam.get())->mHandle; + patch = ((CreateAudioPatchData *)command->mParam.get())->mPatch; } else { handle = ((ReleaseAudioPatchData *)command->mParam.get())->mHandle; } audio_patch_handle_t handle2; + struct audio_patch patch2; if (command2->mCommand == CREATE_AUDIO_PATCH) { handle2 = ((CreateAudioPatchData *)command2->mParam.get())->mHandle; + patch2 = ((CreateAudioPatchData *)command2->mParam.get())->mPatch; } else { handle2 = ((ReleaseAudioPatchData *)command2->mParam.get())->mHandle; } if (handle != handle2) break; + /* Filter CREATE_AUDIO_PATCH commands only when they are issued for + same output. */ + if( (command->mCommand == CREATE_AUDIO_PATCH) && + (command2->mCommand == CREATE_AUDIO_PATCH) ) { + bool isOutputDiff = false; + if (patch.num_sources == patch2.num_sources) { + for (unsigned count = 0; count < patch.num_sources; count++) { + if (patch.sources[count].id != patch2.sources[count].id) { + isOutputDiff = true; + break; + } + } + if (isOutputDiff) + break; + } + } ALOGV("Filtering out %s audio patch command for handle %d", (command->mCommand == CREATE_AUDIO_PATCH) ? "create" : "release", handle); removedCommands.add(command2); |