diff options
Diffstat (limited to 'services/audiopolicy/service/AudioPolicyService.cpp')
-rw-r--r-- | services/audiopolicy/service/AudioPolicyService.cpp | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/services/audiopolicy/service/AudioPolicyService.cpp b/services/audiopolicy/service/AudioPolicyService.cpp index c77cc45..12cca65 100644 --- a/services/audiopolicy/service/AudioPolicyService.cpp +++ b/services/audiopolicy/service/AudioPolicyService.cpp @@ -478,6 +478,19 @@ bool AudioPolicyService::AudioCommandThread::threadLoop() data->mVolume); command->mStatus = AudioSystem::setVoiceVolume(data->mVolume); }break; + case START_OUTPUT: { + StartOutputData *data = (StartOutputData *)command->mParam.get(); + ALOGV("AudioCommandThread() processing start output %d", + data->mIO); + svc = mService.promote(); + if (svc == 0) { + command->mStatus = UNKNOWN_ERROR; + break; + } + mLock.unlock(); + command->mStatus = svc->doStartOutput(data->mIO, data->mStream, data->mSession); + mLock.lock(); + }break; case STOP_OUTPUT: { StopOutputData *data = (StopOutputData *)command->mParam.get(); ALOGV("AudioCommandThread() processing stop output %d", @@ -714,6 +727,22 @@ status_t AudioPolicyService::AudioCommandThread::voiceVolumeCommand(float volume return sendCommand(command, delayMs); } +status_t AudioPolicyService::AudioCommandThread::startOutputCommand(audio_io_handle_t output, + audio_stream_type_t stream, + audio_session_t session) +{ + sp<AudioCommand> command = new AudioCommand(); + command->mCommand = START_OUTPUT; + sp<StartOutputData> data = new StartOutputData(); + data->mIO = output; + data->mStream = stream; + data->mSession = session; + command->mParam = data; + command->mWaitStatus = true; + ALOGV("AudioCommandThread() adding start output %d", output); + return sendCommand(command); +} + void AudioPolicyService::AudioCommandThread::stopOutputCommand(audio_io_handle_t output, audio_stream_type_t stream, audio_session_t session) @@ -899,10 +928,12 @@ void AudioPolicyService::AudioCommandThread::insertCommand_l(sp<AudioCommand>& c } else { data2->mKeyValuePairs = param2.toString(); } - command->mTime = command2->mTime; - // force delayMs to non 0 so that code below does not request to wait for - // command status as the command is now delayed - delayMs = 1; + if (!data2->mKeyValuePairs.compare(data->mKeyValuePairs)) { + command->mTime = command2->mTime; + // force delayMs to non 0 so that code below does not request to wait for + // command status as the command is now delayed + delayMs = 1; + } } break; case SET_VOLUME: { |