diff options
Diffstat (limited to 'services/audioflinger/AudioPolicyService.cpp')
| -rw-r--r-- | services/audioflinger/AudioPolicyService.cpp | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/services/audioflinger/AudioPolicyService.cpp b/services/audioflinger/AudioPolicyService.cpp index 0d13970..f07fe8e 100644 --- a/services/audioflinger/AudioPolicyService.cpp +++ b/services/audioflinger/AudioPolicyService.cpp @@ -223,7 +223,7 @@ audio_policy_forced_cfg_t AudioPolicyService::getForceUse(audio_policy_force_use audio_io_handle_t AudioPolicyService::getOutput(audio_stream_type_t stream, uint32_t samplingRate, audio_format_t format, - uint32_t channels, + audio_channel_mask_t channelMask, audio_output_flags_t flags) { if (mpAudioPolicy == NULL) { @@ -231,7 +231,7 @@ audio_io_handle_t AudioPolicyService::getOutput(audio_stream_type_t stream, } ALOGV("getOutput() tid %d", gettid()); Mutex::Autolock _l(mLock); - return mpAudioPolicy->get_output(mpAudioPolicy, stream, samplingRate, format, channels, flags); + return mpAudioPolicy->get_output(mpAudioPolicy, stream, samplingRate, format, channelMask, flags); } status_t AudioPolicyService::startOutput(audio_io_handle_t output, @@ -271,8 +271,7 @@ void AudioPolicyService::releaseOutput(audio_io_handle_t output) audio_io_handle_t AudioPolicyService::getInput(audio_source_t inputSource, uint32_t samplingRate, audio_format_t format, - uint32_t channels, - audio_in_acoustics_t acoustics, + audio_channel_mask_t channelMask, int audioSession) { if (mpAudioPolicy == NULL) { @@ -283,8 +282,9 @@ audio_io_handle_t AudioPolicyService::getInput(audio_source_t inputSource, return 0; } Mutex::Autolock _l(mLock); + // the audio_in_acoustics_t parameter is ignored by get_input() audio_io_handle_t input = mpAudioPolicy->get_input(mpAudioPolicy, inputSource, samplingRate, - format, channels, acoustics); + format, channelMask, (audio_in_acoustics_t) 0); if (input == 0) { return input; @@ -373,6 +373,7 @@ status_t AudioPolicyService::initStreamVolume(audio_stream_type_t stream, if (uint32_t(stream) >= AUDIO_STREAM_CNT) { return BAD_VALUE; } + Mutex::Autolock _l(mLock); mpAudioPolicy->init_stream_volume(mpAudioPolicy, stream, indexMin, indexMax); return NO_ERROR; } @@ -390,7 +391,7 @@ status_t AudioPolicyService::setStreamVolumeIndex(audio_stream_type_t stream, if (uint32_t(stream) >= AUDIO_STREAM_CNT) { return BAD_VALUE; } - + Mutex::Autolock _l(mLock); if (mpAudioPolicy->set_stream_volume_index_for_device) { return mpAudioPolicy->set_stream_volume_index_for_device(mpAudioPolicy, stream, @@ -411,6 +412,7 @@ status_t AudioPolicyService::getStreamVolumeIndex(audio_stream_type_t stream, if (uint32_t(stream) >= AUDIO_STREAM_CNT) { return BAD_VALUE; } + Mutex::Autolock _l(mLock); if (mpAudioPolicy->get_stream_volume_index_for_device) { return mpAudioPolicy->get_stream_volume_index_for_device(mpAudioPolicy, stream, @@ -778,7 +780,6 @@ void AudioPolicyService::AudioCommandThread::startToneCommand(ToneGenerator::ton data->mType = type; data->mStream = stream; command->mParam = (void *)data; - command->mWaitStatus = false; Mutex::Autolock _l(mLock); insertCommand_l(command); ALOGV("AudioCommandThread() adding tone start type %d, stream %d", type, stream); @@ -790,7 +791,6 @@ void AudioPolicyService::AudioCommandThread::stopToneCommand() AudioCommand *command = new AudioCommand(); command->mCommand = STOP_TONE; command->mParam = NULL; - command->mWaitStatus = false; Mutex::Autolock _l(mLock); insertCommand_l(command); ALOGV("AudioCommandThread() adding tone stop"); @@ -811,11 +811,6 @@ status_t AudioPolicyService::AudioCommandThread::volumeCommand(audio_stream_type data->mVolume = volume; data->mIO = output; command->mParam = data; - if (delayMs == 0) { - command->mWaitStatus = true; - } else { - command->mWaitStatus = false; - } Mutex::Autolock _l(mLock); insertCommand_l(command, delayMs); ALOGV("AudioCommandThread() adding set volume stream %d, volume %f, output %d", @@ -841,11 +836,6 @@ status_t AudioPolicyService::AudioCommandThread::parametersCommand(audio_io_hand data->mIO = ioHandle; data->mKeyValuePairs = String8(keyValuePairs); command->mParam = data; - if (delayMs == 0) { - command->mWaitStatus = true; - } else { - command->mWaitStatus = false; - } Mutex::Autolock _l(mLock); insertCommand_l(command, delayMs); ALOGV("AudioCommandThread() adding set parameter string %s, io %d ,delay %d", @@ -868,11 +858,6 @@ status_t AudioPolicyService::AudioCommandThread::voiceVolumeCommand(float volume VoiceVolumeData *data = new VoiceVolumeData(); data->mVolume = volume; command->mParam = data; - if (delayMs == 0) { - command->mWaitStatus = true; - } else { - command->mWaitStatus = false; - } Mutex::Autolock _l(mLock); insertCommand_l(command, delayMs); ALOGV("AudioCommandThread() adding set voice volume volume %f", volume); @@ -891,6 +876,7 @@ void AudioPolicyService::AudioCommandThread::insertCommand_l(AudioCommand *comma ssize_t i; // not size_t because i will count down to -1 Vector <AudioCommand *> removedCommands; + nsecs_t time = 0; command->mTime = systemTime() + milliseconds(delayMs); // acquire wake lock to make sure delayed commands are processed @@ -936,6 +922,7 @@ void AudioPolicyService::AudioCommandThread::insertCommand_l(AudioCommand *comma } else { data2->mKeyValuePairs = param2.toString(); } + time = command2->mTime; } break; case SET_VOLUME: { @@ -946,6 +933,7 @@ void AudioPolicyService::AudioCommandThread::insertCommand_l(AudioCommand *comma ALOGV("Filtering out volume command on output %d for stream %d", data->mIO, data->mStream); removedCommands.add(command2); + time = command2->mTime; } break; case START_TONE: case STOP_TONE: @@ -967,6 +955,17 @@ void AudioPolicyService::AudioCommandThread::insertCommand_l(AudioCommand *comma } removedCommands.clear(); + // wait for status only if delay is 0 and command time was not modified above + if (delayMs == 0 && time == 0) { + command->mWaitStatus = true; + } else { + command->mWaitStatus = false; + } + // update command time if modified above + if (time != 0) { + command->mTime = time; + } + // insert command at the right place according to its time stamp ALOGV("inserting command: %d at index %d, num commands %d", command->mCommand, (int)i+1, mAudioCommands.size()); @@ -1422,7 +1421,7 @@ static int aps_restore_output(void *service, audio_io_handle_t output) return af->restoreOutput(output); } -// deprecated: replaced by aps_open_input_on_module() +// deprecated: replaced by aps_open_input_on_module(), and acoustics parameter is ignored static audio_io_handle_t aps_open_input(void *service, audio_devices_t *pDevices, uint32_t *pSamplingRate, |
