diff options
Diffstat (limited to 'services')
37 files changed, 194 insertions, 175 deletions
diff --git a/services/audioflinger/Android.mk b/services/audioflinger/Android.mk index 54377f1..b895027 100644 --- a/services/audioflinger/Android.mk +++ b/services/audioflinger/Android.mk @@ -19,11 +19,8 @@ LOCAL_SRC_FILES:= \ Tracks.cpp \ Effects.cpp \ AudioMixer.cpp.arm \ - AudioResampler.cpp.arm \ AudioPolicyService.cpp \ ServiceUtilities.cpp \ - AudioResamplerCubic.cpp.arm \ - AudioResamplerSinc.cpp.arm LOCAL_SRC_FILES += StateQueue.cpp @@ -32,6 +29,7 @@ LOCAL_C_INCLUDES := \ $(call include-path-for, audio-utils) LOCAL_SHARED_LIBRARIES := \ + libaudioresampler \ libaudioutils \ libcommon_time_client \ libcutils \ @@ -43,7 +41,6 @@ LOCAL_SHARED_LIBRARIES := \ libhardware \ libhardware_legacy \ libeffects \ - libdl \ libpowermanager LOCAL_STATIC_LIBRARIES := \ @@ -52,6 +49,7 @@ LOCAL_STATIC_LIBRARIES := \ libmedia_helper LOCAL_MODULE:= libaudioflinger +LOCAL_32_BIT_ONLY := true LOCAL_SRC_FILES += FastMixer.cpp FastMixerState.cpp AudioWatchdog.cpp @@ -75,15 +73,9 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES:= \ test-resample.cpp \ - AudioResampler.cpp.arm \ - AudioResamplerCubic.cpp.arm \ - AudioResamplerSinc.cpp.arm LOCAL_SHARED_LIBRARIES := \ - libdl \ - libcutils \ - libutils \ - liblog + libaudioresampler \ LOCAL_MODULE:= test-resample @@ -91,4 +83,20 @@ LOCAL_MODULE_TAGS := optional include $(BUILD_EXECUTABLE) +include $(CLEAR_VARS) + +LOCAL_SRC_FILES:= \ + AudioResampler.cpp.arm \ + AudioResamplerCubic.cpp.arm \ + AudioResamplerSinc.cpp.arm + +LOCAL_SHARED_LIBRARIES := \ + libcutils \ + libdl \ + liblog + +LOCAL_MODULE := libaudioresampler + +include $(BUILD_SHARED_LIBRARY) + include $(call all-makefiles-under,$(LOCAL_PATH)) diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp index acbd19a..26dac95 100644 --- a/services/audioflinger/AudioFlinger.cpp +++ b/services/audioflinger/AudioFlinger.cpp @@ -1012,7 +1012,7 @@ size_t AudioFlinger::getInputBufferSize(uint32_t sampleRate, audio_format_t form return size; } -unsigned int AudioFlinger::getInputFramesLost(audio_io_handle_t ioHandle) const +uint32_t AudioFlinger::getInputFramesLost(audio_io_handle_t ioHandle) const { Mutex::Autolock _l(mLock); @@ -1044,7 +1044,7 @@ status_t AudioFlinger::setVoiceVolume(float value) return ret; } -status_t AudioFlinger::getRenderPosition(size_t *halFrames, size_t *dspFrames, +status_t AudioFlinger::getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames, audio_io_handle_t output) const { status_t status; diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h index 53e238e..7320144 100644 --- a/services/audioflinger/AudioFlinger.h +++ b/services/audioflinger/AudioFlinger.h @@ -186,10 +186,10 @@ public: virtual status_t setVoiceVolume(float volume); - virtual status_t getRenderPosition(size_t *halFrames, size_t *dspFrames, + virtual status_t getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames, audio_io_handle_t output) const; - virtual unsigned int getInputFramesLost(audio_io_handle_t ioHandle) const; + virtual uint32_t getInputFramesLost(audio_io_handle_t ioHandle) const; virtual int newAudioSessionId(); diff --git a/services/audioflinger/AudioMixer.cpp b/services/audioflinger/AudioMixer.cpp index 07dc6dd..f92421e 100644 --- a/services/audioflinger/AudioMixer.cpp +++ b/services/audioflinger/AudioMixer.cpp @@ -421,15 +421,16 @@ void AudioMixer::setParameter(int name, int target, int param, void *value) ALOG_ASSERT(uint32_t(name) < MAX_NUM_TRACKS, "bad track name %d", name); track_t& track = mState.tracks[name]; - int valueInt = (int)value; - int32_t *valueBuf = (int32_t *)value; + int valueInt = static_cast<int>(reinterpret_cast<uintptr_t>(value)); + int32_t *valueBuf = reinterpret_cast<int32_t*>(value); switch (target) { case TRACK: switch (param) { case CHANNEL_MASK: { - audio_channel_mask_t mask = (audio_channel_mask_t) value; + audio_channel_mask_t mask = + static_cast<audio_channel_mask_t>(reinterpret_cast<uintptr_t>(value)); if (track.channelMask != mask) { uint32_t channelCount = popcount(mask); ALOG_ASSERT((channelCount <= MAX_NUM_CHANNELS_TO_DOWNMIX) && channelCount); diff --git a/services/audioflinger/AudioPolicyService.cpp b/services/audioflinger/AudioPolicyService.cpp index 35e816b..a37272d 100644 --- a/services/audioflinger/AudioPolicyService.cpp +++ b/services/audioflinger/AudioPolicyService.cpp @@ -1301,7 +1301,7 @@ effect_param_t *AudioPolicyService::loadEffectParameter(cnode *root) return fx_param; error: - delete fx_param; + free(fx_param); return NULL; } @@ -1433,6 +1433,14 @@ status_t AudioPolicyService::loadPreProcessorConfig(const char *path) loadEffects(root, effects); loadInputSources(root, effects); + // delete effects to fix memory leak. + // as effects is local var and valgrind would treat this as memory leak + // and although it only did in mediaserver init, but free it in case mediaserver reboot + size_t i; + for (i = 0; i < effects.size(); i++) { + delete effects[i]; + } + config_free(root); free(root); free(data); diff --git a/services/audioflinger/AudioResampler.cpp b/services/audioflinger/AudioResampler.cpp index 2c3c719..e5cceb1 100644 --- a/services/audioflinger/AudioResampler.cpp +++ b/services/audioflinger/AudioResampler.cpp @@ -526,7 +526,7 @@ void AudioResamplerOrder1::AsmMono16Loop(int16_t *in, int32_t* maxOutPt, int32_t " ldr r8, [sp, #" MO_PARAM5 " + 4]\n" // out " ldr r0, [sp, #" MO_PARAM5 " + 0]\n" // &outputIndex " ldr r0, [r0]\n" // outputIndex - " add r8, r0, asl #2\n" // curOut + " add r8, r8, r0, asl #2\n" // curOut " ldr r9, [sp, #" MO_PARAM5 " + 24]\n" // phaseIncrement " ldr r10, [sp, #" MO_PARAM5 " + 12]\n" // vl " ldr r11, [sp, #" MO_PARAM5 " + 16]\n" // vr @@ -636,7 +636,7 @@ void AudioResamplerOrder1::AsmStereo16Loop(int16_t *in, int32_t* maxOutPt, int32 " ldr r8, [sp, #" ST_PARAM5 " + 4]\n" // out " ldr r0, [sp, #" ST_PARAM5 " + 0]\n" // &outputIndex " ldr r0, [r0]\n" // outputIndex - " add r8, r0, asl #2\n" // curOut + " add r8, r8, r0, asl #2\n" // curOut " ldr r9, [sp, #" ST_PARAM5 " + 24]\n" // phaseIncrement " ldr r10, [sp, #" ST_PARAM5 " + 12]\n" // vl " ldr r11, [sp, #" ST_PARAM5 " + 16]\n" // vr diff --git a/services/audioflinger/Configuration.h b/services/audioflinger/Configuration.h index bc2038a..0754d9d 100644 --- a/services/audioflinger/Configuration.h +++ b/services/audioflinger/Configuration.h @@ -32,9 +32,6 @@ // uncomment to enable fast mixer to take performance samples for later statistical analysis #define FAST_MIXER_STATISTICS -// uncomment to allow fast tracks at non-native sample rate -//#define FAST_TRACKS_AT_NON_NATIVE_SAMPLE_RATE - // uncomment for debugging timing problems related to StateQueue::push() //#define STATE_QUEUE_DUMP diff --git a/services/audioflinger/Effects.cpp b/services/audioflinger/Effects.cpp index a8a5169..010e233 100644 --- a/services/audioflinger/Effects.cpp +++ b/services/audioflinger/Effects.cpp @@ -820,8 +820,8 @@ void AudioFlinger::EffectModule::dump(int fd, const Vector<String16>& args) } result.append("\t\tSession Status State Engine:\n"); - snprintf(buffer, SIZE, "\t\t%05d %03d %03d 0x%08x\n", - mSessionId, mStatus, mState, (uint32_t)mEffectInterface); + snprintf(buffer, SIZE, "\t\t%05d %03d %03d %p\n", + mSessionId, mStatus, mState, mEffectInterface); result.append(buffer); result.append("\t\tDescriptor:\n"); @@ -850,26 +850,26 @@ void AudioFlinger::EffectModule::dump(int fd, const Vector<String16>& args) result.append(buffer); result.append("\t\t- Input configuration:\n"); - result.append("\t\t\tBuffer Frames Smp rate Channels Format\n"); - snprintf(buffer, SIZE, "\t\t\t0x%08x %05d %05d %08x %d\n", - (uint32_t)mConfig.inputCfg.buffer.raw, + result.append("\t\t\tFrames Smp rate Channels Format Buffer\n"); + snprintf(buffer, SIZE, "\t\t\t%05zu %05d %08x %6d %p\n", mConfig.inputCfg.buffer.frameCount, mConfig.inputCfg.samplingRate, mConfig.inputCfg.channels, - mConfig.inputCfg.format); + mConfig.inputCfg.format, + mConfig.inputCfg.buffer.raw); result.append(buffer); result.append("\t\t- Output configuration:\n"); result.append("\t\t\tBuffer Frames Smp rate Channels Format\n"); - snprintf(buffer, SIZE, "\t\t\t0x%08x %05d %05d %08x %d\n", - (uint32_t)mConfig.outputCfg.buffer.raw, + snprintf(buffer, SIZE, "\t\t\t%p %05zu %05d %08x %d\n", + mConfig.outputCfg.buffer.raw, mConfig.outputCfg.buffer.frameCount, mConfig.outputCfg.samplingRate, mConfig.outputCfg.channels, mConfig.outputCfg.format); result.append(buffer); - snprintf(buffer, SIZE, "\t\t%d Clients:\n", mHandles.size()); + snprintf(buffer, SIZE, "\t\t%zu Clients:\n", mHandles.size()); result.append(buffer); result.append("\t\t\tPid Priority Ctrl Locked client server\n"); for (size_t i = 0; i < mHandles.size(); ++i) { @@ -1578,10 +1578,10 @@ void AudioFlinger::EffectChain::dump(int fd, const Vector<String16>& args) } result.append("\tNum fx In buffer Out buffer Active tracks:\n"); - snprintf(buffer, SIZE, "\t%02d 0x%08x 0x%08x %d\n", + snprintf(buffer, SIZE, "\t%02zu %p %p %d\n", mEffects.size(), - (uint32_t)mInBuffer, - (uint32_t)mOutBuffer, + mInBuffer, + mOutBuffer, mActiveTrackCnt); result.append(buffer); write(fd, result.string(), result.size()); diff --git a/services/audioflinger/FastMixer.cpp b/services/audioflinger/FastMixer.cpp index f27ea17..85d637e 100644 --- a/services/audioflinger/FastMixer.cpp +++ b/services/audioflinger/FastMixer.cpp @@ -236,7 +236,6 @@ bool FastMixer::threadLoop() sampleRate = Format_sampleRate(format); ALOG_ASSERT(Format_channelCount(format) == FCC_2); } - dumpState->mSampleRate = sampleRate; } if ((format != previousFormat) || (frameCount != previous->mFrameCount)) { @@ -321,12 +320,8 @@ bool FastMixer::threadLoop() mixer->setParameter(name, AudioMixer::TRACK, AudioMixer::MAIN_BUFFER, (void *) mixBuffer); // newly allocated track names default to full scale volume - if (fastTrack->mSampleRate != 0 && fastTrack->mSampleRate != sampleRate) { - mixer->setParameter(name, AudioMixer::RESAMPLE, - AudioMixer::SAMPLE_RATE, (void*) fastTrack->mSampleRate); - } mixer->setParameter(name, AudioMixer::TRACK, AudioMixer::CHANNEL_MASK, - (void *) fastTrack->mChannelMask); + (void *)(uintptr_t)fastTrack->mChannelMask); mixer->enable(name); } generations[i] = fastTrack->mGeneration; @@ -353,16 +348,10 @@ bool FastMixer::threadLoop() mixer->setParameter(name, AudioMixer::VOLUME, AudioMixer::VOLUME1, (void *)0x1000); } - if (fastTrack->mSampleRate != 0 && - fastTrack->mSampleRate != sampleRate) { - mixer->setParameter(name, AudioMixer::RESAMPLE, - AudioMixer::SAMPLE_RATE, (void*) fastTrack->mSampleRate); - } else { - mixer->setParameter(name, AudioMixer::RESAMPLE, - AudioMixer::REMOVE, NULL); - } + mixer->setParameter(name, AudioMixer::RESAMPLE, + AudioMixer::REMOVE, NULL); mixer->setParameter(name, AudioMixer::TRACK, AudioMixer::CHANNEL_MASK, - (void *) fastTrack->mChannelMask); + (void *)(uintptr_t) fastTrack->mChannelMask); // already enabled } generations[i] = fastTrack->mGeneration; @@ -392,16 +381,8 @@ bool FastMixer::threadLoop() // Refresh the per-track timestamp if (timestampStatus == NO_ERROR) { - uint32_t trackFramesWrittenButNotPresented; - uint32_t trackSampleRate = fastTrack->mSampleRate; - // There is currently no sample rate conversion for fast tracks currently - if (trackSampleRate != 0 && trackSampleRate != sampleRate) { - trackFramesWrittenButNotPresented = - ((int64_t) nativeFramesWrittenButNotPresented * trackSampleRate) / - sampleRate; - } else { - trackFramesWrittenButNotPresented = nativeFramesWrittenButNotPresented; - } + uint32_t trackFramesWrittenButNotPresented = + nativeFramesWrittenButNotPresented; uint32_t trackFramesWritten = fastTrack->mBufferProvider->framesReleased(); // Can't provide an AudioTimestamp before first frame presented, // or during the brief 32-bit wraparound window @@ -419,9 +400,9 @@ bool FastMixer::threadLoop() if (fastTrack->mVolumeProvider != NULL) { uint32_t vlr = fastTrack->mVolumeProvider->getVolumeLR(); mixer->setParameter(name, AudioMixer::VOLUME, AudioMixer::VOLUME0, - (void *)(vlr & 0xFFFF)); + (void *)(uintptr_t)(vlr & 0xFFFF)); mixer->setParameter(name, AudioMixer::VOLUME, AudioMixer::VOLUME1, - (void *)(vlr >> 16)); + (void *)(uintptr_t)(vlr >> 16)); } // FIXME The current implementation of framesReady() for fast tracks // takes a tryLock, which can block @@ -750,7 +731,7 @@ void FastMixerDumpState::dump(int fd) const double mixPeriodSec = (double) mFrameCount / (double) mSampleRate; fdprintf(fd, "FastMixer command=%s writeSequence=%u framesWritten=%u\n" " numTracks=%u writeErrors=%u underruns=%u overruns=%u\n" - " sampleRate=%u frameCount=%u measuredWarmup=%.3g ms, warmupCycles=%u\n" + " sampleRate=%u frameCount=%zu measuredWarmup=%.3g ms, warmupCycles=%u\n" " mixPeriod=%.2f ms\n", string, mWriteSequence, mFramesWritten, mNumTracks, mWriteErrors, mUnderruns, mOverruns, @@ -864,7 +845,7 @@ void FastMixerDumpState::dump(int fd) const mostRecent = "?"; break; } - fdprintf(fd, "%5u %6s %4u %7u %5u %7s %5u\n", i, isActive ? "yes" : "no", + fdprintf(fd, "%5u %6s %4u %7u %5u %7s %5zu\n", i, isActive ? "yes" : "no", (underruns.mBitFields.mFull) & UNDERRUN_MASK, (underruns.mBitFields.mPartial) & UNDERRUN_MASK, (underruns.mBitFields.mEmpty) & UNDERRUN_MASK, diff --git a/services/audioflinger/FastMixerState.cpp b/services/audioflinger/FastMixerState.cpp index 737de97..43ff233 100644 --- a/services/audioflinger/FastMixerState.cpp +++ b/services/audioflinger/FastMixerState.cpp @@ -20,7 +20,7 @@ namespace android { FastTrack::FastTrack() : - mBufferProvider(NULL), mVolumeProvider(NULL), mSampleRate(0), + mBufferProvider(NULL), mVolumeProvider(NULL), mChannelMask(AUDIO_CHANNEL_OUT_STEREO), mGeneration(0) { } diff --git a/services/audioflinger/FastMixerState.h b/services/audioflinger/FastMixerState.h index f6e7903..9739fe9 100644 --- a/services/audioflinger/FastMixerState.h +++ b/services/audioflinger/FastMixerState.h @@ -43,7 +43,6 @@ struct FastTrack { ExtendedAudioBufferProvider* mBufferProvider; // must be NULL if inactive, or non-NULL if active VolumeProvider* mVolumeProvider; // optional; if NULL then full-scale - unsigned mSampleRate; // optional; if zero then use mixer sample rate audio_channel_mask_t mChannelMask; // AUDIO_CHANNEL_OUT_MONO or AUDIO_CHANNEL_OUT_STEREO int mGeneration; // increment when any field is assigned }; diff --git a/services/audioflinger/StateQueue.cpp b/services/audioflinger/StateQueue.cpp index c2d3bbd..48399c0 100644 --- a/services/audioflinger/StateQueue.cpp +++ b/services/audioflinger/StateQueue.cpp @@ -58,7 +58,11 @@ template<typename T> StateQueue<T>::~StateQueue() template<typename T> const T* StateQueue<T>::poll() { +#ifdef __LP64__ + const T *next = (const T *) android_atomic_acquire_load64((volatile int64_t *) &mNext); +#else const T *next = (const T *) android_atomic_acquire_load((volatile int32_t *) &mNext); +#endif if (next != mCurrent) { mAck = next; // no additional barrier needed mCurrent = next; @@ -140,7 +144,11 @@ template<typename T> bool StateQueue<T>::push(StateQueue<T>::block_t block) } // publish +#ifdef __LP64__ + android_atomic_release_store64((int64_t) mMutating, (volatile int64_t *) &mNext); +#else android_atomic_release_store((int32_t) mMutating, (volatile int32_t *) &mNext); +#endif mExpecting = mMutating; // copy with circular wraparound diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp index 3d657b3..cac785a 100644 --- a/services/audioflinger/Threads.cpp +++ b/services/audioflinger/Threads.cpp @@ -425,7 +425,7 @@ void AudioFlinger::ThreadBase::dumpBase(int fd, const Vector<String16>& args) result.append(buffer); snprintf(buffer, SIZE, "Sample rate: %u\n", mSampleRate); result.append(buffer); - snprintf(buffer, SIZE, "HAL frame count: %d\n", mFrameCount); + snprintf(buffer, SIZE, "HAL frame count: %zu\n", mFrameCount); result.append(buffer); snprintf(buffer, SIZE, "Channel Count: %u\n", mChannelCount); result.append(buffer); @@ -433,14 +433,14 @@ void AudioFlinger::ThreadBase::dumpBase(int fd, const Vector<String16>& args) result.append(buffer); snprintf(buffer, SIZE, "Format: %d\n", mFormat); result.append(buffer); - snprintf(buffer, SIZE, "Frame size: %u\n", mFrameSize); + snprintf(buffer, SIZE, "Frame size: %zu\n", mFrameSize); result.append(buffer); snprintf(buffer, SIZE, "\nPending setParameters commands: \n"); result.append(buffer); result.append(" Index Command"); for (size_t i = 0; i < mNewParameters.size(); ++i) { - snprintf(buffer, SIZE, "\n %02d ", i); + snprintf(buffer, SIZE, "\n %02zu ", i); result.append(buffer); result.append(mNewParameters[i]); } @@ -466,7 +466,7 @@ void AudioFlinger::ThreadBase::dumpEffectChains(int fd, const Vector<String16>& char buffer[SIZE]; String8 result; - snprintf(buffer, SIZE, "\n- %d Effect Chains:\n", mEffectChains.size()); + snprintf(buffer, SIZE, "\n- %zu Effect Chains:\n", mEffectChains.size()); write(fd, buffer, strlen(buffer)); for (size_t i = 0; i < mEffectChains.size(); ++i) { @@ -1128,7 +1128,7 @@ void AudioFlinger::PlaybackThread::dumpInternals(int fd, const Vector<String16>& snprintf(buffer, SIZE, "\nOutput thread %p internals\n", this); result.append(buffer); - snprintf(buffer, SIZE, "Normal frame count: %d\n", mNormalFrameCount); + snprintf(buffer, SIZE, "Normal frame count: %zu\n", mNormalFrameCount); result.append(buffer); snprintf(buffer, SIZE, "last write occurred (msecs): %llu\n", ns2ms(systemTime() - mLastWriteTime)); @@ -1218,10 +1218,8 @@ sp<AudioFlinger::PlaybackThread::Track> AudioFlinger::PlaybackThread::createTrac // mono or stereo ( (channelMask == AUDIO_CHANNEL_OUT_MONO) || (channelMask == AUDIO_CHANNEL_OUT_STEREO) ) && -#ifndef FAST_TRACKS_AT_NON_NATIVE_SAMPLE_RATE // hardware sample rate (sampleRate == mSampleRate) && -#endif // normal mixer has an associated fast mixer hasFastMixer() && // there are sufficient fast track slots available @@ -1720,7 +1718,7 @@ void AudioFlinger::PlaybackThread::readOutputParameters() } -status_t AudioFlinger::PlaybackThread::getRenderPosition(size_t *halFrames, size_t *dspFrames) +status_t AudioFlinger::PlaybackThread::getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames) { if (halFrames == NULL || dspFrames == NULL) { return BAD_VALUE; @@ -1738,7 +1736,11 @@ status_t AudioFlinger::PlaybackThread::getRenderPosition(size_t *halFrames, size *dspFrames = framesWritten >= latencyFrames ? framesWritten - latencyFrames : 0; return NO_ERROR; } else { - return mOutput->stream->get_render_position(mOutput->stream, dspFrames); + status_t status; + uint32_t frames; + status = mOutput->stream->get_render_position(mOutput->stream, &frames); + *dspFrames = (size_t)frames; + return status; } } @@ -2975,7 +2977,6 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::MixerThread::prepareTrac VolumeProvider *vp = track; fastTrack->mBufferProvider = eabp; fastTrack->mVolumeProvider = vp; - fastTrack->mSampleRate = track->mSampleRate; fastTrack->mChannelMask = track->mChannelMask; fastTrack->mGeneration++; state->mTrackMask |= 1 << j; @@ -3152,9 +3153,9 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::MixerThread::prepareTrac mAudioMixer->setBufferProvider(name, track); mAudioMixer->enable(name); - mAudioMixer->setParameter(name, param, AudioMixer::VOLUME0, (void *)vl); - mAudioMixer->setParameter(name, param, AudioMixer::VOLUME1, (void *)vr); - mAudioMixer->setParameter(name, param, AudioMixer::AUXLEVEL, (void *)va); + mAudioMixer->setParameter(name, param, AudioMixer::VOLUME0, (void *)(uintptr_t)vl); + mAudioMixer->setParameter(name, param, AudioMixer::VOLUME1, (void *)(uintptr_t)vr); + mAudioMixer->setParameter(name, param, AudioMixer::AUXLEVEL, (void *)(uintptr_t)va); mAudioMixer->setParameter( name, AudioMixer::TRACK, @@ -3162,7 +3163,7 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::MixerThread::prepareTrac mAudioMixer->setParameter( name, AudioMixer::TRACK, - AudioMixer::CHANNEL_MASK, (void *)track->channelMask()); + AudioMixer::CHANNEL_MASK, (void *)(uintptr_t)track->channelMask()); // limit track sample rate to 2 x output sample rate, which changes at re-configuration uint32_t maxSampleRate = mSampleRate * 2; uint32_t reqSampleRate = track->mAudioTrackServerProxy->getSampleRate(); @@ -3175,7 +3176,7 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::MixerThread::prepareTrac name, AudioMixer::RESAMPLE, AudioMixer::SAMPLE_RATE, - (void *)reqSampleRate); + (void *)(uintptr_t)reqSampleRate); mAudioMixer->setParameter( name, AudioMixer::TRACK, @@ -4959,9 +4960,9 @@ void AudioFlinger::RecordThread::dumpInternals(int fd, const Vector<String16>& a result.append(buffer); if (mActiveTrack != 0) { - snprintf(buffer, SIZE, "In index: %d\n", mRsmpInIndex); + snprintf(buffer, SIZE, "In index: %zu\n", mRsmpInIndex); result.append(buffer); - snprintf(buffer, SIZE, "Buffer size: %u bytes\n", mBufferSize); + snprintf(buffer, SIZE, "Buffer size: %zu bytes\n", mBufferSize); result.append(buffer); snprintf(buffer, SIZE, "Resampling: %d\n", (mResampler != NULL)); result.append(buffer); diff --git a/services/audioflinger/Threads.h b/services/audioflinger/Threads.h index 207f1eb..a2fb874 100644 --- a/services/audioflinger/Threads.h +++ b/services/audioflinger/Threads.h @@ -446,7 +446,7 @@ public: virtual String8 getParameters(const String8& keys); virtual void audioConfigChanged_l(int event, int param = 0); - status_t getRenderPosition(size_t *halFrames, size_t *dspFrames); + status_t getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames); int16_t *mixBuffer() const { return mMixBuffer; }; virtual void detachAuxEffect_l(int effectId); diff --git a/services/audioflinger/Tracks.cpp b/services/audioflinger/Tracks.cpp index d6b9908..813ec8a 100644 --- a/services/audioflinger/Tracks.cpp +++ b/services/audioflinger/Tracks.cpp @@ -487,8 +487,8 @@ void AudioFlinger::PlaybackThread::Track::dump(char* buffer, size_t size) nowInUnderrun = '?'; break; } - snprintf(&buffer[7], size-7, " %6u %4u %08X %08X %7u %6u %1c %1d %5u %5.2g %5.2g " - "%08X %08X %08X 0x%03X %9u%c\n", + snprintf(&buffer[7], size-7, " %6u %4u %08X %08X %7u %6zu %1c %1d %5u %5.2g %5.2g " + "%08X %p %p 0x%03X %9u%c\n", (mClient == 0) ? getpid_cached : mClient->pid(), mStreamType, mFormat, @@ -501,8 +501,8 @@ void AudioFlinger::PlaybackThread::Track::dump(char* buffer, size_t size) 20.0 * log10((vlr & 0xFFFF) / 4096.0), 20.0 * log10((vlr >> 16) / 4096.0), mCblk->mServer, - (int)mMainBuffer, - (int)mAuxBuffer, + mMainBuffer, + mAuxBuffer, mCblk->mFlags, mAudioTrackServerProxy->getUnderrunFrames(), nowInUnderrun); @@ -1850,7 +1850,7 @@ void AudioFlinger::RecordThread::RecordTrack::invalidate() void AudioFlinger::RecordThread::RecordTrack::dump(char* buffer, size_t size) { - snprintf(buffer, size, "%6u %3u %08X %7u %1d %08X %6u\n", + snprintf(buffer, size, "%6u %3u %08X %7u %1d %08X %6zu\n", (mClient == 0) ? getpid_cached : mClient->pid(), mFormat, mChannelMask, diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp index 5957d97..9ce7daf 100644 --- a/services/camera/libcameraservice/CameraService.cpp +++ b/services/camera/libcameraservice/CameraService.cpp @@ -196,7 +196,7 @@ void CameraService::onDeviceStatusChanged(int cameraId, */ } - ALOGV("%s: After unplug, disconnected %d clients", + ALOGV("%s: After unplug, disconnected %zu clients", __FUNCTION__, clientsToDisconnect.size()); } @@ -1052,13 +1052,13 @@ void CameraService::BasicClient::opChanged(int32_t op, const String16& packageNa // ---------------------------------------------------------------------------- Mutex* CameraService::Client::getClientLockFromCookie(void* user) { - return gCameraService->getClientLockById((int) user); + return gCameraService->getClientLockById((int)(intptr_t) user); } // Provide client pointer for callbacks. Client lock returned from getClientLockFromCookie should // be acquired for this to be safe CameraService::Client* CameraService::Client::getClientFromCookie(void* user) { - BasicClient *basicClient = gCameraService->getClientByIdUnsafe((int) user); + BasicClient *basicClient = gCameraService->getClientByIdUnsafe((int)(intptr_t) user); // OK: only CameraClient calls this, and they already cast anyway. Client* client = static_cast<Client*>(basicClient); @@ -1169,6 +1169,7 @@ status_t CameraService::dump(int fd, const Vector<String16>& args) { if (!mModule) { result = String8::format("No camera module available!\n"); write(fd, result.string(), result.size()); + if (locked) mServiceLock.unlock(); return NO_ERROR; } diff --git a/services/camera/libcameraservice/api1/Camera2Client.cpp b/services/camera/libcameraservice/api1/Camera2Client.cpp index b093946..af23557 100644 --- a/services/camera/libcameraservice/api1/Camera2Client.cpp +++ b/services/camera/libcameraservice/api1/Camera2Client.cpp @@ -18,6 +18,7 @@ #define ATRACE_TAG ATRACE_TAG_CAMERA //#define LOG_NDEBUG 0 +#include <inttypes.h> #include <utils/Log.h> #include <utils/Trace.h> @@ -193,7 +194,7 @@ status_t Camera2Client::dump(int fd, const Vector<String16>& args) { result.appendFormat(" GPS lat x long x alt: %f x %f x %f\n", p.gpsCoordinates[0], p.gpsCoordinates[1], p.gpsCoordinates[2]); - result.appendFormat(" GPS timestamp: %lld\n", + result.appendFormat(" GPS timestamp: %" PRId64 "\n", p.gpsTimestamp); result.appendFormat(" GPS processing method: %s\n", p.gpsProcessingMethod.string()); diff --git a/services/camera/libcameraservice/api1/CameraClient.cpp b/services/camera/libcameraservice/api1/CameraClient.cpp index bd6805d..30b7bb8 100644 --- a/services/camera/libcameraservice/api1/CameraClient.cpp +++ b/services/camera/libcameraservice/api1/CameraClient.cpp @@ -85,7 +85,7 @@ status_t CameraClient::initialize(camera_module_t *module) { mHardware->setCallbacks(notifyCallback, dataCallback, dataCallbackTimestamp, - (void *)mCameraId); + (void *)(uintptr_t)mCameraId); // Enable zoom, error, focus, and metadata messages by default enableMsgType(CAMERA_MSG_ERROR | CAMERA_MSG_ZOOM | CAMERA_MSG_FOCUS | diff --git a/services/camera/libcameraservice/api1/client2/CaptureSequencer.cpp b/services/camera/libcameraservice/api1/client2/CaptureSequencer.cpp index 8a4ce4e..f5c28ed 100644 --- a/services/camera/libcameraservice/api1/client2/CaptureSequencer.cpp +++ b/services/camera/libcameraservice/api1/client2/CaptureSequencer.cpp @@ -18,6 +18,8 @@ #define ATRACE_TAG ATRACE_TAG_CAMERA //#define LOG_NDEBUG 0 +#include <inttypes.h> + #include <utils/Log.h> #include <utils/Trace.h> #include <utils/Vector.h> @@ -585,8 +587,8 @@ CaptureSequencer::CaptureState CaptureSequencer::manageStandardCaptureWait( ALOGE("No timestamp field in capture frame!"); } if (entry.data.i64[0] != mCaptureTimestamp) { - ALOGW("Mismatched capture timestamps: Metadata frame %lld," - " captured buffer %lld", + ALOGW("Mismatched capture timestamps: Metadata frame %" PRId64 "," + " captured buffer %" PRId64, entry.data.i64[0], mCaptureTimestamp); } diff --git a/services/camera/libcameraservice/api1/client2/FrameProcessor.cpp b/services/camera/libcameraservice/api1/client2/FrameProcessor.cpp index 19acae4..dd5b27c 100644 --- a/services/camera/libcameraservice/api1/client2/FrameProcessor.cpp +++ b/services/camera/libcameraservice/api1/client2/FrameProcessor.cpp @@ -168,7 +168,7 @@ status_t FrameProcessor::processFaceDetect(const CameraMetadata &frame, continue; } if (faceScores[i] > 100) { - ALOGW("%s: Face index %d with out of range score %d", + ALOGW("%s: Face index %zu with out of range score %d", __FUNCTION__, i, faceScores[i]); } diff --git a/services/camera/libcameraservice/api1/client2/JpegCompressor.cpp b/services/camera/libcameraservice/api1/client2/JpegCompressor.cpp index 2f0c67d..9ecab71 100644 --- a/services/camera/libcameraservice/api1/client2/JpegCompressor.cpp +++ b/services/camera/libcameraservice/api1/client2/JpegCompressor.cpp @@ -197,7 +197,7 @@ void JpegCompressor::jpegErrorHandler(j_common_ptr cinfo) { void JpegCompressor::jpegInitDestination(j_compress_ptr cinfo) { ALOGV("%s", __FUNCTION__); JpegDestination *dest= static_cast<JpegDestination*>(cinfo->dest); - ALOGV("%s: Setting destination to %p, size %d", + ALOGV("%s: Setting destination to %p, size %zu", __FUNCTION__, dest->parent->mJpegBuffer->data, kMaxJpegSize); dest->next_output_byte = (JOCTET*)(dest->parent->mJpegBuffer->data); dest->free_in_buffer = kMaxJpegSize; @@ -213,7 +213,7 @@ boolean JpegCompressor::jpegEmptyOutputBuffer(j_compress_ptr /*cinfo*/) { void JpegCompressor::jpegTermDestination(j_compress_ptr cinfo) { (void) cinfo; // TODO: clean up ALOGV("%s", __FUNCTION__); - ALOGV("%s: Done writing JPEG data. %d bytes left in buffer", + ALOGV("%s: Done writing JPEG data. %zu bytes left in buffer", __FUNCTION__, cinfo->dest->free_in_buffer); } diff --git a/services/camera/libcameraservice/api1/client2/JpegProcessor.cpp b/services/camera/libcameraservice/api1/client2/JpegProcessor.cpp index ec81456..2de7a2b 100644 --- a/services/camera/libcameraservice/api1/client2/JpegProcessor.cpp +++ b/services/camera/libcameraservice/api1/client2/JpegProcessor.cpp @@ -241,7 +241,7 @@ status_t JpegProcessor::processNewCapture() { size_t heapSize = mCaptureHeap->getSize(); if (jpegSize > heapSize) { ALOGW("%s: JPEG image is larger than expected, truncating " - "(got %d, expected at most %d bytes)", + "(got %zu, expected at most %zu bytes)", __FUNCTION__, jpegSize, heapSize); jpegSize = heapSize; } @@ -335,13 +335,13 @@ size_t JpegProcessor::findJpegSize(uint8_t* jpegBuffer, size_t maxSize) { size_t offset = size - MARKER_LENGTH; uint8_t *end = jpegBuffer + offset; if (checkJpegStart(jpegBuffer) && checkJpegEnd(end)) { - ALOGV("Found JPEG transport header, img size %d", size); + ALOGV("Found JPEG transport header, img size %zu", size); return size; } else { ALOGW("Found JPEG transport header with bad Image Start/End"); } } else { - ALOGW("Found JPEG transport header with bad size %d", size); + ALOGW("Found JPEG transport header with bad size %zu", size); } } @@ -357,15 +357,15 @@ size_t JpegProcessor::findJpegSize(uint8_t* jpegBuffer, size_t maxSize) { segment_t *segment = (segment_t*)(jpegBuffer + size); uint8_t type = checkJpegMarker(segment->marker); if (type == 0) { // invalid marker, no more segments, begin JPEG data - ALOGV("JPEG stream found beginning at offset %d", size); + ALOGV("JPEG stream found beginning at offset %zu", size); break; } if (type == EOI || size > maxSize - sizeof(segment_t)) { - ALOGE("Got premature End before JPEG data, offset %d", size); + ALOGE("Got premature End before JPEG data, offset %zu", size); return 0; } size_t length = ntohs(segment->length); - ALOGV("JFIF Segment, type %x length %x", type, length); + ALOGV("JFIF Segment, type %x length %zx", type, length); size += length + MARKER_LENGTH; } @@ -385,10 +385,10 @@ size_t JpegProcessor::findJpegSize(uint8_t* jpegBuffer, size_t maxSize) { } if (size > maxSize) { - ALOGW("JPEG size %d too large, reducing to maxSize %d", size, maxSize); + ALOGW("JPEG size %zu too large, reducing to maxSize %zu", size, maxSize); size = maxSize; } - ALOGV("Final JPEG size %d", size); + ALOGV("Final JPEG size %zu", size); return size; } diff --git a/services/camera/libcameraservice/api1/client2/Parameters.cpp b/services/camera/libcameraservice/api1/client2/Parameters.cpp index 61e3588..07654c0 100644 --- a/services/camera/libcameraservice/api1/client2/Parameters.cpp +++ b/services/camera/libcameraservice/api1/client2/Parameters.cpp @@ -948,7 +948,7 @@ status_t Parameters::buildFastInfo() { if (sceneModeOverrides.count != availableSceneModes.count * kModesPerSceneMode) { ALOGE("%s: Camera %d: Scene mode override list is an " - "unexpected size: %d (expected %d)", __FUNCTION__, + "unexpected size: %zu (expected %zu)", __FUNCTION__, cameraId, sceneModeOverrides.count, availableSceneModes.count); return NO_INIT; @@ -1078,7 +1078,7 @@ camera_metadata_ro_entry_t Parameters::staticInfo(uint32_t tag, const char* tagName = get_camera_metadata_tag_name(tag); if (tagName == NULL) tagName = "<unknown>"; ALOGE("Malformed static metadata entry '%s.%s' (%x):" - "Expected between %d and %d values, but got %d values", + "Expected between %zu and %zu values, but got %zu values", tagSection, tagName, tag, minCount, maxCount, entry.count); } @@ -2406,7 +2406,7 @@ status_t Parameters::validateAreas(const Vector<Parameters::Area> &areas, } if (areas.size() > maxRegions) { - ALOGE("%s: Too many areas requested: %d", + ALOGE("%s: Too many areas requested: %zu", __FUNCTION__, areas.size()); return BAD_VALUE; } diff --git a/services/camera/libcameraservice/api1/client2/StreamingProcessor.cpp b/services/camera/libcameraservice/api1/client2/StreamingProcessor.cpp index 6076dae..77ae7ec 100644 --- a/services/camera/libcameraservice/api1/client2/StreamingProcessor.cpp +++ b/services/camera/libcameraservice/api1/client2/StreamingProcessor.cpp @@ -225,14 +225,14 @@ status_t StreamingProcessor::setRecordingBufferCount(size_t count) { ATRACE_CALL(); // Make sure we can support this many buffer slots if (count > BufferQueue::NUM_BUFFER_SLOTS) { - ALOGE("%s: Camera %d: Too many recording buffers requested: %d, max %d", + ALOGE("%s: Camera %d: Too many recording buffers requested: %zu, max %d", __FUNCTION__, mId, count, BufferQueue::NUM_BUFFER_SLOTS); return BAD_VALUE; } Mutex::Autolock m(mMutex); - ALOGV("%s: Camera %d: New recording buffer count from encoder: %d", + ALOGV("%s: Camera %d: New recording buffer count from encoder: %zu", __FUNCTION__, mId, count); // Need to re-size consumer and heap @@ -314,7 +314,7 @@ status_t StreamingProcessor::updateRecordingStream(const Parameters ¶ms) { bool newConsumer = false; if (mRecordingConsumer == 0) { - ALOGV("%s: Camera %d: Creating recording consumer with %d + 1 " + ALOGV("%s: Camera %d: Creating recording consumer with %zu + 1 " "consumer-side buffers", __FUNCTION__, mId, mRecordingHeapCount); // Create CPU buffer queue endpoint. We need one more buffer here so that we can // always acquire and free a buffer when the heap is full; otherwise the consumer @@ -435,7 +435,7 @@ status_t StreamingProcessor::startStream(StreamType type, releaseAllRecordingFramesLocked(); } - ALOGV("%s: Camera %d: %s started, recording heap has %d free of %d", + ALOGV("%s: Camera %d: %s started, recording heap has %zu free of %zu", __FUNCTION__, mId, (type == PREVIEW) ? "preview" : "recording", mRecordingHeapFree, mRecordingHeapCount); @@ -658,8 +658,8 @@ status_t StreamingProcessor::processRecordingFrame() { if (mRecordingHeap == 0) { const size_t bufferSize = 4 + sizeof(buffer_handle_t); - ALOGV("%s: Camera %d: Creating recording heap with %d buffers of " - "size %d bytes", __FUNCTION__, mId, + ALOGV("%s: Camera %d: Creating recording heap with %zu buffers of " + "size %zu bytes", __FUNCTION__, mId, mRecordingHeapCount, bufferSize); mRecordingHeap = new Camera2Heap(bufferSize, mRecordingHeapCount, @@ -819,10 +819,10 @@ void StreamingProcessor::releaseAllRecordingFramesLocked() { } if (releasedCount > 0) { - ALOGW("%s: Camera %d: Force-freed %d outstanding buffers " + ALOGW("%s: Camera %d: Force-freed %zu outstanding buffers " "from previous recording session", __FUNCTION__, mId, releasedCount); ALOGE_IF(releasedCount != mRecordingHeapCount - mRecordingHeapFree, - "%s: Camera %d: Force-freed %d buffers, but expected %d", + "%s: Camera %d: Force-freed %zu buffers, but expected %zu", __FUNCTION__, mId, releasedCount, mRecordingHeapCount - mRecordingHeapFree); } diff --git a/services/camera/libcameraservice/api1/client2/ZslProcessor.cpp b/services/camera/libcameraservice/api1/client2/ZslProcessor.cpp index 4207ba9..130f81a 100644 --- a/services/camera/libcameraservice/api1/client2/ZslProcessor.cpp +++ b/services/camera/libcameraservice/api1/client2/ZslProcessor.cpp @@ -25,6 +25,8 @@ #define ALOGVV(...) ((void)0) #endif +#include <inttypes.h> + #include <utils/Log.h> #include <utils/Trace.h> #include <gui/Surface.h> @@ -78,7 +80,7 @@ void ZslProcessor::onFrameAvailable(int32_t /*requestId*/, entry = frame.find(ANDROID_SENSOR_TIMESTAMP); nsecs_t timestamp = entry.data.i64[0]; (void)timestamp; - ALOGVV("Got preview frame for timestamp %lld", timestamp); + ALOGVV("Got preview frame for timestamp %" PRId64, timestamp); if (mState != RUNNING) return; @@ -461,7 +463,7 @@ status_t ZslProcessor::processNewZslBuffer() { mZslQueueHead = (mZslQueueHead + 1) % kZslBufferDepth; - ALOGVV(" Acquired buffer, timestamp %lld", queueHead.buffer.mTimestamp); + ALOGVV(" Acquired buffer, timestamp %" PRId64, queueHead.buffer.mTimestamp); findMatchesLocked(); @@ -480,7 +482,7 @@ void ZslProcessor::findMatchesLocked() { entry = queueEntry.frame.find(ANDROID_SENSOR_TIMESTAMP); frameTimestamp = entry.data.i64[0]; } - ALOGVV(" %d: b: %lld\tf: %lld", i, + ALOGVV(" %d: b: %" PRId64 "\tf: %" PRId64, i, bufferTimestamp, frameTimestamp ); } if (queueEntry.frame.isEmpty() && bufferTimestamp != 0) { @@ -498,13 +500,13 @@ void ZslProcessor::findMatchesLocked() { } nsecs_t frameTimestamp = entry.data.i64[0]; if (bufferTimestamp == frameTimestamp) { - ALOGVV("%s: Found match %lld", __FUNCTION__, + ALOGVV("%s: Found match %" PRId64, __FUNCTION__, frameTimestamp); match = true; } else { int64_t delta = abs(bufferTimestamp - frameTimestamp); if ( delta < 1000000) { - ALOGVV("%s: Found close match %lld (delta %lld)", + ALOGVV("%s: Found close match %" PRId64 " (delta %" PRId64 ")", __FUNCTION__, bufferTimestamp, delta); match = true; } @@ -540,7 +542,7 @@ void ZslProcessor::dumpZslQueue(int fd) const { if (entry.count > 0) frameAeState = entry.data.u8[0]; } String8 result = - String8::format(" %d: b: %lld\tf: %lld, AE state: %d", i, + String8::format(" %zu: b: %" PRId64 "\tf: %" PRId64 ", AE state: %d", i, bufferTimestamp, frameTimestamp, frameAeState); ALOGV("%s", result.string()); if (fd != -1) { diff --git a/services/camera/libcameraservice/api1/client2/ZslProcessor3.cpp b/services/camera/libcameraservice/api1/client2/ZslProcessor3.cpp index 776ebe2..2fce2b6 100644 --- a/services/camera/libcameraservice/api1/client2/ZslProcessor3.cpp +++ b/services/camera/libcameraservice/api1/client2/ZslProcessor3.cpp @@ -25,6 +25,8 @@ #define ALOGVV(...) ((void)0) #endif +#include <inttypes.h> + #include <utils/Log.h> #include <utils/Trace.h> #include <gui/Surface.h> @@ -68,7 +70,7 @@ void ZslProcessor3::onFrameAvailable(int32_t /*requestId*/, entry = frame.find(ANDROID_SENSOR_TIMESTAMP); nsecs_t timestamp = entry.data.i64[0]; (void)timestamp; - ALOGVV("Got preview metadata for timestamp %lld", timestamp); + ALOGVV("Got preview metadata for timestamp %" PRId64, timestamp); if (mState != RUNNING) return; @@ -355,7 +357,7 @@ void ZslProcessor3::dumpZslQueue(int fd) const { if (entry.count > 0) frameAeState = entry.data.u8[0]; } String8 result = - String8::format(" %d: b: %lld\tf: %lld, AE state: %d", i, + String8::format(" %zu: b: %" PRId64 "\tf: %" PRId64 ", AE state: %d", i, bufferTimestamp, frameTimestamp, frameAeState); ALOGV("%s", result.string()); if (fd != -1) { @@ -415,7 +417,7 @@ nsecs_t ZslProcessor3::getCandidateTimestampLocked(size_t* metadataIdx) const { idx = j; } - ALOGVV("%s: Saw timestamp %lld", __FUNCTION__, frameTimestamp); + ALOGVV("%s: Saw timestamp %" PRId64, __FUNCTION__, frameTimestamp); } } @@ -435,7 +437,7 @@ nsecs_t ZslProcessor3::getCandidateTimestampLocked(size_t* metadataIdx) const { ALOGW("%s: ZSL queue has no metadata frames", __FUNCTION__); } - ALOGV("%s: Candidate timestamp %lld (idx %d), empty frames: %d", + ALOGV("%s: Candidate timestamp %" PRId64 " (idx %zu), empty frames: %zu", __FUNCTION__, minTimestamp, idx, emptyCount); if (metadataIdx) { diff --git a/services/camera/libcameraservice/api2/CameraDeviceClient.cpp b/services/camera/libcameraservice/api2/CameraDeviceClient.cpp index 1cdf8dc..142da9e 100644 --- a/services/camera/libcameraservice/api2/CameraDeviceClient.cpp +++ b/services/camera/libcameraservice/api2/CameraDeviceClient.cpp @@ -284,7 +284,7 @@ status_t CameraDeviceClient::createStream(int width, int height, int format, ssize_t index = mStreamMap.indexOfKey(bufferProducer->asBinder()); if (index != NAME_NOT_FOUND) { ALOGW("%s: Camera %d: Buffer producer already has a stream for it " - "(ID %d)", + "(ID %zd)", __FUNCTION__, mCameraId, index); return ALREADY_EXISTS; } diff --git a/services/camera/libcameraservice/common/Camera2ClientBase.cpp b/services/camera/libcameraservice/common/Camera2ClientBase.cpp index 2d1253f..6a88c87 100644 --- a/services/camera/libcameraservice/common/Camera2ClientBase.cpp +++ b/services/camera/libcameraservice/common/Camera2ClientBase.cpp @@ -18,6 +18,8 @@ #define ATRACE_TAG ATRACE_TAG_CAMERA //#define LOG_NDEBUG 0 +#include <inttypes.h> + #include <utils/Log.h> #include <utils/Trace.h> @@ -236,7 +238,7 @@ void Camera2ClientBase<TClientBase>::notifyShutter(int requestId, (void)requestId; (void)timestamp; - ALOGV("%s: Shutter notification for request id %d at time %lld", + ALOGV("%s: Shutter notification for request id %d at time %" PRId64, __FUNCTION__, requestId, timestamp); } diff --git a/services/camera/libcameraservice/common/FrameProcessorBase.cpp b/services/camera/libcameraservice/common/FrameProcessorBase.cpp index f2064fb..4d31667 100644 --- a/services/camera/libcameraservice/common/FrameProcessorBase.cpp +++ b/services/camera/libcameraservice/common/FrameProcessorBase.cpp @@ -183,7 +183,7 @@ status_t FrameProcessorBase::processListeners(const CameraMetadata &frame, item++; } } - ALOGV("Got %d range listeners out of %d", listeners.size(), mRangeListeners.size()); + ALOGV("Got %zu range listeners out of %zu", listeners.size(), mRangeListeners.size()); List<sp<FilteredListener> >::iterator item = listeners.begin(); for (; item != listeners.end(); item++) { (*item)->onFrameAvailable(requestId, frame); diff --git a/services/camera/libcameraservice/device2/Camera2Device.cpp b/services/camera/libcameraservice/device2/Camera2Device.cpp index 2bc1a8a..2966d82 100644 --- a/services/camera/libcameraservice/device2/Camera2Device.cpp +++ b/services/camera/libcameraservice/device2/Camera2Device.cpp @@ -25,6 +25,7 @@ #define ALOGVV(...) ((void)0) #endif +#include <inttypes.h> #include <utils/Log.h> #include <utils/Trace.h> #include <utils/Timers.h> @@ -822,7 +823,7 @@ status_t Camera2Device::MetadataQueue::dump(int fd, result.append(" Stream slot: Empty\n"); write(fd, result.string(), result.size()); } else { - result.appendFormat(" Stream slot: %d entries\n", + result.appendFormat(" Stream slot: %zu entries\n", mStreamSlot.size()); int i = 0; for (List<camera_metadata_t*>::iterator r = mStreamSlot.begin(); @@ -837,7 +838,7 @@ status_t Camera2Device::MetadataQueue::dump(int fd, result = " Main queue is empty\n"; write(fd, result.string(), result.size()); } else { - result = String8::format(" Main queue has %d entries:\n", + result = String8::format(" Main queue has %zu entries:\n", mEntries.size()); int i = 0; for (List<camera_metadata_t*>::iterator r = mEntries.begin(); @@ -1000,7 +1001,7 @@ status_t Camera2Device::StreamAdapter::connectToDevice( return BAD_VALUE; } - ALOGV("%s: New stream parameters %d x %d, format 0x%x, size %d", + ALOGV("%s: New stream parameters %d x %d, format 0x%x, size %zu", __FUNCTION__, width, height, format, size); mConsumerInterface = consumer; @@ -1072,7 +1073,7 @@ status_t Camera2Device::StreamAdapter::connectToDevice( mSize, 1, mFormat); if (res != OK) { ALOGE("%s: Unable to configure compressed stream buffer geometry" - " %d x %d, size %d for stream %d", + " %d x %d, size %zu for stream %d", __FUNCTION__, mWidth, mHeight, mSize, mId); return res; } @@ -1214,11 +1215,11 @@ status_t Camera2Device::StreamAdapter::dump(int fd, ATRACE_CALL(); String8 result = String8::format(" Stream %d: %d x %d, format 0x%x\n", mId, mWidth, mHeight, mFormat); - result.appendFormat(" size %d, usage 0x%x, requested format 0x%x\n", + result.appendFormat(" size %zu, usage 0x%x, requested format 0x%x\n", mSize, mUsage, mFormatRequested); result.appendFormat(" total buffers: %d, dequeued buffers: %d\n", mTotalBuffers, mActiveBuffers); - result.appendFormat(" frame count: %d, last timestamp %lld\n", + result.appendFormat(" frame count: %d, last timestamp %" PRId64 "\n", mFrameCount, mLastTimestamp); write(fd, result.string(), result.size()); return OK; diff --git a/services/camera/libcameraservice/device3/Camera3Device.cpp b/services/camera/libcameraservice/device3/Camera3Device.cpp index 3dbc1b0..7e11a3b 100644 --- a/services/camera/libcameraservice/device3/Camera3Device.cpp +++ b/services/camera/libcameraservice/device3/Camera3Device.cpp @@ -37,6 +37,8 @@ "%s: " fmt, __FUNCTION__, \ ##__VA_ARGS__) +#include <inttypes.h> + #include <utils/Log.h> #include <utils/Trace.h> #include <utils/Timers.h> @@ -345,7 +347,7 @@ status_t Camera3Device::dump(int fd, const Vector<String16> &args) { } else { for (size_t i = 0; i < mInFlightMap.size(); i++) { InFlightRequest r = mInFlightMap.valueAt(i); - lines.appendFormat(" Frame %d | Timestamp: %lld, metadata" + lines.appendFormat(" Frame %d | Timestamp: %" PRId64 ", metadata" " arrived: %s, buffers left: %d\n", mInFlightMap.keyAt(i), r.captureTimestamp, r.haveResultMetadata ? "true" : "false", r.numBuffersLeft); @@ -676,7 +678,7 @@ status_t Camera3Device::createStream(sp<ANativeWindow> consumer, ATRACE_CALL(); Mutex::Autolock il(mInterfaceLock); Mutex::Autolock l(mLock); - ALOGV("Camera %d: Creating new stream %d: %d x %d, format %d, size %d", + ALOGV("Camera %d: Creating new stream %d: %d x %d, format %d, size %zu", mId, mNextStreamId, width, height, format, size); status_t res; @@ -1018,7 +1020,7 @@ status_t Camera3Device::waitForNextFrame(nsecs_t timeout) { if (res == TIMED_OUT) { return res; } else if (res != OK) { - ALOGW("%s: Camera %d: No frame in %lld ns: %s (%d)", + ALOGW("%s: Camera %d: No frame in %" PRId64 " ns: %s (%d)", __FUNCTION__, mId, timeout, strerror(-res), res); return res; } @@ -1673,7 +1675,7 @@ void Camera3Device::processCaptureResult(const camera3_capture_result *result) { // Sanity check - if we have too many in-flight frames, something has // likely gone wrong if (mInFlightMap.size() > kInFlightWarnLimit) { - CLOGE("In-flight list too large: %d", mInFlightMap.size()); + CLOGE("In-flight list too large: %zu", mInFlightMap.size()); } } @@ -1723,7 +1725,7 @@ void Camera3Device::processCaptureResult(const camera3_capture_result *result) { gotResult = false; } else if (timestamp != entry.data.i64[0]) { SET_ERR("Timestamp mismatch between shutter notify and result" - " metadata for frame %d (%lld vs %lld respectively)", + " metadata for frame %d (%" PRId64 " vs %" PRId64 " respectively)", frameNumber, timestamp, entry.data.i64[0]); gotResult = false; } @@ -1745,7 +1747,7 @@ void Camera3Device::processCaptureResult(const camera3_capture_result *result) { // Note: stream may be deallocated at this point, if this buffer was the // last reference to it. if (res != OK) { - ALOGE("Can't return buffer %d for frame %d to its stream: " + ALOGE("Can't return buffer %zu for frame %d to its stream: " " %s (%d)", i, frameNumber, strerror(-res), res); } } @@ -1835,7 +1837,7 @@ void Camera3Device::notify(const camera3_notify_msg *msg) { frameNumber); break; } - ALOGVV("Camera %d: %s: Shutter fired for frame %d (id %d) at %lld", + ALOGVV("Camera %d: %s: Shutter fired for frame %d (id %d) at %" PRId64, mId, __FUNCTION__, frameNumber, requestId, timestamp); // Call listener, if any if (listener != NULL) { diff --git a/services/camera/libcameraservice/device3/Camera3IOStreamBase.cpp b/services/camera/libcameraservice/device3/Camera3IOStreamBase.cpp index da51228..d662cc2 100644 --- a/services/camera/libcameraservice/device3/Camera3IOStreamBase.cpp +++ b/services/camera/libcameraservice/device3/Camera3IOStreamBase.cpp @@ -18,8 +18,7 @@ #define ATRACE_TAG ATRACE_TAG_CAMERA //#define LOG_NDEBUG 0 -// This is needed for stdint.h to define INT64_MAX in C++ -#define __STDC_LIMIT_MACROS +#include <inttypes.h> #include <utils/Log.h> #include <utils/Trace.h> @@ -54,8 +53,8 @@ Camera3IOStreamBase::~Camera3IOStreamBase() { bool Camera3IOStreamBase::hasOutstandingBuffersLocked() const { nsecs_t signalTime = mCombinedFence->getSignalTime(); - ALOGV("%s: Stream %d: Has %d outstanding buffers," - " buffer signal time is %lld", + ALOGV("%s: Stream %d: Has %zu outstanding buffers," + " buffer signal time is %" PRId64, __FUNCTION__, mId, mDequeuedBufferCount, signalTime); if (mDequeuedBufferCount > 0 || signalTime == INT64_MAX) { return true; @@ -70,12 +69,12 @@ void Camera3IOStreamBase::dump(int fd, const Vector<String16> &args) const { lines.appendFormat(" Dims: %d x %d, format 0x%x\n", camera3_stream::width, camera3_stream::height, camera3_stream::format); - lines.appendFormat(" Max size: %d\n", mMaxSize); + lines.appendFormat(" Max size: %zu\n", mMaxSize); lines.appendFormat(" Usage: %d, max HAL buffers: %d\n", camera3_stream::usage, camera3_stream::max_buffers); - lines.appendFormat(" Frames produced: %d, last timestamp: %lld ns\n", + lines.appendFormat(" Frames produced: %d, last timestamp: %" PRId64 " ns\n", mFrameCount, mLastTimestamp); - lines.appendFormat(" Total buffers: %d, currently dequeued: %d\n", + lines.appendFormat(" Total buffers: %zu, currently dequeued: %zu\n", mTotalBufferCount, mDequeuedBufferCount); write(fd, lines.string(), lines.size()); } @@ -119,7 +118,7 @@ status_t Camera3IOStreamBase::disconnectLocked() { } if (mDequeuedBufferCount > 0) { - ALOGE("%s: Can't disconnect with %d buffers still dequeued!", + ALOGE("%s: Can't disconnect with %zu buffers still dequeued!", __FUNCTION__, mDequeuedBufferCount); return INVALID_OPERATION; } diff --git a/services/camera/libcameraservice/device3/Camera3Stream.cpp b/services/camera/libcameraservice/device3/Camera3Stream.cpp index 6d2cf94..70406f1 100644 --- a/services/camera/libcameraservice/device3/Camera3Stream.cpp +++ b/services/camera/libcameraservice/device3/Camera3Stream.cpp @@ -353,7 +353,7 @@ status_t Camera3Stream::registerBuffersLocked(camera3_device *hal3Device) { } if (bufferIdx == bufferCount) { // Got all buffers, register with HAL - ALOGV("%s: Registering %d buffers with camera HAL", + ALOGV("%s: Registering %zu buffers with camera HAL", __FUNCTION__, bufferCount); ATRACE_BEGIN("camera3->register_stream_buffers"); res = hal3Device->ops->register_stream_buffers(hal3Device, diff --git a/services/camera/libcameraservice/device3/Camera3ZslStream.cpp b/services/camera/libcameraservice/device3/Camera3ZslStream.cpp index 04f5dc5..44d8188 100644 --- a/services/camera/libcameraservice/device3/Camera3ZslStream.cpp +++ b/services/camera/libcameraservice/device3/Camera3ZslStream.cpp @@ -18,6 +18,8 @@ #define ATRACE_TAG ATRACE_TAG_CAMERA //#define LOG_NDEBUG 0 +#include <inttypes.h> + #include <utils/Log.h> #include <utils/Trace.h> #include "Camera3ZslStream.h" @@ -271,7 +273,7 @@ void Camera3ZslStream::dump(int fd, const Vector<String16> &args) const { Camera3IOStreamBase::dump(fd, args); lines = String8(); - lines.appendFormat(" Input buffers pending: %d, in flight %d\n", + lines.appendFormat(" Input buffers pending: %zu, in flight %zu\n", mInputBufferQueue.size(), mBuffersInFlight.size()); write(fd, lines.string(), lines.size()); } @@ -297,7 +299,7 @@ status_t Camera3ZslStream::enqueueInputBufferByTimestamp( if (actual != timestamp) { ALOGW("%s: ZSL buffer candidate search didn't find an exact match --" - " requested timestamp = %lld, actual timestamp = %lld", + " requested timestamp = %" PRId64 ", actual timestamp = %" PRId64, __FUNCTION__, timestamp, actual); } diff --git a/services/camera/libcameraservice/device3/StatusTracker.cpp b/services/camera/libcameraservice/device3/StatusTracker.cpp index ab5419f..723b5c2 100644 --- a/services/camera/libcameraservice/device3/StatusTracker.cpp +++ b/services/camera/libcameraservice/device3/StatusTracker.cpp @@ -18,9 +18,6 @@ #define ATRACE_TAG ATRACE_TAG_CAMERA //#define LOG_NDEBUG 0 -// This is needed for stdint.h to define INT64_MAX in C++ -#define __STDC_LIMIT_MACROS - #include <utils/Log.h> #include <utils/Trace.h> #include <ui/Fence.h> @@ -52,7 +49,7 @@ int StatusTracker::addComponent() { ALOGV("%s: Adding new component %d", __FUNCTION__, id); err = mStates.add(id, IDLE); - ALOGE_IF(err < 0, "%s: Can't add new component %d: %s (%d)", + ALOGE_IF(err < 0, "%s: Can't add new component %d: %s (%zd)", __FUNCTION__, id, strerror(-err), err); } diff --git a/services/camera/libcameraservice/gui/RingBufferConsumer.cpp b/services/camera/libcameraservice/gui/RingBufferConsumer.cpp index ebc7ea7..e4ec5fd 100644 --- a/services/camera/libcameraservice/gui/RingBufferConsumer.cpp +++ b/services/camera/libcameraservice/gui/RingBufferConsumer.cpp @@ -17,15 +17,18 @@ //#define LOG_NDEBUG 0 #define LOG_TAG "RingBufferConsumer" #define ATRACE_TAG ATRACE_TAG_GRAPHICS + +#include <inttypes.h> + #include <utils/Log.h> #include <gui/RingBufferConsumer.h> -#define BI_LOGV(x, ...) ALOGV("[%s] "x, mName.string(), ##__VA_ARGS__) -#define BI_LOGD(x, ...) ALOGD("[%s] "x, mName.string(), ##__VA_ARGS__) -#define BI_LOGI(x, ...) ALOGI("[%s] "x, mName.string(), ##__VA_ARGS__) -#define BI_LOGW(x, ...) ALOGW("[%s] "x, mName.string(), ##__VA_ARGS__) -#define BI_LOGE(x, ...) ALOGE("[%s] "x, mName.string(), ##__VA_ARGS__) +#define BI_LOGV(x, ...) ALOGV("[%s] " x, mName.string(), ##__VA_ARGS__) +#define BI_LOGD(x, ...) ALOGD("[%s] " x, mName.string(), ##__VA_ARGS__) +#define BI_LOGI(x, ...) ALOGI("[%s] " x, mName.string(), ##__VA_ARGS__) +#define BI_LOGW(x, ...) ALOGW("[%s] " x, mName.string(), ##__VA_ARGS__) +#define BI_LOGE(x, ...) ALOGE("[%s] " x, mName.string(), ##__VA_ARGS__) #undef assert #define assert(x) ALOG_ASSERT((x), #x) @@ -164,10 +167,10 @@ void RingBufferConsumer::pinBufferLocked(const BufferItem& item) { } if (it == end) { - BI_LOGE("Failed to pin buffer (timestamp %lld, framenumber %lld)", + BI_LOGE("Failed to pin buffer (timestamp %" PRId64 ", framenumber %" PRIu64 ")", item.mTimestamp, item.mFrameNumber); } else { - BI_LOGV("Pinned buffer (frame %lld, timestamp %lld)", + BI_LOGV("Pinned buffer (frame %" PRIu64 ", timestamp %" PRId64 ")", item.mFrameNumber, item.mTimestamp); } } @@ -222,12 +225,12 @@ status_t RingBufferConsumer::releaseOldestBufferLocked(size_t* pinnedFrames) { if (err != OK) { BI_LOGE("Failed to add release fence to buffer " - "(timestamp %lld, framenumber %lld", + "(timestamp %" PRId64 ", framenumber %" PRIu64, item.mTimestamp, item.mFrameNumber); return err; } - BI_LOGV("Attempting to release buffer timestamp %lld, frame %lld", + BI_LOGV("Attempting to release buffer timestamp %" PRId64 ", frame %" PRIu64, item.mTimestamp, item.mFrameNumber); // item.mGraphicBuffer was populated with the proper graphic-buffer @@ -241,7 +244,7 @@ status_t RingBufferConsumer::releaseOldestBufferLocked(size_t* pinnedFrames) { return err; } - BI_LOGV("Buffer timestamp %lld, frame %lld evicted", + BI_LOGV("Buffer timestamp %" PRId64 ", frame %" PRIu64 " evicted", item.mTimestamp, item.mFrameNumber); size_t currentSize = mBufferItemList.size(); @@ -294,8 +297,8 @@ void RingBufferConsumer::onFrameAvailable() { return; } - BI_LOGV("New buffer acquired (timestamp %lld), " - "buffer items %u out of %d", + BI_LOGV("New buffer acquired (timestamp %" PRId64 "), " + "buffer items %zu out of %d", item.mTimestamp, mBufferItemList.size(), mBufferCount); @@ -321,7 +324,7 @@ void RingBufferConsumer::unpinBuffer(const BufferItem& item) { if (res != OK) { BI_LOGE("Failed to add release fence to buffer " - "(timestamp %lld, framenumber %lld", + "(timestamp %" PRId64 ", framenumber %" PRIu64, item.mTimestamp, item.mFrameNumber); return; } @@ -333,10 +336,10 @@ void RingBufferConsumer::unpinBuffer(const BufferItem& item) { if (it == end) { // This should never happen. If it happens, we have a bug. - BI_LOGE("Failed to unpin buffer (timestamp %lld, framenumber %lld)", + BI_LOGE("Failed to unpin buffer (timestamp %" PRId64 ", framenumber %" PRIu64 ")", item.mTimestamp, item.mFrameNumber); } else { - BI_LOGV("Unpinned buffer (timestamp %lld, framenumber %lld)", + BI_LOGV("Unpinned buffer (timestamp %" PRId64 ", framenumber %" PRIu64 ")", item.mTimestamp, item.mFrameNumber); } } diff --git a/services/medialog/Android.mk b/services/medialog/Android.mk index 08006c8..95f2fef 100644 --- a/services/medialog/Android.mk +++ b/services/medialog/Android.mk @@ -8,4 +8,6 @@ LOCAL_SHARED_LIBRARIES := libmedia libbinder libutils liblog libnbaio LOCAL_MODULE:= libmedialogservice +LOCAL_32_BIT_ONLY := true + include $(BUILD_SHARED_LIBRARY) |