diff options
Diffstat (limited to 'services')
-rw-r--r-- | services/audioflinger/AudioFlinger.cpp | 99 | ||||
-rw-r--r-- | services/audioflinger/AudioFlinger.h | 6 | ||||
-rw-r--r-- | services/audioflinger/AudioMixer.cpp | 125 | ||||
-rw-r--r-- | services/audioflinger/AudioMixer.h | 4 | ||||
-rw-r--r-- | services/audioflinger/AudioPolicyService.cpp | 1 | ||||
-rw-r--r-- | services/audioflinger/AudioPolicyService.h | 3 |
6 files changed, 123 insertions, 115 deletions
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp index dcc0bd0..a13fddb 100644 --- a/services/audioflinger/AudioFlinger.cpp +++ b/services/audioflinger/AudioFlinger.cpp @@ -63,8 +63,8 @@ namespace android { -static const char* kDeadlockedString = "AudioFlinger may be deadlocked\n"; -static const char* kHardwareLockedString = "Hardware lock is taken\n"; +static const char kDeadlockedString[] = "AudioFlinger may be deadlocked\n"; +static const char kHardwareLockedString[] = "Hardware lock is taken\n"; //static const nsecs_t kStandbyTimeInNsecs = seconds(3); static const float MAX_GAIN = 4096.0f; @@ -80,14 +80,16 @@ static const int8_t kMaxTrackStartupRetries = 50; static const int8_t kMaxTrackRetriesDirect = 2; static const int kDumpLockRetries = 50; -static const int kDumpLockSleep = 20000; +static const int kDumpLockSleepUs = 20000; -static const nsecs_t kWarningThrottle = seconds(5); +// don't warn about blocked writes or record buffer overflows more often than this +static const nsecs_t kWarningThrottleNs = seconds(5); // RecordThread loop sleep time upon application overrun or audio HAL read error static const int kRecordThreadSleepUs = 5000; -static const nsecs_t kSetParametersTimeout = seconds(2); +// maximum time to wait for setParameters to complete +static const nsecs_t kSetParametersTimeoutNs = seconds(2); // minimum sleep time for the mixer thread loop when tracks are active but in underrun static const uint32_t kMinThreadSleepTimeUs = 5000; @@ -147,7 +149,7 @@ out: return rc; } -static const char *audio_interfaces[] = { +static const char * const audio_interfaces[] = { "primary", "a2dp", "usb", @@ -158,7 +160,7 @@ static const char *audio_interfaces[] = { AudioFlinger::AudioFlinger() : BnAudioFlinger(), - mPrimaryHardwareDev(0), mMasterVolume(1.0f), mMasterMute(false), mNextUniqueId(1), + mPrimaryHardwareDev(NULL), mMasterVolume(1.0f), mMasterMute(false), mNextUniqueId(1), mBtNrecIsOff(false) { } @@ -320,7 +322,7 @@ static bool tryLock(Mutex& mutex) locked = true; break; } - usleep(kDumpLockSleep); + usleep(kDumpLockSleepUs); } return locked; } @@ -395,7 +397,7 @@ sp<IAudioTrack> AudioFlinger::createTrack( int lSessionId; if (streamType >= AUDIO_STREAM_CNT) { - LOGE("invalid stream type"); + LOGE("createTrack() invalid stream type %d", streamType); lStatus = BAD_VALUE; goto Exit; } @@ -427,6 +429,7 @@ sp<IAudioTrack> AudioFlinger::createTrack( // prevent same audio session on different output threads uint32_t sessions = t->hasAudioSession(*sessionId); if (sessions & PlaybackThread::TRACK_SESSION) { + LOGE("createTrack() session ID %d already in use", *sessionId); lStatus = BAD_VALUE; goto Exit; } @@ -657,6 +660,7 @@ status_t AudioFlinger::setStreamVolume(int stream, float value, int output) } if (stream < 0 || uint32_t(stream) >= AUDIO_STREAM_CNT) { + LOGE("setStreamVolume() invalid stream %d", stream); return BAD_VALUE; } @@ -691,6 +695,7 @@ status_t AudioFlinger::setStreamMute(int stream, bool muted) if (stream < 0 || uint32_t(stream) >= AUDIO_STREAM_CNT || uint32_t(stream) == AUDIO_STREAM_ENFORCED_AUDIBLE) { + LOGE("setStreamMute() invalid stream %d", stream); return BAD_VALUE; } @@ -988,7 +993,6 @@ AudioFlinger::ThreadBase::ThreadBase(const sp<AudioFlinger>& audioFlinger, int i AudioFlinger::ThreadBase::~ThreadBase() { mParamCond.broadcast(); - mNewParameters.clear(); // do not lock the mutex in destructor releaseWakeLock_l(); if (mPowerManager != 0) { @@ -999,7 +1003,7 @@ AudioFlinger::ThreadBase::~ThreadBase() void AudioFlinger::ThreadBase::exit() { - // keep a strong ref on ourself so that we wont get + // keep a strong ref on ourself so that we won't get // destroyed in the middle of requestExitAndWait() sp <ThreadBase> strongMe = this; @@ -1044,7 +1048,7 @@ status_t AudioFlinger::ThreadBase::setParameters(const String8& keyValuePairs) mWaitWorkCV.signal(); // wait condition with timeout in case the thread loop has exited // before the request could be processed - if (mParamCond.waitRelative(mLock, kSetParametersTimeout) == NO_ERROR) { + if (mParamCond.waitRelative(mLock, kSetParametersTimeoutNs) == NO_ERROR) { status = mParamStatus; mWaitWorkCV.signal(); } else { @@ -1062,9 +1066,9 @@ void AudioFlinger::ThreadBase::sendConfigEvent(int event, int param) // sendConfigEvent_l() must be called with ThreadBase::mLock held void AudioFlinger::ThreadBase::sendConfigEvent_l(int event, int param) { - ConfigEvent *configEvent = new ConfigEvent(); - configEvent->mEvent = event; - configEvent->mParam = param; + ConfigEvent configEvent; + configEvent.mEvent = event; + configEvent.mParam = param; mConfigEvents.add(configEvent); ALOGV("sendConfigEvent() num events %d event %d, param %d", mConfigEvents.size(), event, param); mWaitWorkCV.signal(); @@ -1075,15 +1079,14 @@ void AudioFlinger::ThreadBase::processConfigEvents() mLock.lock(); while(!mConfigEvents.isEmpty()) { ALOGV("processConfigEvents() remaining events %d", mConfigEvents.size()); - ConfigEvent *configEvent = mConfigEvents[0]; + ConfigEvent configEvent = mConfigEvents[0]; mConfigEvents.removeAt(0); // release mLock before locking AudioFlinger mLock: lock order is always // AudioFlinger then ThreadBase to avoid cross deadlock mLock.unlock(); mAudioFlinger->mLock.lock(); - audioConfigChanged_l(configEvent->mEvent, configEvent->mParam); + audioConfigChanged_l(configEvent.mEvent, configEvent.mParam); mAudioFlinger->mLock.unlock(); - delete configEvent; mLock.lock(); } mLock.unlock(); @@ -1130,7 +1133,7 @@ status_t AudioFlinger::ThreadBase::dumpBase(int fd, const Vector<String16>& args snprintf(buffer, SIZE, " Index event param\n"); result.append(buffer); for (size_t i = 0; i < mConfigEvents.size(); i++) { - snprintf(buffer, SIZE, " %02d %02d %d\n", i, mConfigEvents[i]->mEvent, mConfigEvents[i]->mParam); + snprintf(buffer, SIZE, " %02d %02d %d\n", i, mConfigEvents[i].mEvent, mConfigEvents[i].mParam); result.append(buffer); } result.append("\n"); @@ -1367,7 +1370,7 @@ AudioFlinger::PlaybackThread::PlaybackThread(const sp<AudioFlinger>& audioFlinge int id, uint32_t device) : ThreadBase(audioFlinger, id, device), - mMixBuffer(0), mSuspended(0), mBytesWritten(0), mOutput(output), + mMixBuffer(NULL), mSuspended(0), mBytesWritten(0), mOutput(output), mLastWriteTime(0), mNumWrites(0), mNumDelayedWrites(0), mInWrite(false) { snprintf(mName, kNameLength, "AudioOut_%d", id); @@ -1526,8 +1529,10 @@ sp<AudioFlinger::PlaybackThread::Track> AudioFlinger::PlaybackThread::createTra for (size_t i = 0; i < mTracks.size(); ++i) { sp<Track> t = mTracks[i]; if (t != 0) { - if (sessionId == t->sessionId() && - strategy != AudioSystem::getStrategyForStream((audio_stream_type_t)t->type())) { + uint32_t actual = AudioSystem::getStrategyForStream((audio_stream_type_t)t->type()); + if (sessionId == t->sessionId() && strategy != actual) { + LOGE("createTrack_l() mismatched strategy; expected %u but found %u", + strategy, actual); lStatus = BAD_VALUE; goto Exit; } @@ -1832,7 +1837,7 @@ uint32_t AudioFlinger::PlaybackThread::activeSleepTimeUs() AudioFlinger::MixerThread::MixerThread(const sp<AudioFlinger>& audioFlinger, AudioStreamOut* output, int id, uint32_t device) : PlaybackThread(audioFlinger, output, id, device), - mAudioMixer(0) + mAudioMixer(NULL) { mType = ThreadBase::MIXER; mAudioMixer = new AudioMixer(mFrameCount, mSampleRate); @@ -1967,7 +1972,7 @@ bool AudioFlinger::MixerThread::threadLoop() // during mixing and effect process as the audio buffers could be deleted // or modified if an effect is created or deleted lockEffectChains_l(effectChains); - } + } if (LIKELY(mixerStatus == MIXER_TRACKS_READY)) { // mix buffers... @@ -2012,11 +2017,11 @@ bool AudioFlinger::MixerThread::threadLoop() } // sleepTime == 0 means we must write to audio hardware if (sleepTime == 0) { - for (size_t i = 0; i < effectChains.size(); i ++) { - effectChains[i]->process_l(); - } - // enable changes in effect chain - unlockEffectChains(effectChains); + for (size_t i = 0; i < effectChains.size(); i ++) { + effectChains[i]->process_l(); + } + // enable changes in effect chain + unlockEffectChains(effectChains); mLastWriteTime = systemTime(); mInWrite = true; mBytesWritten += mixBufferSize; @@ -2029,7 +2034,7 @@ bool AudioFlinger::MixerThread::threadLoop() nsecs_t delta = now - mLastWriteTime; if (!mStandby && delta > maxPeriod) { mNumDelayedWrites++; - if ((now - lastWarning) > kWarningThrottle) { + if ((now - lastWarning) > kWarningThrottleNs) { LOGW("write blocked for %llu msecs, %d delayed writes, thread %p", ns2ms(delta), mNumDelayedWrites, this); lastWarning = now; @@ -2344,7 +2349,7 @@ bool AudioFlinger::MixerThread::checkForNewParameters_l() } if (param.getInt(String8(AudioParameter::keyFrameCount), value) == NO_ERROR) { // do not accept frame count changes if tracks are open as the track buffer - // size depends on frame count and correct behavior would not be garantied + // size depends on frame count and correct behavior would not be guaranteed // if frame count is changed after track creation if (!mTracks.isEmpty()) { status = INVALID_OPERATION; @@ -2415,7 +2420,7 @@ bool AudioFlinger::MixerThread::checkForNewParameters_l() mParamCond.signal(); // wait for condition with time out in case the thread calling ThreadBase::setParameters() // already timed out waiting for the status and will never signal the condition. - mWaitWorkCV.waitRelative(mLock, kSetParametersTimeout); + mWaitWorkCV.waitRelative(mLock, kSetParametersTimeoutNs); } return reconfig; } @@ -2766,7 +2771,7 @@ bool AudioFlinger::DirectOutputThread::threadLoop() while (frameCount) { buffer.frameCount = frameCount; activeTrack->getNextBuffer(&buffer); - if (UNLIKELY(buffer.raw == 0)) { + if (UNLIKELY(buffer.raw == NULL)) { memset(curBuf, 0, frameCount * mFrameSize); break; } @@ -2891,7 +2896,7 @@ bool AudioFlinger::DirectOutputThread::checkForNewParameters_l() mParamCond.signal(); // wait for condition with time out in case the thread calling ThreadBase::setParameters() // already timed out waiting for the status and will never signal the condition. - mWaitWorkCV.waitRelative(mLock, kSetParametersTimeout); + mWaitWorkCV.waitRelative(mLock, kSetParametersTimeoutNs); } return reconfig; } @@ -3264,7 +3269,7 @@ AudioFlinger::ThreadBase::TrackBase::~TrackBase() void AudioFlinger::ThreadBase::TrackBase::releaseBuffer(AudioBufferProvider::Buffer* buffer) { - buffer->raw = 0; + buffer->raw = NULL; mFrameCount = buffer->frameCount; step(); buffer->frameCount = 0; @@ -3457,14 +3462,14 @@ status_t AudioFlinger::PlaybackThread::Track::getNextBuffer(AudioBufferProvider: } buffer->raw = getBuffer(s, framesReq); - if (buffer->raw == 0) goto getNextBuffer_exit; + if (buffer->raw == NULL) goto getNextBuffer_exit; buffer->frameCount = framesReq; return NO_ERROR; } getNextBuffer_exit: - buffer->raw = 0; + 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; @@ -3705,14 +3710,14 @@ status_t AudioFlinger::RecordThread::RecordTrack::getNextBuffer(AudioBufferProvi } buffer->raw = getBuffer(s, framesReq); - if (buffer->raw == 0) goto getNextBuffer_exit; + if (buffer->raw == NULL) goto getNextBuffer_exit; buffer->frameCount = framesReq; return NO_ERROR; } getNextBuffer_exit: - buffer->raw = 0; + buffer->raw = NULL; buffer->frameCount = 0; return NOT_ENOUGH_DATA; } @@ -4217,7 +4222,7 @@ AudioFlinger::RecordThread::RecordThread(const sp<AudioFlinger>& audioFlinger, int id, uint32_t device) : ThreadBase(audioFlinger, id, device), - mInput(input), mTrack(NULL), mResampler(0), mRsmpOutBuffer(0), mRsmpInBuffer(0) + mInput(input), mTrack(NULL), mResampler(NULL), mRsmpOutBuffer(NULL), mRsmpInBuffer(NULL) { mType = ThreadBase::RECORD; @@ -4232,7 +4237,7 @@ AudioFlinger::RecordThread::RecordThread(const sp<AudioFlinger>& audioFlinger, AudioFlinger::RecordThread::~RecordThread() { delete[] mRsmpInBuffer; - if (mResampler != 0) { + if (mResampler != NULL) { delete mResampler; delete[] mRsmpOutBuffer; } @@ -4326,7 +4331,7 @@ bool AudioFlinger::RecordThread::threadLoop() buffer.frameCount = mFrameCount; if (LIKELY(mActiveTrack->getNextBuffer(&buffer) == NO_ERROR)) { size_t framesOut = buffer.frameCount; - if (mResampler == 0) { + if (mResampler == NULL) { // no resampling while (framesOut) { size_t framesIn = mFrameCount - mRsmpInIndex; @@ -4411,7 +4416,7 @@ bool AudioFlinger::RecordThread::threadLoop() else { if (!mActiveTrack->setOverflow()) { nsecs_t now = systemTime(); - if ((now - lastWarning) > kWarningThrottle) { + if ((now - lastWarning) > kWarningThrottleNs) { LOGW("RecordThread: buffer overflow"); lastWarning = now; } @@ -4584,7 +4589,7 @@ status_t AudioFlinger::RecordThread::dump(int fd, const Vector<String16>& args) result.append(buffer); snprintf(buffer, SIZE, "In size: %d\n", mInputBytes); result.append(buffer); - snprintf(buffer, SIZE, "Resampling: %d\n", (mResampler != 0)); + snprintf(buffer, SIZE, "Resampling: %d\n", (mResampler != NULL)); result.append(buffer); snprintf(buffer, SIZE, "Out channel count: %d\n", mReqChannelCount); result.append(buffer); @@ -4619,7 +4624,7 @@ status_t AudioFlinger::RecordThread::getNextBuffer(AudioBufferProvider::Buffer* mInput->stream->common.standby(&mInput->stream->common); usleep(kRecordThreadSleepUs); } - buffer->raw = 0; + buffer->raw = NULL; buffer->frameCount = 0; return NOT_ENOUGH_DATA; } @@ -4734,7 +4739,7 @@ bool AudioFlinger::RecordThread::checkForNewParameters_l() mParamCond.signal(); // wait for condition with time out in case the thread calling ThreadBase::setParameters() // already timed out waiting for the status and will never signal the condition. - mWaitWorkCV.waitRelative(mLock, kSetParametersTimeout); + mWaitWorkCV.waitRelative(mLock, kSetParametersTimeoutNs); } return reconfig; } @@ -4782,7 +4787,7 @@ void AudioFlinger::RecordThread::readInputParameters() if (mRsmpInBuffer) delete mRsmpInBuffer; if (mRsmpOutBuffer) delete mRsmpOutBuffer; if (mResampler) delete mResampler; - mResampler = 0; + mResampler = NULL; mSampleRate = mInput->stream->common.get_sample_rate(&mInput->stream->common); mChannelMask = mInput->stream->common.get_channels(&mInput->stream->common); diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h index 6cafa7e..9707cf4 100644 --- a/services/audioflinger/AudioFlinger.h +++ b/services/audioflinger/AudioFlinger.h @@ -547,7 +547,7 @@ private: Condition mParamCond; Vector<String8> mNewParameters; status_t mParamStatus; - Vector<ConfigEvent *> mConfigEvents; + Vector<ConfigEvent> mConfigEvents; bool mStandby; int mId; bool mExiting; @@ -703,7 +703,7 @@ private: virtual status_t readyToRun(); virtual void onFirstRef(); - virtual status_t initCheck() const { return (mOutput == 0) ? NO_INIT : NO_ERROR; } + virtual status_t initCheck() const { return (mOutput == NULL) ? NO_INIT : NO_ERROR; } virtual uint32_t latency() const; @@ -980,7 +980,7 @@ private: virtual status_t readyToRun(); virtual void onFirstRef(); - virtual status_t initCheck() const { return (mInput == 0) ? NO_INIT : NO_ERROR; } + virtual status_t initCheck() const { return (mInput == NULL) ? NO_INIT : NO_ERROR; } sp<AudioFlinger::RecordThread::RecordTrack> createRecordTrack_l( const sp<AudioFlinger::Client>& client, uint32_t sampleRate, diff --git a/services/audioflinger/AudioMixer.cpp b/services/audioflinger/AudioMixer.cpp index 8996816..f302b2f 100644 --- a/services/audioflinger/AudioMixer.cpp +++ b/services/audioflinger/AudioMixer.cpp @@ -50,47 +50,53 @@ AudioMixer::AudioMixer(size_t frameCount, uint32_t sampleRate) mState.enabledTracks= 0; mState.needsChanged = 0; mState.frameCount = frameCount; - mState.outputTemp = 0; - mState.resampleTemp = 0; + mState.outputTemp = NULL; + mState.resampleTemp = NULL; mState.hook = process__nop; track_t* t = mState.tracks; for (int i=0 ; i<32 ; i++) { t->needs = 0; t->volume[0] = UNITY_GAIN; t->volume[1] = UNITY_GAIN; + // no initialization needed + // t->prevVolume[0] + // t->prevVolume[1] t->volumeInc[0] = 0; t->volumeInc[1] = 0; t->auxLevel = 0; t->auxInc = 0; + // no initialization needed + // t->prevAuxLevel + // t->frameCount t->channelCount = 2; t->enabled = 0; t->format = 16; t->channelMask = AUDIO_CHANNEL_OUT_STEREO; t->buffer.raw = 0; - t->bufferProvider = 0; - t->hook = 0; - t->resampler = 0; + t->bufferProvider = NULL; + t->hook = NULL; + t->resampler = NULL; t->sampleRate = mSampleRate; - t->in = 0; + t->in = NULL; t->mainBuffer = NULL; t->auxBuffer = NULL; t++; } } - AudioMixer::~AudioMixer() - { - track_t* t = mState.tracks; - for (int i=0 ; i<32 ; i++) { - delete t->resampler; - t++; - } - delete [] mState.outputTemp; - delete [] mState.resampleTemp; - } +AudioMixer::~AudioMixer() +{ + track_t* t = mState.tracks; + for (int i=0 ; i<32 ; i++) { + delete t->resampler; + t++; + } + delete [] mState.outputTemp; + delete [] mState.resampleTemp; +} - int AudioMixer::getTrackName() - { +int AudioMixer::getTrackName() +{ uint32_t names = mTrackNames; uint32_t mask = 1; int n = 0; @@ -104,18 +110,18 @@ AudioMixer::AudioMixer(size_t frameCount, uint32_t sampleRate) return TRACK0 + n; } return -1; - } +} - void AudioMixer::invalidateState(uint32_t mask) - { +void AudioMixer::invalidateState(uint32_t mask) +{ if (mask) { mState.needsChanged |= mask; mState.hook = process__validate; } } - void AudioMixer::deleteTrackName(int name) - { +void AudioMixer::deleteTrackName(int name) +{ name -= TRACK0; if (uint32_t(name) < MAX_NUM_TRACKS) { ALOGV("deleteTrackName(%d)", name); @@ -127,7 +133,7 @@ AudioMixer::AudioMixer(size_t frameCount, uint32_t sampleRate) if (track.resampler) { // delete the resampler delete track.resampler; - track.resampler = 0; + track.resampler = NULL; track.sampleRate = mSampleRate; invalidateState(1<<name); } @@ -135,7 +141,7 @@ AudioMixer::AudioMixer(size_t frameCount, uint32_t sampleRate) track.volumeInc[1] = 0; mTrackNames &= ~(1<<name); } - } +} void AudioMixer::enable() { @@ -276,7 +282,7 @@ bool AudioMixer::track_t::setResampler(uint32_t value, uint32_t devSampleRate) if (value!=devSampleRate || resampler) { if (sampleRate != value) { sampleRate = value; - if (resampler == 0) { + if (resampler == NULL) { resampler = AudioResampler::create( format, channelCount, devSampleRate); } @@ -288,12 +294,12 @@ bool AudioMixer::track_t::setResampler(uint32_t value, uint32_t devSampleRate) bool AudioMixer::track_t::doesResample() const { - return resampler != 0; + return resampler != NULL; } void AudioMixer::track_t::resetResampler() { - if (resampler != 0) { + if (resampler != NULL) { resampler->reset(); } } @@ -416,11 +422,11 @@ void AudioMixer::process__validate(state_t* state) } else { if (state->outputTemp) { delete [] state->outputTemp; - state->outputTemp = 0; + state->outputTemp = NULL; } if (state->resampleTemp) { delete [] state->resampleTemp; - state->resampleTemp = 0; + state->resampleTemp = NULL; } state->hook = process__genericNoResampling; if (all16BitsStereoNoResample && !volumeRamp) { @@ -436,33 +442,33 @@ void AudioMixer::process__validate(state_t* state) countActiveTracks, state->enabledTracks, all16BitsStereoNoResample, resampling, volumeRamp); - state->hook(state); - - // Now that the volume ramp has been done, set optimal state and - // track hooks for subsequent mixer process - if (countActiveTracks) { - int allMuted = 1; - uint32_t en = state->enabledTracks; - while (en) { - const int i = 31 - __builtin_clz(en); - en &= ~(1<<i); - track_t& t = state->tracks[i]; - if (!t.doesResample() && t.volumeRL == 0) - { - t.needs |= NEEDS_MUTE_ENABLED; - t.hook = track__nop; - } else { - allMuted = 0; - } - } - if (allMuted) { - state->hook = process__nop; - } else if (all16BitsStereoNoResample) { - if (countActiveTracks == 1) { - state->hook = process__OneTrack16BitsStereoNoResampling; - } - } - } + state->hook(state); + + // Now that the volume ramp has been done, set optimal state and + // track hooks for subsequent mixer process + if (countActiveTracks) { + int allMuted = 1; + uint32_t en = state->enabledTracks; + while (en) { + const int i = 31 - __builtin_clz(en); + en &= ~(1<<i); + track_t& t = state->tracks[i]; + if (!t.doesResample() && t.volumeRL == 0) + { + t.needs |= NEEDS_MUTE_ENABLED; + t.hook = track__nop; + } else { + allMuted = 0; + } + } + if (allMuted) { + state->hook = process__nop; + } else if (all16BitsStereoNoResample) { + if (countActiveTracks == 1) { + state->hook = process__OneTrack16BitsStereoNoResampling; + } + } + } } static inline @@ -979,7 +985,7 @@ void AudioMixer::process__genericNoResampling(state_t* state) } - // generic code with resampling +// generic code with resampling void AudioMixer::process__genericResampling(state_t* state) { int32_t* const outTemp = state->outputTemp; @@ -1159,7 +1165,7 @@ void AudioMixer::process__TwoTracks16BitsStereoNoResampling(state_t* state) } in1 = buff; b1.frameCount = numFrames; - } else { + } else { in1 = b1.i16; } frameCount1 = b1.frameCount; @@ -1201,4 +1207,3 @@ void AudioMixer::process__TwoTracks16BitsStereoNoResampling(state_t* state) // ---------------------------------------------------------------------------- }; // namespace android - diff --git a/services/audioflinger/AudioMixer.h b/services/audioflinger/AudioMixer.h index 0dc918d..02722d7 100644 --- a/services/audioflinger/AudioMixer.h +++ b/services/audioflinger/AudioMixer.h @@ -64,10 +64,10 @@ public: FORMAT = 0x4001, MAIN_BUFFER = 0x4002, AUX_BUFFER = 0x4003, - // for TARGET RESAMPLE + // for target RESAMPLE SAMPLE_RATE = 0x4100, RESET = 0x4101, - // for TARGET VOLUME (8 channels max) + // for target RAMP_VOLUME and VOLUME (8 channels max) VOLUME0 = 0x4200, VOLUME1 = 0x4201, AUXLEVEL = 0x4210, diff --git a/services/audioflinger/AudioPolicyService.cpp b/services/audioflinger/AudioPolicyService.cpp index 840d70d..bc4c90c 100644 --- a/services/audioflinger/AudioPolicyService.cpp +++ b/services/audioflinger/AudioPolicyService.cpp @@ -31,7 +31,6 @@ #include <utils/threads.h> #include "AudioPolicyService.h" #include <cutils/properties.h> -#include <dlfcn.h> #include <hardware_legacy/power.h> #include <media/AudioEffect.h> #include <media/EffectsFactoryApi.h> diff --git a/services/audioflinger/AudioPolicyService.h b/services/audioflinger/AudioPolicyService.h index d898a53..88cb1e9 100644 --- a/services/audioflinger/AudioPolicyService.h +++ b/services/audioflinger/AudioPolicyService.h @@ -19,6 +19,7 @@ #include <cutils/misc.h> #include <cutils/config_utils.h> +#include <utils/String8.h> #include <utils/Vector.h> #include <utils/SortedVector.h> #include <binder/BinderService.h> @@ -31,8 +32,6 @@ namespace android { -class String8; - // ---------------------------------------------------------------------------- class AudioPolicyService : |