diff options
Diffstat (limited to 'services/audioflinger')
-rw-r--r-- | services/audioflinger/AudioFlinger.cpp | 211 | ||||
-rw-r--r-- | services/audioflinger/AudioFlinger.h | 10 | ||||
-rw-r--r-- | services/audioflinger/AudioPolicyService.cpp | 50 | ||||
-rw-r--r-- | services/audioflinger/AudioPolicyService.h | 4 | ||||
-rw-r--r-- | services/audioflinger/AudioResampler.cpp | 2 | ||||
-rw-r--r-- | services/audioflinger/AudioResampler.h | 2 | ||||
-rw-r--r-- | services/audioflinger/AudioResamplerCubic.h | 2 | ||||
-rw-r--r-- | services/audioflinger/AudioResamplerSinc.cpp | 4 |
8 files changed, 143 insertions, 142 deletions
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp index fad7087..bfa4a49 100644 --- a/services/audioflinger/AudioFlinger.cpp +++ b/services/audioflinger/AudioFlinger.cpp @@ -190,13 +190,13 @@ void AudioFlinger::onFirstRef() continue; ALOGI("Loaded %s audio interface from %s (%s)", audio_interfaces[i], - mod->name, mod->id); + mod->name, mod->id); mAudioHwDevs.push(dev); if (mPrimaryHardwareDev == NULL) { mPrimaryHardwareDev = dev; ALOGI("Using '%s' (%s.%s) as the primary audio interface", - mod->name, mod->id, audio_interfaces[i]); + mod->name, mod->id, audio_interfaces[i]); } } @@ -515,7 +515,7 @@ sp<IAudioTrack> AudioFlinger::createTrack( } Exit: - if(status) { + if (status != NULL) { *status = lStatus; } return trackHandle; @@ -610,7 +610,7 @@ status_t AudioFlinger::setMasterVolume(float value) mMasterVolume = value; mMasterVolumeSW = swmv; for (size_t i = 0; i < mPlaybackThreads.size(); i++) - mPlaybackThreads.valueAt(i)->setMasterVolume(swmv); + mPlaybackThreads.valueAt(i)->setMasterVolume(swmv); return NO_ERROR; } @@ -642,7 +642,7 @@ status_t AudioFlinger::setMode(audio_mode_t mode) Mutex::Autolock _l(mLock); mMode = mode; for (size_t i = 0; i < mPlaybackThreads.size(); i++) - mPlaybackThreads.valueAt(i)->setMode(mode); + mPlaybackThreads.valueAt(i)->setMode(mode); } return ret; @@ -693,7 +693,7 @@ status_t AudioFlinger::setMasterMute(bool muted) // This is an optimization, so PlaybackThread doesn't have to look at the one from AudioFlinger mMasterMute = muted; for (size_t i = 0; i < mPlaybackThreads.size(); i++) - mPlaybackThreads.valueAt(i)->setMasterMute(muted); + mPlaybackThreads.valueAt(i)->setMasterMute(muted); return NO_ERROR; } @@ -761,7 +761,7 @@ status_t AudioFlinger::setStreamVolume(audio_stream_type_t stream, float value, if (thread == NULL) { for (size_t i = 0; i < mPlaybackThreads.size(); i++) { - mPlaybackThreads.valueAt(i)->setStreamVolume(stream, value); + mPlaybackThreads.valueAt(i)->setStreamVolume(stream, value); } } else { thread->setStreamVolume(stream, value); @@ -786,7 +786,7 @@ status_t AudioFlinger::setStreamMute(audio_stream_type_t stream, bool muted) AutoMutex lock(mLock); mStreamTypes[stream].mute = muted; for (uint32_t i = 0; i < mPlaybackThreads.size(); i++) - mPlaybackThreads.valueAt(i)->setStreamMute(stream, muted); + mPlaybackThreads.valueAt(i)->setStreamMute(stream, muted); return NO_ERROR; } @@ -1161,7 +1161,7 @@ void AudioFlinger::ThreadBase::sendConfigEvent_l(int event, int param) void AudioFlinger::ThreadBase::processConfigEvents() { mLock.lock(); - while(!mConfigEvents.isEmpty()) { + while (!mConfigEvents.isEmpty()) { ALOGV("processConfigEvents() remaining events %d", mConfigEvents.size()); ConfigEvent configEvent = mConfigEvents[0]; mConfigEvents.removeAt(0); @@ -1345,13 +1345,13 @@ void AudioFlinger::ThreadBase::checkSuspendOnAddEffectChain_l(const sp<EffectCha mSuspendedSessions.editValueAt(index); for (size_t i = 0; i < sessionEffects.size(); i++) { - sp <SuspendedSessionDesc> desc = sessionEffects.valueAt(i); + sp<SuspendedSessionDesc> desc = sessionEffects.valueAt(i); for (int j = 0; j < desc->mRefCount; j++) { if (sessionEffects.keyAt(i) == EffectChain::kKeyForSuspendAll) { chain->setEffectSuspendedAll_l(true); } else { ALOGV("checkSuspendOnAddEffectChain_l() suspending effects %08x", - desc->mType.timeLow); + desc->mType.timeLow); chain->setEffectSuspended_l(&desc->mType, true); } } @@ -1386,7 +1386,7 @@ void AudioFlinger::ThreadBase::updateSuspendedSessions_l(const effect_uuid_t *ty } index = sessionEffects.indexOfKey(key); - sp <SuspendedSessionDesc> desc; + sp<SuspendedSessionDesc> desc; if (suspend) { if (index >= 0) { desc = sessionEffects.valueAt(index); @@ -1659,14 +1659,14 @@ sp<AudioFlinger::PlaybackThread::Track> AudioFlinger::PlaybackThread::createTra // createTrack() was called by the client process. if (!mStreamTypes[streamType].valid) { ALOGW("createTrack_l() on thread %p: invalidating track on stream %d", - this, streamType); + this, streamType); android_atomic_or(CBLK_INVALID_ON, &track->mCblk->flags); } } lStatus = NO_ERROR; Exit: - if(status) { + if (status) { *status = lStatus; } return track; @@ -2645,10 +2645,10 @@ bool AudioFlinger::MixerThread::checkForNewParameters_l() status = mOutput->stream->common.set_parameters(&mOutput->stream->common, keyValuePair.string()); if (!mStandby && status == INVALID_OPERATION) { - mOutput->stream->common.standby(&mOutput->stream->common); - mStandby = true; - mBytesWritten = 0; - status = mOutput->stream->common.set_parameters(&mOutput->stream->common, + mOutput->stream->common.standby(&mOutput->stream->common); + mStandby = true; + mBytesWritten = 0; + status = mOutput->stream->common.set_parameters(&mOutput->stream->common, keyValuePair.string()); } if (status == NO_ERROR && reconfig) { @@ -2902,7 +2902,7 @@ void AudioFlinger::DirectOutputThread::threadLoop_mix() size_t count = mFrameCount * mChannelCount; uint8_t *src = (uint8_t *)mMixBuffer + count-1; int16_t *dst = mMixBuffer + count-1; - while(count--) { + while (count--) { *dst-- = (int16_t)(*src--^0x80) << 8; } } @@ -2955,7 +2955,7 @@ void AudioFlinger::DirectOutputThread::threadLoop_mix() size_t count = mFrameCount * mChannelCount; int16_t *src = mMixBuffer; uint8_t *dst = (uint8_t *)mMixBuffer; - while(count--) { + while (count--) { *dst++ = (uint8_t)(((int32_t)*src++ + (1<<7)) >> 8)^0x80; } } @@ -3014,10 +3014,10 @@ bool AudioFlinger::DirectOutputThread::checkForNewParameters_l() status = mOutput->stream->common.set_parameters(&mOutput->stream->common, keyValuePair.string()); if (!mStandby && status == INVALID_OPERATION) { - mOutput->stream->common.standby(&mOutput->stream->common); - mStandby = true; - mBytesWritten = 0; - status = mOutput->stream->common.set_parameters(&mOutput->stream->common, + mOutput->stream->common.standby(&mOutput->stream->common); + mStandby = true; + mBytesWritten = 0; + status = mOutput->stream->common.set_parameters(&mOutput->stream->common, keyValuePair.string()); } if (status == NO_ERROR && reconfig) { @@ -3208,7 +3208,7 @@ void AudioFlinger::DuplicatingThread::updateWaitTime_l() bool AudioFlinger::DuplicatingThread::outputsReady(const SortedVector< sp<OutputTrack> > &outputTracks) { for (size_t i = 0; i < outputTracks.size(); i++) { - sp <ThreadBase> thread = outputTracks[i]->thread().promote(); + sp<ThreadBase> thread = outputTracks[i]->thread().promote(); if (thread == 0) { ALOGW("DuplicatingThread::outputsReady() could not promote thread on output track %p", outputTracks[i].get()); return false; @@ -3264,14 +3264,14 @@ AudioFlinger::ThreadBase::TrackBase::TrackBase( ALOGV_IF(sharedBuffer != 0, "sharedBuffer: %p, size: %d", sharedBuffer->pointer(), sharedBuffer->size()); // ALOGD("Creating track with %d buffers @ %d bytes", bufferCount, bufferSize); - size_t size = sizeof(audio_track_cblk_t); - uint8_t channelCount = popcount(channelMask); - size_t bufferSize = frameCount*channelCount*sizeof(int16_t); - if (sharedBuffer == 0) { - size += bufferSize; - } - - if (client != NULL) { + size_t size = sizeof(audio_track_cblk_t); + uint8_t channelCount = popcount(channelMask); + size_t bufferSize = frameCount*channelCount*sizeof(int16_t); + if (sharedBuffer == 0) { + size += bufferSize; + } + + if (client != NULL) { mCblkMemory = client->heap()->allocate(size); if (mCblkMemory != 0) { mCblk = static_cast<audio_track_cblk_t *>(mCblkMemory->pointer()); @@ -3298,22 +3298,22 @@ AudioFlinger::ThreadBase::TrackBase::TrackBase( client->heap()->dump("AudioTrack"); return; } - } else { - mCblk = (audio_track_cblk_t *)(new uint8_t[size]); - // construct the shared structure in-place. - new(mCblk) audio_track_cblk_t(); - // clear all buffers - mCblk->frameCount = frameCount; - mCblk->sampleRate = sampleRate; - mChannelCount = channelCount; - mChannelMask = channelMask; - mBuffer = (char*)mCblk + sizeof(audio_track_cblk_t); - memset(mBuffer, 0, frameCount*channelCount*sizeof(int16_t)); - // Force underrun condition to avoid false underrun callback until first data is - // written to buffer (other flags are cleared) - mCblk->flags = CBLK_UNDERRUN_ON; - mBufferEnd = (uint8_t *)mBuffer + bufferSize; - } + } else { + mCblk = (audio_track_cblk_t *)(new uint8_t[size]); + // construct the shared structure in-place. + new(mCblk) audio_track_cblk_t(); + // clear all buffers + mCblk->frameCount = frameCount; + mCblk->sampleRate = sampleRate; + mChannelCount = channelCount; + mChannelMask = channelMask; + mBuffer = (char*)mCblk + sizeof(audio_track_cblk_t); + memset(mBuffer, 0, frameCount*channelCount*sizeof(int16_t)); + // Force underrun condition to avoid false underrun callback until first data is + // written to buffer (other flags are cleared) + mCblk->flags = CBLK_UNDERRUN_ON; + mBufferEnd = (uint8_t *)mBuffer + bufferSize; + } } AudioFlinger::ThreadBase::TrackBase::~TrackBase() @@ -3491,22 +3491,22 @@ void AudioFlinger::PlaybackThread::Track::dump(char* buffer, size_t size) // AudioBufferProvider interface status_t AudioFlinger::PlaybackThread::Track::getNextBuffer( - AudioBufferProvider::Buffer* buffer, int64_t pts) + AudioBufferProvider::Buffer* buffer, int64_t pts) { - audio_track_cblk_t* cblk = this->cblk(); - uint32_t framesReady; - uint32_t framesReq = buffer->frameCount; + audio_track_cblk_t* cblk = this->cblk(); + uint32_t framesReady; + uint32_t framesReq = buffer->frameCount; - // Check if last stepServer failed, try to step now - if (mStepServerFailed) { - if (!step()) goto getNextBuffer_exit; - ALOGV("stepServer recovered"); - mStepServerFailed = false; - } + // Check if last stepServer failed, try to step now + if (mStepServerFailed) { + if (!step()) goto getNextBuffer_exit; + ALOGV("stepServer recovered"); + mStepServerFailed = false; + } - framesReady = cblk->framesReady(); + framesReady = cblk->framesReady(); - if (CC_LIKELY(framesReady)) { + if (CC_LIKELY(framesReady)) { uint32_t s = cblk->server; uint32_t bufferEnd = cblk->serverBase + cblk->frameCount; @@ -3518,21 +3518,21 @@ status_t AudioFlinger::PlaybackThread::Track::getNextBuffer( framesReq = bufferEnd - s; } - buffer->raw = getBuffer(s, framesReq); - if (buffer->raw == NULL) goto getNextBuffer_exit; + buffer->raw = getBuffer(s, framesReq); + if (buffer->raw == NULL) goto getNextBuffer_exit; - buffer->frameCount = framesReq; + buffer->frameCount = framesReq; return NO_ERROR; - } + } getNextBuffer_exit: - buffer->raw = NULL; - buffer->frameCount = 0; - ALOGV("getNextBuffer() no more data for track %d on thread %p", mName, mThread.unsafe_get()); - return NOT_ENOUGH_DATA; + buffer->raw = NULL; + buffer->frameCount = 0; + ALOGV("getNextBuffer() no more data for track %d on thread %p", mName, mThread.unsafe_get()); + return NOT_ENOUGH_DATA; } -uint32_t AudioFlinger::PlaybackThread::Track::framesReady() const{ +uint32_t AudioFlinger::PlaybackThread::Track::framesReady() const { return mCblk->framesReady(); } @@ -3684,8 +3684,8 @@ status_t AudioFlinger::PlaybackThread::Track::attachAuxEffect(int EffectId) status_t status = DEAD_OBJECT; sp<ThreadBase> thread = mThread.promote(); if (thread != 0) { - PlaybackThread *playbackThread = (PlaybackThread *)thread.get(); - status = playbackThread->attachAuxEffect(this, EffectId); + PlaybackThread *playbackThread = (PlaybackThread *)thread.get(); + status = playbackThread->attachAuxEffect(this, EffectId); } return status; } @@ -4104,14 +4104,14 @@ AudioFlinger::RecordThread::RecordTrack::RecordTrack( mOverflow(false) { if (mCblk != NULL) { - ALOGV("RecordTrack constructor, size %d", (int)mBufferEnd - (int)mBuffer); - if (format == AUDIO_FORMAT_PCM_16_BIT) { - mCblk->frameSize = mChannelCount * sizeof(int16_t); - } else if (format == AUDIO_FORMAT_PCM_8_BIT) { - mCblk->frameSize = mChannelCount * sizeof(int8_t); - } else { - mCblk->frameSize = sizeof(int8_t); - } + ALOGV("RecordTrack constructor, size %d", (int)mBufferEnd - (int)mBuffer); + if (format == AUDIO_FORMAT_PCM_16_BIT) { + mCblk->frameSize = mChannelCount * sizeof(int16_t); + } else if (format == AUDIO_FORMAT_PCM_8_BIT) { + mCblk->frameSize = mChannelCount * sizeof(int8_t); + } else { + mCblk->frameSize = sizeof(int8_t); + } } } @@ -4130,7 +4130,7 @@ status_t AudioFlinger::RecordThread::RecordTrack::getNextBuffer(AudioBufferProvi uint32_t framesAvail; uint32_t framesReq = buffer->frameCount; - // Check if last stepServer failed, try to step now + // Check if last stepServer failed, try to step now if (mStepServerFailed) { if (!step()) goto getNextBuffer_exit; ALOGV("stepServer recovered"); @@ -4976,7 +4976,7 @@ Exit: status_t AudioFlinger::RecordThread::start(RecordThread::RecordTrack* recordTrack, pid_t tid) { ALOGV("RecordThread::start tid=%d", tid); - sp <ThreadBase> strongMe = this; + sp<ThreadBase> strongMe = this; status_t status = NO_ERROR; { AutoMutex lock(mLock); @@ -5029,7 +5029,7 @@ startError: void AudioFlinger::RecordThread::stop(RecordThread::RecordTrack* recordTrack) { ALOGV("RecordThread::stop"); - sp <ThreadBase> strongMe = this; + sp<ThreadBase> strongMe = this; { AutoMutex lock(mLock); if (mActiveTrack != 0 && recordTrack == mActiveTrack.get()) { @@ -5196,8 +5196,9 @@ bool AudioFlinger::RecordThread::checkForNewParameters_l() if (status == NO_ERROR) { status = mInput->stream->common.set_parameters(&mInput->stream->common, keyValuePair.string()); if (status == INVALID_OPERATION) { - mInput->stream->common.standby(&mInput->stream->common); - status = mInput->stream->common.set_parameters(&mInput->stream->common, keyValuePair.string()); + mInput->stream->common.standby(&mInput->stream->common); + status = mInput->stream->common.set_parameters(&mInput->stream->common, + keyValuePair.string()); } if (reconfig) { if (status == BAD_VALUE && @@ -5285,8 +5286,8 @@ void AudioFlinger::RecordThread::readInputParameters() if (mSampleRate != mReqSampleRate && mChannelCount <= FCC_2 && mReqChannelCount <= FCC_2) { int channelCount; - // optmization: if mono to mono, use the resampler in stereo to stereo mode to avoid - // stereo to mono post process as the resampler always outputs stereo. + // optimization: if mono to mono, use the resampler in stereo to stereo mode to avoid + // stereo to mono post process as the resampler always outputs stereo. if (mChannelCount == 1 && mReqChannelCount == 2) { channelCount = 1; } else { @@ -5460,7 +5461,7 @@ status_t AudioFlinger::closeOutput(audio_io_handle_t output) { // keep strong reference on the playback thread so that // it is not destroyed while exit() is executed - sp <PlaybackThread> thread; + sp<PlaybackThread> thread; { Mutex::Autolock _l(mLock); thread = checkPlaybackThread_l(output); @@ -5613,7 +5614,7 @@ status_t AudioFlinger::closeInput(audio_io_handle_t input) { // keep strong reference on the record thread so that // it is not destroyed while exit() is executed - sp <RecordThread> thread; + sp<RecordThread> thread; { Mutex::Autolock _l(mLock); thread = checkRecordThread_l(input); @@ -5746,7 +5747,7 @@ void AudioFlinger::purgeStaleEffects_l() { AudioSessionRef *ref = mAudioSessionRefs.itemAt(k); if (ref->mSessionid == sessionid) { ALOGV(" session %d still exists for %d with %d refs", - sessionid, ref->mPid, ref->mCnt); + sessionid, ref->mPid, ref->mCnt); found = true; break; } @@ -5979,7 +5980,7 @@ sp<IEffect> AudioFlinger::createEffect(pid_t pid, // because of code checking output when entering the function. // Note: io is never 0 when creating an effect on an input if (io == 0) { - // 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++) { if (mPlaybackThreads.valueAt(i)->hasAudioSession(sessionId) != 0) { io = mPlaybackThreads.keyAt(i); @@ -5987,12 +5988,12 @@ sp<IEffect> AudioFlinger::createEffect(pid_t pid, } } if (io == 0) { - for (size_t i = 0; i < mRecordThreads.size(); i++) { - if (mRecordThreads.valueAt(i)->hasAudioSession(sessionId) != 0) { - io = mRecordThreads.keyAt(i); - break; - } - } + for (size_t i = 0; i < mRecordThreads.size(); i++) { + if (mRecordThreads.valueAt(i)->hasAudioSession(sessionId) != 0) { + io = mRecordThreads.keyAt(i); + break; + } + } } // If no output thread contains the requested session ID, default to // first output. The effect chain will be moved to the correct output @@ -6023,7 +6024,7 @@ sp<IEffect> AudioFlinger::createEffect(pid_t pid, } Exit: - if(status) { + if (status != NULL) { *status = lStatus; } return handle; @@ -6226,7 +6227,7 @@ Exit: handle.clear(); } - if(status) { + if (status != NULL) { *status = lStatus; } return handle; @@ -6296,7 +6297,7 @@ void AudioFlinger::ThreadBase::removeEffect_l(const sp<EffectModule>& effect) { } void AudioFlinger::ThreadBase::lockEffectChains_l( - Vector<sp <AudioFlinger::EffectChain> >& effectChains) + Vector< sp<AudioFlinger::EffectChain> >& effectChains) { effectChains = mEffectChains; for (size_t i = 0; i < mEffectChains.size(); i++) { @@ -6305,7 +6306,7 @@ void AudioFlinger::ThreadBase::lockEffectChains_l( } void AudioFlinger::ThreadBase::unlockEffectChains( - const Vector<sp <AudioFlinger::EffectChain> >& effectChains) + const Vector< sp<AudioFlinger::EffectChain> >& effectChains) { for (size_t i = 0; i < effectChains.size(); i++) { effectChains[i]->unlock(); @@ -6481,7 +6482,7 @@ status_t AudioFlinger::PlaybackThread::attachAuxEffect_l( void AudioFlinger::PlaybackThread::detachAuxEffect_l(int effectId) { - for (size_t i = 0; i < mTracks.size(); ++i) { + for (size_t i = 0; i < mTracks.size(); ++i) { sp<Track> track = mTracks[i]; if (track->auxEffectId() == effectId) { attachAuxEffect_l(track, 0); @@ -7265,7 +7266,7 @@ AudioFlinger::EffectHandle::EffectHandle(const sp<EffectModule>& effect, if (mCblk != NULL) { new(mCblk) effect_param_cblk_t(); mBuffer = (uint8_t *)mCblk + bufOffset; - } + } } else { ALOGE("not enough memory for Effect size=%u", EFFECT_PARAM_BUFFER_SIZE + sizeof(effect_param_cblk_t)); return; @@ -8032,7 +8033,7 @@ void AudioFlinger::EffectChain::checkSuspendOnEffectEnabled(const sp<EffectModul } } ALOGV("checkSuspendOnEffectEnabled() enable suspending fx %08x", - effect->desc().type.timeLow); + effect->desc().type.timeLow); sp<SuspendedEffectDesc> desc = mSuspendedEffects.valueAt(index); // if effect is requested to suspended but was not yet enabled, supend it now. if (desc->mEffect == 0) { @@ -8045,7 +8046,7 @@ void AudioFlinger::EffectChain::checkSuspendOnEffectEnabled(const sp<EffectModul return; } ALOGV("checkSuspendOnEffectEnabled() disable restoring fx %08x", - effect->desc().type.timeLow); + effect->desc().type.timeLow); sp<SuspendedEffectDesc> desc = mSuspendedEffects.valueAt(index); desc->mEffect.clear(); effect->setSuspended(false); diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h index f3c8dd2..0e4b24a 100644 --- a/services/audioflinger/AudioFlinger.h +++ b/services/audioflinger/AudioFlinger.h @@ -465,9 +465,9 @@ private: // ThreadBase mutex before processing the mixer and effects. This guarantees the // integrity of the chains during the process. // Also sets the parameter 'effectChains' to current value of mEffectChains. - void lockEffectChains_l(Vector<sp <EffectChain> >& effectChains); + void lockEffectChains_l(Vector< sp<EffectChain> >& effectChains); // unlock effect chains after process - void unlockEffectChains(const Vector<sp<EffectChain> >& effectChains); + void unlockEffectChains(const Vector< sp<EffectChain> >& effectChains); // set audio mode to all effect chains void setMode(audio_mode_t mode); // get effect module with corresponding ID on specified audio session @@ -1056,7 +1056,7 @@ private: virtual uint32_t activeSleepTimeUs(); private: - bool outputsReady(const SortedVector<sp<OutputTrack> > &outputTracks); + bool outputsReady(const SortedVector< sp<OutputTrack> > &outputTracks); protected: // threadLoop snippets virtual void threadLoop_mix(); @@ -1504,7 +1504,7 @@ mutable Mutex mLock; // mutex for process, commands and handl uint32_t strategy() const { return mStrategy; } void setStrategy(uint32_t strategy) - { mStrategy = strategy; } + { mStrategy = strategy; } // suspend effect of the given type void setEffectSuspended_l(const effect_uuid_t *type, @@ -1544,7 +1544,7 @@ mutable Mutex mLock; // mutex for process, commands and handl wp<ThreadBase> mThread; // parent mixer thread Mutex mLock; // mutex protecting effect list - Vector<sp<EffectModule> > mEffects; // list of effect modules + Vector< sp<EffectModule> > mEffects; // list of effect modules int mSessionId; // audio session ID int16_t *mInBuffer; // chain input buffer int16_t *mOutBuffer; // chain output buffer diff --git a/services/audioflinger/AudioPolicyService.cpp b/services/audioflinger/AudioPolicyService.cpp index d57326b..c23eb04 100644 --- a/services/audioflinger/AudioPolicyService.cpp +++ b/services/audioflinger/AudioPolicyService.cpp @@ -649,7 +649,7 @@ bool AudioPolicyService::AudioCommandThread::threadLoop() mLock.lock(); while (!exitPending()) { - while(!mAudioCommands.isEmpty()) { + while (!mAudioCommands.isEmpty()) { nsecs_t curTime = systemTime(); // commands are sorted by increasing time stamp: execute them from index 0 and up if (mAudioCommands[0]->mTime <= curTime) { @@ -693,16 +693,16 @@ bool AudioPolicyService::AudioCommandThread::threadLoop() delete data; }break; case SET_PARAMETERS: { - ParametersData *data = (ParametersData *)command->mParam; - ALOGV("AudioCommandThread() processing set parameters string %s, io %d", - data->mKeyValuePairs.string(), data->mIO); - command->mStatus = AudioSystem::setParameters(data->mIO, data->mKeyValuePairs); - if (command->mWaitStatus) { - command->mCond.signal(); - mWaitWorkCV.wait(mLock); - } - delete data; - }break; + ParametersData *data = (ParametersData *)command->mParam; + ALOGV("AudioCommandThread() processing set parameters string %s, io %d", + data->mKeyValuePairs.string(), data->mIO); + command->mStatus = AudioSystem::setParameters(data->mIO, data->mKeyValuePairs); + if (command->mWaitStatus) { + command->mCond.signal(); + mWaitWorkCV.wait(mLock); + } + delete data; + }break; case SET_VOICE_VOLUME: { VoiceVolumeData *data = (VoiceVolumeData *)command->mParam; ALOGV("AudioCommandThread() processing set voice volume volume %f", @@ -916,19 +916,19 @@ void AudioPolicyService::AudioCommandThread::insertCommand_l(AudioCommand *comma AudioParameter param = AudioParameter(data->mKeyValuePairs); AudioParameter param2 = AudioParameter(data2->mKeyValuePairs); for (size_t j = 0; j < param.size(); j++) { - String8 key; - String8 value; - param.getAt(j, key, value); - for (size_t k = 0; k < param2.size(); k++) { - String8 key2; - String8 value2; - param2.getAt(k, key2, value2); - if (key2 == key) { - param2.remove(key2); - ALOGV("Filtering out parameter %s", key2.string()); - break; - } - } + String8 key; + String8 value; + param.getAt(j, key, value); + for (size_t k = 0; k < param2.size(); k++) { + String8 key2; + String8 value2; + param2.getAt(k, key2, value2); + if (key2 == key) { + param2.remove(key2); + ALOGV("Filtering out parameter %s", key2.string()); + break; + } + } } // if all keys have been filtered out, remove the command. // otherwise, update the key value pairs @@ -1020,7 +1020,7 @@ int AudioPolicyService::startTone(audio_policy_tone_t tone, ALOGE("startTone: illegal tone requested (%d)", tone); if (stream != AUDIO_STREAM_VOICE_CALL) ALOGE("startTone: illegal stream (%d) requested for tone %d", stream, - tone); + tone); mTonePlaybackThread->startToneCommand(ToneGenerator::TONE_SUP_CALL_WAITING, AUDIO_STREAM_VOICE_CALL); return 0; diff --git a/services/audioflinger/AudioPolicyService.h b/services/audioflinger/AudioPolicyService.h index 7119b90..9ed905d 100644 --- a/services/audioflinger/AudioPolicyService.h +++ b/services/audioflinger/AudioPolicyService.h @@ -311,8 +311,8 @@ private: mutable Mutex mLock; // prevents concurrent access to AudioPolicy manager functions changing // device connection state or routing - sp <AudioCommandThread> mAudioCommandThread; // audio commands thread - sp <AudioCommandThread> mTonePlaybackThread; // tone playback thread + sp<AudioCommandThread> mAudioCommandThread; // audio commands thread + sp<AudioCommandThread> mTonePlaybackThread; // tone playback thread struct audio_policy_device *mpAudioPolicyDev; struct audio_policy *mpAudioPolicy; KeyedVector< audio_source_t, InputSourceDesc* > mInputSources; diff --git a/services/audioflinger/AudioResampler.cpp b/services/audioflinger/AudioResampler.cpp index 398ba0b..fbb54cf 100644 --- a/services/audioflinger/AudioResampler.cpp +++ b/services/audioflinger/AudioResampler.cpp @@ -227,7 +227,7 @@ void AudioResamplerOrder1::resampleStereo16(int32_t* out, size_t outFrameCount, mX0L = mBuffer.i16[mBuffer.frameCount*2-2]; mX0R = mBuffer.i16[mBuffer.frameCount*2-1]; provider->releaseBuffer(&mBuffer); - // mBuffer.frameCount == 0 now so we reload a new buffer + // mBuffer.frameCount == 0 now so we reload a new buffer } int16_t *in = mBuffer.i16; diff --git a/services/audioflinger/AudioResampler.h b/services/audioflinger/AudioResampler.h index 9deb796..1610e00 100644 --- a/services/audioflinger/AudioResampler.h +++ b/services/audioflinger/AudioResampler.h @@ -33,7 +33,7 @@ public: // HIGH_QUALITY: fixed multi-tap FIR (e.g. 48KHz->44.1KHz) // NOTE: high quality SRC will only be supported for // certain fixed rate conversions. Sample rate cannot be - // changed dynamically. + // changed dynamically. enum src_quality { DEFAULT=0, LOW_QUALITY=1, diff --git a/services/audioflinger/AudioResamplerCubic.h b/services/audioflinger/AudioResamplerCubic.h index b72b62a..892785a 100644 --- a/services/audioflinger/AudioResamplerCubic.h +++ b/services/audioflinger/AudioResamplerCubic.h @@ -55,7 +55,7 @@ private: p->y1 = p->y2; p->y2 = p->y3; p->y3 = in; - p->a = (3 * (p->y1 - p->y2) - p->y0 + p->y3) >> 1; + p->a = (3 * (p->y1 - p->y2) - p->y0 + p->y3) >> 1; p->b = (p->y2 << 1) + p->y0 - (((5 * p->y1 + p->y3)) >> 1); p->c = (p->y2 - p->y0) >> 1; } diff --git a/services/audioflinger/AudioResamplerSinc.cpp b/services/audioflinger/AudioResamplerSinc.cpp index d373c08..76662d8 100644 --- a/services/audioflinger/AudioResamplerSinc.cpp +++ b/services/audioflinger/AudioResamplerSinc.cpp @@ -222,7 +222,7 @@ void AudioResamplerSinc::resample(int32_t* out, size_t outFrameCount, } else { read<CHANNELS>(impulse, phaseFraction, mBuffer.i16, inputIndex); } - } + } } int16_t *in = mBuffer.i16; const size_t frameCount = mBuffer.frameCount; @@ -247,7 +247,7 @@ void AudioResamplerSinc::resample(int32_t* out, size_t outFrameCount, if (inputIndex >= frameCount) break; // need a new buffer read<CHANNELS>(impulse, phaseFraction, in, inputIndex); - } else if(phaseIndex == 2) { // maximum value + } else if (phaseIndex == 2) { // maximum value inputIndex++; if (inputIndex >= frameCount) break; // 0 frame available, 2 frames needed |