diff options
126 files changed, 570 insertions, 459 deletions
diff --git a/camera/CameraParameters.cpp b/camera/CameraParameters.cpp index c51f265..af091f4 100644 --- a/camera/CameraParameters.cpp +++ b/camera/CameraParameters.cpp @@ -470,7 +470,7 @@ status_t CameraParameters::dump(int fd, const Vector<String16>& args) const const size_t SIZE = 256; char buffer[SIZE]; String8 result; - snprintf(buffer, 255, "CameraParameters::dump: mMap.size = %d\n", mMap.size()); + snprintf(buffer, 255, "CameraParameters::dump: mMap.size = %zu\n", mMap.size()); result.append(buffer); for (size_t i = 0; i < mMap.size(); i++) { String8 k, v; diff --git a/cmds/screenrecord/Android.mk b/cmds/screenrecord/Android.mk index d77fdb6..57a2234 100644 --- a/cmds/screenrecord/Android.mk +++ b/cmds/screenrecord/Android.mk @@ -40,4 +40,6 @@ LOCAL_MODULE_TAGS := optional LOCAL_MODULE:= screenrecord +LOCAL_32_BIT_ONLY := true + include $(BUILD_EXECUTABLE) diff --git a/cmds/screenrecord/Overlay.cpp b/cmds/screenrecord/Overlay.cpp index 96e25b8..2e98874 100644 --- a/cmds/screenrecord/Overlay.cpp +++ b/cmds/screenrecord/Overlay.cpp @@ -47,7 +47,7 @@ const char* Overlay::kPropertyNames[] = { "ro.revision", "dalvik.vm.heapgrowthlimit", "dalvik.vm.heapsize", - "persist.sys.dalvik.vm.lib", + "persist.sys.dalvik.vm.lib.1", //"ro.product.cpu.abi", //"ro.bootloader", //"this-never-appears!", diff --git a/cmds/stagefright/Android.mk b/cmds/stagefright/Android.mk index 561ce02..e2e389b 100644 --- a/cmds/stagefright/Android.mk +++ b/cmds/stagefright/Android.mk @@ -23,6 +23,8 @@ LOCAL_MODULE_TAGS := optional LOCAL_MODULE:= stagefright +LOCAL_32_BIT_ONLY := true + include $(BUILD_EXECUTABLE) ################################################################################ @@ -46,6 +48,8 @@ LOCAL_MODULE_TAGS := optional LOCAL_MODULE:= record +LOCAL_32_BIT_ONLY := true + include $(BUILD_EXECUTABLE) ################################################################################ @@ -69,6 +73,8 @@ LOCAL_MODULE_TAGS := optional LOCAL_MODULE:= recordvideo +LOCAL_32_BIT_ONLY := true + include $(BUILD_EXECUTABLE) @@ -93,6 +99,8 @@ LOCAL_MODULE_TAGS := optional LOCAL_MODULE:= audioloop +LOCAL_32_BIT_ONLY := true + include $(BUILD_EXECUTABLE) ################################################################################ @@ -116,6 +124,8 @@ LOCAL_MODULE_TAGS := optional LOCAL_MODULE:= stream +LOCAL_32_BIT_ONLY := true + include $(BUILD_EXECUTABLE) ################################################################################ @@ -139,6 +149,8 @@ LOCAL_MODULE_TAGS := optional LOCAL_MODULE:= sf2 +LOCAL_32_BIT_ONLY := true + include $(BUILD_EXECUTABLE) ################################################################################ @@ -163,6 +175,8 @@ LOCAL_MODULE_TAGS := optional LOCAL_MODULE:= codec +LOCAL_32_BIT_ONLY := true + include $(BUILD_EXECUTABLE) ################################################################################ @@ -186,4 +200,6 @@ LOCAL_MODULE_TAGS := optional LOCAL_MODULE:= muxer +LOCAL_32_BIT_ONLY := true + include $(BUILD_EXECUTABLE) diff --git a/cmds/stagefright/codec.cpp b/cmds/stagefright/codec.cpp index fdfefdf..d125ad1 100644 --- a/cmds/stagefright/codec.cpp +++ b/cmds/stagefright/codec.cpp @@ -16,6 +16,7 @@ //#define LOG_NDEBUG 0 #define LOG_TAG "codec" +#include <inttypes.h> #include <utils/Log.h> #include "SimplePlayer.h" @@ -291,13 +292,13 @@ static int decode( CHECK_EQ((status_t)OK, state->mCodec->release()); if (state->mIsAudio) { - printf("track %d: %lld bytes received. %.2f KB/sec\n", + printf("track %zu: %" PRId64 " bytes received. %.2f KB/sec\n", i, state->mNumBytesDecoded, state->mNumBytesDecoded * 1E6 / 1024 / elapsedTimeUs); } else { - printf("track %d: %lld frames decoded, %.2f fps. %lld bytes " - "received. %.2f KB/sec\n", + printf("track %zu: %" PRId64 " frames decoded, %.2f fps. %" PRId64 + " bytes received. %.2f KB/sec\n", i, state->mNumBuffersDecoded, state->mNumBuffersDecoded * 1E6 / elapsedTimeUs, diff --git a/cmds/stagefright/muxer.cpp b/cmds/stagefright/muxer.cpp index cca33e0..90daea2 100644 --- a/cmds/stagefright/muxer.cpp +++ b/cmds/stagefright/muxer.cpp @@ -16,6 +16,7 @@ //#define LOG_NDEBUG 0 #define LOG_TAG "muxer" +#include <inttypes.h> #include <utils/Log.h> #include <binder/ProcessState.h> @@ -198,7 +199,7 @@ static int muxing( trackIndexMap.clear(); int64_t elapsedTimeUs = ALooper::GetNowUs() - muxerStartTimeUs; - fprintf(stderr, "SUCCESS: muxer generate the video in %lld ms\n", + fprintf(stderr, "SUCCESS: muxer generate the video in %" PRId64 " ms\n", elapsedTimeUs / 1000); return 0; diff --git a/cmds/stagefright/recordvideo.cpp b/cmds/stagefright/recordvideo.cpp index c30c122..1d267f9 100644 --- a/cmds/stagefright/recordvideo.cpp +++ b/cmds/stagefright/recordvideo.cpp @@ -16,6 +16,7 @@ #include "SineSource.h" +#include <inttypes.h> #include <binder/ProcessState.h> #include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/AudioPlayer.h> @@ -312,7 +313,7 @@ int main(int argc, char **argv) { fprintf(stderr, "record failed: %d\n", err); return 1; } - fprintf(stderr, "encoding %d frames in %lld us\n", nFrames, (end-start)/1000); + fprintf(stderr, "encoding %d frames in %" PRId64 " us\n", nFrames, (end-start)/1000); fprintf(stderr, "encoding speed is: %.2f fps\n", (nFrames * 1E9) / (end-start)); return 0; } diff --git a/cmds/stagefright/sf2.cpp b/cmds/stagefright/sf2.cpp index c817443..b2b9ce5 100644 --- a/cmds/stagefright/sf2.cpp +++ b/cmds/stagefright/sf2.cpp @@ -16,6 +16,7 @@ //#define LOG_NDEBUG 0 #define LOG_TAG "sf2" +#include <inttypes.h> #include <utils/Log.h> #include <binder/ProcessState.h> @@ -183,11 +184,11 @@ protected: int64_t delayUs = ALooper::GetNowUs() - mStartTimeUs; if (mDecodeAudio) { - printf("%lld bytes received. %.2f KB/sec\n", + printf("%" PRId64 " bytes received. %.2f KB/sec\n", mTotalBytesReceived, mTotalBytesReceived * 1E6 / 1024 / delayUs); } else { - printf("%d frames decoded, %.2f fps. %lld bytes " + printf("%d frames decoded, %.2f fps. %" PRId64 " bytes " "received. %.2f KB/sec\n", mNumOutputBuffersReceived, mNumOutputBuffersReceived * 1E6 / delayUs, diff --git a/cmds/stagefright/stagefright.cpp b/cmds/stagefright/stagefright.cpp index 030bf1b..8efb39e 100644 --- a/cmds/stagefright/stagefright.cpp +++ b/cmds/stagefright/stagefright.cpp @@ -22,6 +22,7 @@ #include <stdlib.h> #include <string.h> +#include <inttypes.h> #include "jpeg.h" #include "SineSource.h" @@ -89,8 +90,8 @@ static void displayDecodeHistogram(Vector<int64_t> *decodeTimesUs) { int64_t minUs = decodeTimesUs->itemAt(0); int64_t maxUs = decodeTimesUs->itemAt(n - 1); - printf("min decode time %lld us (%.2f secs)\n", minUs, minUs / 1E6); - printf("max decode time %lld us (%.2f secs)\n", maxUs, maxUs / 1E6); + printf("min decode time %" PRId64 " us (%.2f secs)\n", minUs, minUs / 1E6); + printf("max decode time %" PRId64 " us (%.2f secs)\n", maxUs, maxUs / 1E6); size_t counts[100]; for (size_t i = 0; i < 100; ++i) { @@ -110,7 +111,7 @@ static void displayDecodeHistogram(Vector<int64_t> *decodeTimesUs) { int64_t slotUs = minUs + (i * (maxUs - minUs) / 100); double fps = 1E6 / slotUs; - printf("[%.2f fps]: %d\n", fps, counts[i]); + printf("[%.2f fps]: %zu\n", fps, counts[i]); } } @@ -262,7 +263,7 @@ static void playSource(OMXClient *client, sp<MediaSource> &source) { } } - printf("buffer has timestamp %lld us (%.2f secs)\n", + printf("buffer has timestamp %" PRId64 " us (%.2f secs)\n", timestampUs, timestampUs / 1E6); buffer->release(); @@ -285,7 +286,7 @@ static void playSource(OMXClient *client, sp<MediaSource> &source) { seekTimeUs = (rand() * (float)durationUs) / RAND_MAX; options.setSeekTo(seekTimeUs); - printf("seeking to %lld us (%.2f secs)\n", + printf("seeking to %" PRId64 " us (%.2f secs)\n", seekTimeUs, seekTimeUs / 1E6); } } @@ -388,7 +389,7 @@ static void playSource(OMXClient *client, sp<MediaSource> &source) { // sizes may be different across decoders. printf("avg. %.2f KB/sec\n", totalBytes / 1024 * 1E6 / delay); - printf("decoded a total of %lld bytes\n", totalBytes); + printf("decoded a total of %" PRId64 " bytes\n", totalBytes); } } @@ -574,7 +575,8 @@ static void performSeekTest(const sp<MediaSource> &source) { int64_t timeUs; CHECK(buffer->meta_data()->findInt64(kKeyTime, &timeUs)); - printf("%lld\t%lld\t%lld\n", seekTimeUs, timeUs, seekTimeUs - timeUs); + printf("%" PRId64 "\t%" PRId64 "\t%" PRId64 "\n", + seekTimeUs, timeUs, seekTimeUs - timeUs); buffer->release(); buffer = NULL; @@ -1071,7 +1073,7 @@ int main(int argc, char **argv) { int64_t thumbTimeUs; if (meta->findInt64(kKeyThumbnailTime, &thumbTimeUs)) { - printf("thumbnailTime: %lld us (%.2f secs)\n", + printf("thumbnailTime: %" PRId64 " us (%.2f secs)\n", thumbTimeUs, thumbTimeUs / 1E6); } diff --git a/drm/drmserver/Android.mk b/drm/drmserver/Android.mk index dc973da..aa0ab9b 100644 --- a/drm/drmserver/Android.mk +++ b/drm/drmserver/Android.mk @@ -39,4 +39,6 @@ LOCAL_MODULE:= drmserver LOCAL_MODULE_TAGS := optional +LOCAL_32_BIT_ONLY := true + include $(BUILD_EXECUTABLE) diff --git a/drm/mediadrm/plugins/mock/Android.mk b/drm/mediadrm/plugins/mock/Android.mk index ada23a2..26c245b 100644 --- a/drm/mediadrm/plugins/mock/Android.mk +++ b/drm/mediadrm/plugins/mock/Android.mk @@ -21,7 +21,8 @@ LOCAL_SRC_FILES:= \ LOCAL_MODULE := libmockdrmcryptoplugin -LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_SHARED_LIBRARIES)/mediadrm +LOCAL_PROPRIETARY_MODULE := true +LOCAL_MODULE_RELATIVE_PATH := mediadrm LOCAL_SHARED_LIBRARIES := \ libutils liblog diff --git a/drm/mediadrm/plugins/mock/MockDrmCryptoPlugin.cpp b/drm/mediadrm/plugins/mock/MockDrmCryptoPlugin.cpp index df0bca3..6efc712 100644 --- a/drm/mediadrm/plugins/mock/MockDrmCryptoPlugin.cpp +++ b/drm/mediadrm/plugins/mock/MockDrmCryptoPlugin.cpp @@ -726,7 +726,7 @@ namespace android { { String8 result; for (size_t i = 0; i < numSubSamples; i++) { - result.appendFormat("[%d] {clear:%d, encrypted:%d} ", i, + result.appendFormat("[%zu] {clear:%zu, encrypted:%zu} ", i, subSamples[i].mNumBytesOfClearData, subSamples[i].mNumBytesOfEncryptedData); } diff --git a/include/media/AudioSystem.h b/include/media/AudioSystem.h index 225ef76..4c22412 100644 --- a/include/media/AudioSystem.h +++ b/include/media/AudioSystem.h @@ -127,8 +127,8 @@ public: // NOTE: this feature is not supported on all hardware platforms and it is // necessary to check returned status before using the returned values. static status_t getRenderPosition(audio_io_handle_t output, - size_t *halFrames, - size_t *dspFrames, + uint32_t *halFrames, + uint32_t *dspFrames, audio_stream_type_t stream = AUDIO_STREAM_DEFAULT); // return the number of input frames lost by HAL implementation, or 0 if the handle is invalid diff --git a/include/media/IAudioFlinger.h b/include/media/IAudioFlinger.h index 899d79f..282f275 100644 --- a/include/media/IAudioFlinger.h +++ b/include/media/IAudioFlinger.h @@ -167,10 +167,10 @@ public: virtual status_t setVoiceVolume(float volume) = 0; - 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 = 0; - virtual size_t getInputFramesLost(audio_io_handle_t ioHandle) const = 0; + virtual uint32_t getInputFramesLost(audio_io_handle_t ioHandle) const = 0; virtual int newAudioSessionId() = 0; diff --git a/include/private/media/AudioTrackShared.h b/include/private/media/AudioTrackShared.h index 7fd9379..2d033e6 100644 --- a/include/private/media/AudioTrackShared.h +++ b/include/private/media/AudioTrackShared.h @@ -65,7 +65,9 @@ typedef SingleStateQueue<StaticAudioTrackState> StaticAudioTrackSingleStateQueue struct AudioTrackSharedStatic { StaticAudioTrackSingleStateQueue::Shared mSingleStateQueue; - size_t mBufferPosition; // updated asynchronously by server, + // This field should be a size_t, but since it is located in shared memory we + // force to 32-bit. The client and server may have different typedefs for size_t. + uint32_t mBufferPosition; // updated asynchronously by server, // "for entertainment purposes only" }; @@ -108,7 +110,9 @@ struct audio_track_cblk_t private: - size_t mMinimum; // server wakes up client if available >= mMinimum + // This field should be a size_t, but since it is located in shared memory we + // force to 32-bit. The client and server may have different typedefs for size_t. + uint32_t mMinimum; // server wakes up client if available >= mMinimum // Channel volumes are fixed point U4.12, so 0x1000 means 1.0. // Left channel is in [0:15], right channel is in [16:31]. @@ -245,7 +249,11 @@ public: } void setMinimum(size_t minimum) { - mCblk->mMinimum = minimum; + // This can only happen on a 64-bit client + if (minimum > UINT32_MAX) { + minimum = UINT32_MAX; + } + mCblk->mMinimum = (uint32_t) minimum; } // Return the number of frames that would need to be obtained and released diff --git a/include/private/media/StaticAudioTrackState.h b/include/private/media/StaticAudioTrackState.h index 46a5946..d483061 100644 --- a/include/private/media/StaticAudioTrackState.h +++ b/include/private/media/StaticAudioTrackState.h @@ -25,9 +25,13 @@ namespace android { // state is wrapped by a SingleStateQueue. struct StaticAudioTrackState { // do not define constructors, destructors, or virtual methods - size_t mLoopStart; - size_t mLoopEnd; - int mLoopCount; + + // These fields should both be size_t, but since they are located in shared memory we + // force to 32-bit. The client and server may have different typedefs for size_t. + uint32_t mLoopStart; + uint32_t mLoopEnd; + + int mLoopCount; }; } // namespace android diff --git a/libvideoeditor/lvpp/Android.mk b/libvideoeditor/lvpp/Android.mk index 2286827..06c2e6a 100755 --- a/libvideoeditor/lvpp/Android.mk +++ b/libvideoeditor/lvpp/Android.mk @@ -46,7 +46,7 @@ LOCAL_STATIC_LIBRARIES := \ LOCAL_SHARED_LIBRARIES := \ - libaudioflinger \ + libaudioresampler \ libaudioutils \ libbinder \ libcutils \ @@ -81,7 +81,6 @@ LOCAL_C_INCLUDES += \ $(TOP)/frameworks/av/services/audioflinger \ $(TOP)/frameworks/native/include/media/editor \ $(TOP)/frameworks/native/include/media/openmax \ - $(TOP)/frameworks/native/services/audioflinger LOCAL_SHARED_LIBRARIES += libdl diff --git a/libvideoeditor/lvpp/VideoEditorAudioPlayer.cpp b/libvideoeditor/lvpp/VideoEditorAudioPlayer.cpp index 176f8e9..cb4b23e 100755 --- a/libvideoeditor/lvpp/VideoEditorAudioPlayer.cpp +++ b/libvideoeditor/lvpp/VideoEditorAudioPlayer.cpp @@ -671,8 +671,9 @@ size_t VideoEditorAudioPlayer::fillBuffer(void *data, size_t size) { M4OSA_Void* ptr; - ptr = (M4OSA_Void*)((unsigned int)mInputBuffer->data() + - mInputBuffer->range_offset()); + ptr = reinterpret_cast<M4OSA_Void*>( + reinterpret_cast<uintptr_t>(mInputBuffer->data()) + + mInputBuffer->range_offset()); M4OSA_UInt32 len = mInputBuffer->range_length(); M4OSA_Context fp = M4OSA_NULL; @@ -700,8 +701,8 @@ size_t VideoEditorAudioPlayer::fillBuffer(void *data, size_t size) { mBGAudioPCMFileOriginalSeekPoint <= (mBGAudioPCMFileTrimmedLength - len)) { - ALOGV("Checking mBGAudioPCMFileHandle %d", - (unsigned int)mBGAudioPCMFileHandle); + ALOGV("Checking mBGAudioPCMFileHandle %p", + mBGAudioPCMFileHandle); if (mBGAudioPCMFileHandle != M4OSA_NULL) { ALOGV("fillBuffer seeking file to %lld", diff --git a/libvideoeditor/lvpp/VideoEditorSRC.cpp b/libvideoeditor/lvpp/VideoEditorSRC.cpp index 36d0812..6beabfa 100755 --- a/libvideoeditor/lvpp/VideoEditorSRC.cpp +++ b/libvideoeditor/lvpp/VideoEditorSRC.cpp @@ -284,7 +284,7 @@ status_t VideoEditorSRC::getNextBuffer(AudioBufferProvider::Buffer *pBuffer, int void VideoEditorSRC::releaseBuffer(AudioBufferProvider::Buffer *pBuffer) { - ALOGV("releaseBuffer: %p", pBuffers); + ALOGV("releaseBuffer: %p", pBuffer); free(pBuffer->raw); pBuffer->raw = NULL; pBuffer->frameCount = 0; diff --git a/libvideoeditor/vss/src/Android.mk b/libvideoeditor/vss/src/Android.mk index 0caa15b..47627ec 100755 --- a/libvideoeditor/vss/src/Android.mk +++ b/libvideoeditor/vss/src/Android.mk @@ -53,7 +53,7 @@ LOCAL_SRC_FILES:= \ LOCAL_MODULE_TAGS := optional LOCAL_SHARED_LIBRARIES := \ - libaudioflinger \ + libaudioresampler \ libaudioutils \ libbinder \ libcutils \ @@ -81,7 +81,6 @@ LOCAL_C_INCLUDES += \ $(TOP)/frameworks/av/libvideoeditor/vss/stagefrightshells/inc \ $(TOP)/frameworks/av/services/audioflinger \ $(TOP)/frameworks/native/include/media/openmax \ - $(TOP)/frameworks/native/services/audioflinger \ $(TOP)/system/media/audio_effects/include \ $(TOP)/system/media/audio_utils/include diff --git a/libvideoeditor/vss/src/M4DECODER_Null.c b/libvideoeditor/vss/src/M4DECODER_Null.c index a0dad30..ce260e5 100755 --- a/libvideoeditor/vss/src/M4DECODER_Null.c +++ b/libvideoeditor/vss/src/M4DECODER_Null.c @@ -210,7 +210,7 @@ M4OSA_ERR M4DECODER_NULL_setOption(M4OSA_Context context, break;
case M4DECODER_kOptionID_EnableYuvWithEffect:
- pStreamContext->bYuvWithEffectSet = (M4OSA_Bool)pValue;
+ pStreamContext->bYuvWithEffectSet = (M4OSA_Bool)(intptr_t)pValue;
break;
case M4DECODER_kOptionID_YuvWithEffectNonContiguous:
diff --git a/libvideoeditor/vss/src/VideoEditorResampler.cpp b/libvideoeditor/vss/src/VideoEditorResampler.cpp index 1129c3c..53537f0 100755 --- a/libvideoeditor/vss/src/VideoEditorResampler.cpp +++ b/libvideoeditor/vss/src/VideoEditorResampler.cpp @@ -17,7 +17,7 @@ #define LOG_NDEBUG 1 #include <audio_utils/primitives.h> #include <utils/Log.h> -#include "AudioMixer.h" +#include "AudioResampler.h" #include "VideoEditorResampler.h" namespace android { diff --git a/libvideoeditor/vss/stagefrightshells/src/VideoEditorMp3Reader.cpp b/libvideoeditor/vss/stagefrightshells/src/VideoEditorMp3Reader.cpp index af53c54..2e0d05d 100755 --- a/libvideoeditor/vss/stagefrightshells/src/VideoEditorMp3Reader.cpp +++ b/libvideoeditor/vss/stagefrightshells/src/VideoEditorMp3Reader.cpp @@ -334,8 +334,8 @@ M4OSA_ERR VideoEditorMp3Reader_setOption(M4OSA_Context context, (VideoEditorMp3Reader_Context*)context; M4OSA_ERR err = M4NO_ERROR; - ALOGV("VideoEditorMp3Reader_Context begin: optionId: %d Value: %d ", - (int)optionId,(int)pValue); + ALOGV("VideoEditorMp3Reader_Context begin: optionId: %u Value: %p ", + optionId, pValue); M4OSA_DEBUG_IF1((M4OSA_NULL == pReaderContext), M4ERR_PARAMETER, "invalid context pointer"); diff --git a/libvideoeditor/vss/stagefrightshells/src/VideoEditorUtils.cpp b/libvideoeditor/vss/stagefrightshells/src/VideoEditorUtils.cpp index 5a7237d..d264a2e 100755 --- a/libvideoeditor/vss/stagefrightshells/src/VideoEditorUtils.cpp +++ b/libvideoeditor/vss/stagefrightshells/src/VideoEditorUtils.cpp @@ -84,17 +84,17 @@ void displayMetaData(const sp<MetaData> meta) { LOG1("displayMetaData kKeyBitRate %d", int32Data); } if (meta->findData(kKeyESDS, &type, &data, &size)) { - LOG1("displayMetaData kKeyESDS type=%d size=%d", type, size); + LOG1("displayMetaData kKeyESDS type=%d size=%zu", type, size); } if (meta->findData(kKeyAVCC, &type, &data, &size)) { - LOG1("displayMetaData kKeyAVCC data=0x%X type=%d size=%d", + LOG1("displayMetaData kKeyAVCC data=0x%X type=%d size=%zu", *((unsigned int*)data), type, size); } if (meta->findData(kKeyVorbisInfo, &type, &data, &size)) { - LOG1("displayMetaData kKeyVorbisInfo type=%d size=%d", type, size); + LOG1("displayMetaData kKeyVorbisInfo type=%d size=%zu", type, size); } if (meta->findData(kKeyVorbisBooks, &type, &data, &size)) { - LOG1("displayMetaData kKeyVorbisBooks type=%d size=%d", type, size); + LOG1("displayMetaData kKeyVorbisBooks type=%d size=%zu", type, size); } if (meta->findInt32(kKeyWantsNALFragments, &int32Data)) { LOG1("displayMetaData kKeyWantsNALFragments %d", int32Data); @@ -115,7 +115,7 @@ void displayMetaData(const sp<MetaData> meta) { LOG1("displayMetaData kKeyColorFormat %d", int32Data); } if (meta->findPointer(kKeyPlatformPrivate, &ptr)) { - LOG1("displayMetaData kKeyPlatformPrivate pointer=0x%x", (int32_t) ptr); + LOG1("displayMetaData kKeyPlatformPrivate pointer=%p", ptr); } if (meta->findCString(kKeyDecoderComponent, &charData)) { LOG1("displayMetaData kKeyDecoderComponent %s", charData); @@ -151,7 +151,7 @@ void displayMetaData(const sp<MetaData> meta) { LOG1("displayMetaData kKeyYear %s", charData); } if (meta->findData(kKeyAlbumArt, &type, &data, &size)) { - LOG1("displayMetaData kKeyAlbumArt type=%d size=%d", type, size); + LOG1("displayMetaData kKeyAlbumArt type=%d size=%zu", type, size); } if (meta->findCString(kKeyAlbumArtMIME, &charData)) { LOG1("displayMetaData kKeyAlbumArtMIME %s", charData); @@ -277,7 +277,7 @@ status_t buildAVCCodecSpecificData(uint8_t **pOutputData, size_t *pOutputSize, } if (size < 4) { - ALOGE("Codec specific data length too short: %d", size); + ALOGE("Codec specific data length too short: %zu", size); return ERROR_MALFORMED; } @@ -286,7 +286,7 @@ status_t buildAVCCodecSpecificData(uint8_t **pOutputData, size_t *pOutputSize, // 2 bytes for each of the parameter set length field // plus the 7 bytes for the header if (size < 4 + 7) { - ALOGE("Codec specific data length too short: %d", size); + ALOGE("Codec specific data length too short: %zu", size); return ERROR_MALFORMED; } @@ -355,7 +355,7 @@ status_t buildAVCCodecSpecificData(uint8_t **pOutputData, size_t *pOutputSize, } if (nSeqParamSets > 0x1F) { - ALOGE("Too many seq parameter sets (%d) found", nSeqParamSets); + ALOGE("Too many seq parameter sets (%zu) found", nSeqParamSets); return ERROR_MALFORMED; } } @@ -368,7 +368,7 @@ status_t buildAVCCodecSpecificData(uint8_t **pOutputData, size_t *pOutputSize, return ERROR_MALFORMED; } if (nPicParamSets > 0xFF) { - ALOGE("Too many pic parameter sets (%d) found", nPicParamSets); + ALOGE("Too many pic parameter sets (%zu) found", nPicParamSets); return ERROR_MALFORMED; } } diff --git a/media/libeffects/downmix/EffectDownmix.c b/media/libeffects/downmix/EffectDownmix.c index f779876..a39d837 100644 --- a/media/libeffects/downmix/EffectDownmix.c +++ b/media/libeffects/downmix/EffectDownmix.c @@ -629,7 +629,9 @@ int Downmix_Configure(downmix_module_t *pDwmModule, effect_config_t *pConfig, bo return -EINVAL; } - memcpy(&pDwmModule->config, pConfig, sizeof(effect_config_t)); + if (&pDwmModule->config != pConfig) { + memcpy(&pDwmModule->config, pConfig, sizeof(effect_config_t)); + } if (init) { pDownmixer->type = DOWNMIX_TYPE_FOLD; @@ -697,7 +699,7 @@ int Downmix_Reset(downmix_object_t *pDownmixer, bool init) { * *---------------------------------------------------------------------------- */ -int Downmix_setParameter(downmix_object_t *pDownmixer, int32_t param, size_t size, void *pValue) { +int Downmix_setParameter(downmix_object_t *pDownmixer, int32_t param, uint32_t size, void *pValue) { int16_t value16; ALOGV("Downmix_setParameter, context %p, param %d, value16 %d, value32 %d", @@ -707,7 +709,7 @@ int Downmix_setParameter(downmix_object_t *pDownmixer, int32_t param, size_t siz case DOWNMIX_PARAM_TYPE: if (size != sizeof(downmix_type_t)) { - ALOGE("Downmix_setParameter(DOWNMIX_PARAM_TYPE) invalid size %d, should be %d", + ALOGE("Downmix_setParameter(DOWNMIX_PARAM_TYPE) invalid size %u, should be %zu", size, sizeof(downmix_type_t)); return -EINVAL; } @@ -753,14 +755,14 @@ int Downmix_setParameter(downmix_object_t *pDownmixer, int32_t param, size_t siz * *---------------------------------------------------------------------------- */ -int Downmix_getParameter(downmix_object_t *pDownmixer, int32_t param, size_t *pSize, void *pValue) { +int Downmix_getParameter(downmix_object_t *pDownmixer, int32_t param, uint32_t *pSize, void *pValue) { int16_t *pValue16; switch (param) { case DOWNMIX_PARAM_TYPE: if (*pSize < sizeof(int16_t)) { - ALOGE("Downmix_getParameter invalid parameter size %d for DOWNMIX_PARAM_TYPE", *pSize); + ALOGE("Downmix_getParameter invalid parameter size %zu for DOWNMIX_PARAM_TYPE", *pSize); return -EINVAL; } pValue16 = (int16_t *)pValue; diff --git a/media/libeffects/downmix/EffectDownmix.h b/media/libeffects/downmix/EffectDownmix.h index cb6b957..fcb3c9e 100644 --- a/media/libeffects/downmix/EffectDownmix.h +++ b/media/libeffects/downmix/EffectDownmix.h @@ -93,8 +93,8 @@ static int Downmix_GetDescriptor(effect_handle_t self, int Downmix_Init(downmix_module_t *pDwmModule); int Downmix_Configure(downmix_module_t *pDwmModule, effect_config_t *pConfig, bool init); int Downmix_Reset(downmix_object_t *pDownmixer, bool init); -int Downmix_setParameter(downmix_object_t *pDownmixer, int32_t param, size_t size, void *pValue); -int Downmix_getParameter(downmix_object_t *pDownmixer, int32_t param, size_t *pSize, void *pValue); +int Downmix_setParameter(downmix_object_t *pDownmixer, int32_t param, uint32_t size, void *pValue); +int Downmix_getParameter(downmix_object_t *pDownmixer, int32_t param, uint32_t *pSize, void *pValue); void Downmix_foldFromQuad(int16_t *pSrc, int16_t*pDst, size_t numFrames, bool accumulate); void Downmix_foldFromSurround(int16_t *pSrc, int16_t*pDst, size_t numFrames, bool accumulate); diff --git a/media/libeffects/factory/Android.mk b/media/libeffects/factory/Android.mk index 60a6ce5..a932af7 100644 --- a/media/libeffects/factory/Android.mk +++ b/media/libeffects/factory/Android.mk @@ -9,7 +9,6 @@ LOCAL_SRC_FILES:= \ LOCAL_SHARED_LIBRARIES := \ libcutils liblog -LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES) LOCAL_MODULE:= libeffects LOCAL_SHARED_LIBRARIES += libdl diff --git a/media/libeffects/lvm/lib/Bass/src/LVDBE_Init.c b/media/libeffects/lvm/lib/Bass/src/LVDBE_Init.c index 32c4ce0..35e5bc8 100644 --- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Init.c +++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Init.c @@ -178,7 +178,7 @@ LVDBE_ReturnStatus_en LVDBE_Init(LVDBE_Handle_t *phInstance, { return(LVDBE_NULLADDRESS); } - if (((LVM_UINT32)pMemoryTable->Region[i].pBaseAddress % pMemoryTable->Region[i].Alignment)!=0){ + if (((uintptr_t)pMemoryTable->Region[i].pBaseAddress % pMemoryTable->Region[i].Alignment)!=0){ return(LVDBE_ALIGNMENTERROR); } } diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_Process.c b/media/libeffects/lvm/lib/Bundle/src/LVM_Process.c index 794271b..f5a01f3 100644 --- a/media/libeffects/lvm/lib/Bundle/src/LVM_Process.c +++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Process.c @@ -99,7 +99,7 @@ LVM_ReturnStatus_en LVM_Process(LVM_Handle_t hInstance, /* * Check the buffer alignment */ - if((((LVM_UINT32)pInData % 4) != 0) || (((LVM_UINT32)pOutData % 4) != 0)) + if((((uintptr_t)pInData % 4) != 0) || (((uintptr_t)pOutData % 4) != 0)) { return(LVM_ALIGNMENTERROR); } diff --git a/media/libeffects/lvm/lib/Common/lib/InstAlloc.h b/media/libeffects/lvm/lib/Common/lib/InstAlloc.h index c6954f2..7f725f4 100644 --- a/media/libeffects/lvm/lib/Common/lib/InstAlloc.h +++ b/media/libeffects/lvm/lib/Common/lib/InstAlloc.h @@ -29,7 +29,7 @@ extern "C" { typedef struct { LVM_UINT32 TotalSize; /* Accumulative total memory size */ - LVM_UINT32 pNextMember; /* Pointer to the next instance member to be allocated */ + uintptr_t pNextMember; /* Pointer to the next instance member to be allocated */ } INST_ALLOC; diff --git a/media/libeffects/lvm/lib/Common/lib/LVM_Types.h b/media/libeffects/lvm/lib/Common/lib/LVM_Types.h index 81655dd..0c6fb25 100644 --- a/media/libeffects/lvm/lib/Common/lib/LVM_Types.h +++ b/media/libeffects/lvm/lib/Common/lib/LVM_Types.h @@ -29,6 +29,7 @@ extern "C" { #endif /* __cplusplus */ +#include <stdint.h> /****************************************************************************************/ /* */ @@ -85,14 +86,14 @@ extern "C" { typedef char LVM_CHAR; /* ASCII character */ -typedef char LVM_INT8; /* Signed 8-bit word */ -typedef unsigned char LVM_UINT8; /* Unsigned 8-bit word */ +typedef int8_t LVM_INT8; /* Signed 8-bit word */ +typedef uint8_t LVM_UINT8; /* Unsigned 8-bit word */ -typedef short LVM_INT16; /* Signed 16-bit word */ -typedef unsigned short LVM_UINT16; /* Unsigned 16-bit word */ +typedef int16_t LVM_INT16; /* Signed 16-bit word */ +typedef uint16_t LVM_UINT16; /* Unsigned 16-bit word */ -typedef long LVM_INT32; /* Signed 32-bit word */ -typedef unsigned long LVM_UINT32; /* Unsigned 32-bit word */ +typedef int32_t LVM_INT32; /* Signed 32-bit word */ +typedef uint32_t LVM_UINT32; /* Unsigned 32-bit word */ /****************************************************************************************/ diff --git a/media/libeffects/lvm/lib/Common/src/InstAlloc.c b/media/libeffects/lvm/lib/Common/src/InstAlloc.c index 481df84..a89a5c3 100644 --- a/media/libeffects/lvm/lib/Common/src/InstAlloc.c +++ b/media/libeffects/lvm/lib/Common/src/InstAlloc.c @@ -30,7 +30,7 @@ void InstAlloc_Init( INST_ALLOC *pms, void *StartAddr ) { pms->TotalSize = 3; - pms->pNextMember = (LVM_UINT32)(((LVM_UINT32)StartAddr + 3) & 0xFFFFFFFC);/* This code will fail if the platform address space is more than 32-bits*/ + pms->pNextMember = (((uintptr_t)StartAddr + 3) & (uintptr_t)~3); } @@ -51,7 +51,7 @@ void* InstAlloc_AddMember( INST_ALLOC *pms, void *NewMemberAddress; /* Variable to temporarily store the return value */ NewMemberAddress = (void*)pms->pNextMember; - Size = ((Size + 3) & 0xFFFFFFFC); /* Ceil the size to a multiple of four */ + Size = ((Size + 3) & (LVM_UINT32)~3); /* Ceil the size to a multiple of four */ pms->TotalSize += Size; pms->pNextMember += Size; @@ -84,30 +84,30 @@ LVM_UINT32 InstAlloc_GetTotal( INST_ALLOC *pms) void InstAlloc_InitAll( INST_ALLOC *pms, LVM_MemoryTable_st *pMemoryTable) { - LVM_UINT32 StartAddr; + uintptr_t StartAddr; - StartAddr = (LVM_UINT32)pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].pBaseAddress; + StartAddr = (uintptr_t)pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].pBaseAddress; pms[0].TotalSize = 3; - pms[0].pNextMember = (LVM_UINT32)(((LVM_UINT32)StartAddr + 3) & 0xFFFFFFFC); + pms[0].pNextMember = ((StartAddr + 3) & (uintptr_t)~3); - StartAddr = (LVM_UINT32)pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].pBaseAddress; + StartAddr = (uintptr_t)pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].pBaseAddress; pms[1].TotalSize = 3; - pms[1].pNextMember = (LVM_UINT32)(((LVM_UINT32)StartAddr + 3) & 0xFFFFFFFC); + pms[1].pNextMember = ((StartAddr + 3) & (uintptr_t)~3); - StartAddr = (LVM_UINT32)pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].pBaseAddress; + StartAddr = (uintptr_t)pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].pBaseAddress; pms[2].TotalSize = 3; - pms[2].pNextMember = (LVM_UINT32)(((LVM_UINT32)StartAddr + 3) & 0xFFFFFFFC); + pms[2].pNextMember = ((StartAddr + 3) & (uintptr_t)~3); - StartAddr = (LVM_UINT32)pMemoryTable->Region[LVM_TEMPORARY_FAST].pBaseAddress; + StartAddr = (uintptr_t)pMemoryTable->Region[LVM_TEMPORARY_FAST].pBaseAddress; pms[3].TotalSize = 3; - pms[3].pNextMember = (LVM_UINT32)(((LVM_UINT32)StartAddr + 3) & 0xFFFFFFFC); + pms[3].pNextMember = ((StartAddr + 3) & (uintptr_t)~3); } diff --git a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Init.c b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Init.c index c4767a8..e01c1c5 100644 --- a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Init.c +++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Init.c @@ -25,6 +25,7 @@ #include "LVEQNB.h" #include "LVEQNB_Private.h" #include "InstAlloc.h" +#include <string.h> /* For memset */ /****************************************************************************************/ /* */ diff --git a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Process.c b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Process.c index ac3c740..58f58ed 100644 --- a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Process.c +++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Process.c @@ -77,7 +77,7 @@ LVEQNB_ReturnStatus_en LVEQNB_Process(LVEQNB_Handle_t hInstance, } /* Check if the input and output data buffers are 32-bit aligned */ - if ((((LVM_INT32)pInData % 4) != 0) || (((LVM_INT32)pOutData % 4) != 0)) + if ((((uintptr_t)pInData % 4) != 0) || (((uintptr_t)pOutData % 4) != 0)) { return LVEQNB_ALIGNMENTERROR; } diff --git a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp index 28d239a..db5c78f 100644 --- a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp +++ b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp @@ -138,22 +138,22 @@ void Effect_getConfig (EffectContext *pContext, effect_config_t *pConfi int BassBoost_setParameter (EffectContext *pContext, void *pParam, void *pValue); int BassBoost_getParameter (EffectContext *pContext, void *pParam, - size_t *pValueSize, + uint32_t *pValueSize, void *pValue); int Virtualizer_setParameter (EffectContext *pContext, void *pParam, void *pValue); int Virtualizer_getParameter (EffectContext *pContext, void *pParam, - size_t *pValueSize, + uint32_t *pValueSize, void *pValue); int Equalizer_setParameter (EffectContext *pContext, void *pParam, void *pValue); int Equalizer_getParameter (EffectContext *pContext, void *pParam, - size_t *pValueSize, + uint32_t *pValueSize, void *pValue); int Volume_setParameter (EffectContext *pContext, void *pParam, void *pValue); int Volume_getParameter (EffectContext *pContext, void *pParam, - size_t *pValueSize, + uint32_t *pValueSize, void *pValue); int Effect_setEnabled(EffectContext *pContext, bool enabled); @@ -1758,7 +1758,7 @@ int32_t VolumeEnableStereoPosition(EffectContext *pContext, uint32_t enabled){ int BassBoost_getParameter(EffectContext *pContext, void *pParam, - size_t *pValueSize, + uint32_t *pValueSize, void *pValue){ int status = 0; int32_t *pParamTemp = (int32_t *)pParam; @@ -1876,7 +1876,7 @@ int BassBoost_setParameter (EffectContext *pContext, void *pParam, void *pValue) int Virtualizer_getParameter(EffectContext *pContext, void *pParam, - size_t *pValueSize, + uint32_t *pValueSize, void *pValue){ int status = 0; int32_t *pParamTemp = (int32_t *)pParam; @@ -1994,7 +1994,7 @@ int Virtualizer_setParameter (EffectContext *pContext, void *pParam, void *pValu //---------------------------------------------------------------------------- int Equalizer_getParameter(EffectContext *pContext, void *pParam, - size_t *pValueSize, + uint32_t *pValueSize, void *pValue){ int status = 0; int bMute = 0; @@ -2252,7 +2252,7 @@ int Equalizer_setParameter (EffectContext *pContext, void *pParam, void *pValue) int Volume_getParameter(EffectContext *pContext, void *pParam, - size_t *pValueSize, + uint32_t *pValueSize, void *pValue){ int status = 0; int bMute = 0; @@ -2813,9 +2813,9 @@ int Effect_command(effect_handle_t self, if(pContext->EffectType == LVM_BASS_BOOST){ if (pCmdData == NULL || - cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)) || + cmdSize < (sizeof(effect_param_t) + sizeof(int32_t)) || pReplyData == NULL || - *replySize < (int) (sizeof(effect_param_t) + sizeof(int32_t))){ + *replySize < (sizeof(effect_param_t) + sizeof(int32_t))){ ALOGV("\tLVM_ERROR : BassBoost_command cmdCode Case: " "EFFECT_CMD_GET_PARAM: ERROR"); return -EINVAL; @@ -2830,7 +2830,7 @@ int Effect_command(effect_handle_t self, p->status = android::BassBoost_getParameter(pContext, p->data, - (size_t *)&p->vsize, + &p->vsize, p->data + voffset); *replySize = sizeof(effect_param_t) + voffset + p->vsize; @@ -2844,9 +2844,9 @@ int Effect_command(effect_handle_t self, if(pContext->EffectType == LVM_VIRTUALIZER){ if (pCmdData == NULL || - cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)) || + cmdSize < (sizeof(effect_param_t) + sizeof(int32_t)) || pReplyData == NULL || - *replySize < (int) (sizeof(effect_param_t) + sizeof(int32_t))){ + *replySize < (sizeof(effect_param_t) + sizeof(int32_t))){ ALOGV("\tLVM_ERROR : Virtualizer_command cmdCode Case: " "EFFECT_CMD_GET_PARAM: ERROR"); return -EINVAL; @@ -2860,8 +2860,8 @@ int Effect_command(effect_handle_t self, int voffset = ((p->psize - 1) / sizeof(int32_t) + 1) * sizeof(int32_t); p->status = android::Virtualizer_getParameter(pContext, - (void *)p->data, - (size_t *)&p->vsize, + (void *)p->data, + &p->vsize, p->data + voffset); *replySize = sizeof(effect_param_t) + voffset + p->vsize; @@ -2876,7 +2876,7 @@ int Effect_command(effect_handle_t self, //ALOGV("\tEqualizer_command cmdCode Case: " // "EFFECT_CMD_GET_PARAM start"); if (pCmdData == NULL || - cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)) || + cmdSize < (sizeof(effect_param_t) + sizeof(int32_t)) || pReplyData == NULL || *replySize < (int) (sizeof(effect_param_t) + sizeof(int32_t))) { ALOGV("\tLVM_ERROR : Equalizer_command cmdCode Case: " @@ -2908,7 +2908,7 @@ int Effect_command(effect_handle_t self, if(pContext->EffectType == LVM_VOLUME){ //ALOGV("\tVolume_command cmdCode Case: EFFECT_CMD_GET_PARAM start"); if (pCmdData == NULL || - cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)) || + cmdSize < (sizeof(effect_param_t) + sizeof(int32_t)) || pReplyData == NULL || *replySize < (int) (sizeof(effect_param_t) + sizeof(int32_t))){ ALOGV("\tLVM_ERROR : Volume_command cmdCode Case: " @@ -2925,7 +2925,7 @@ int Effect_command(effect_handle_t self, p->status = android::Volume_getParameter(pContext, (void *)p->data, - (size_t *)&p->vsize, + &p->vsize, p->data + voffset); *replySize = sizeof(effect_param_t) + voffset + p->vsize; @@ -2947,7 +2947,7 @@ int Effect_command(effect_handle_t self, // *(int16_t *)((char *)pCmdData + sizeof(effect_param_t) + sizeof(int32_t))); if (pCmdData == NULL|| - cmdSize != (int)(sizeof(effect_param_t) + sizeof(int32_t) +sizeof(int16_t))|| + cmdSize != (sizeof(effect_param_t) + sizeof(int32_t) +sizeof(int16_t))|| pReplyData == NULL|| *replySize != sizeof(int32_t)){ ALOGV("\tLVM_ERROR : BassBoost_command cmdCode Case: " @@ -2980,7 +2980,7 @@ int Effect_command(effect_handle_t self, // *(int16_t *)((char *)pCmdData + sizeof(effect_param_t) + sizeof(int32_t))); if (pCmdData == NULL|| - cmdSize != (int)(sizeof(effect_param_t) + sizeof(int32_t) +sizeof(int16_t))|| + cmdSize != (sizeof(effect_param_t) + sizeof(int32_t) +sizeof(int16_t))|| pReplyData == NULL|| *replySize != sizeof(int32_t)){ ALOGV("\tLVM_ERROR : Virtualizer_command cmdCode Case: " @@ -3014,7 +3014,7 @@ int Effect_command(effect_handle_t self, // *replySize, // *(int16_t *)((char *)pCmdData + sizeof(effect_param_t) + sizeof(int32_t))); - if (pCmdData == NULL || cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)) || + if (pCmdData == NULL || cmdSize < (sizeof(effect_param_t) + sizeof(int32_t)) || pReplyData == NULL || *replySize != sizeof(int32_t)) { ALOGV("\tLVM_ERROR : Equalizer_command cmdCode Case: " "EFFECT_CMD_SET_PARAM: ERROR"); @@ -3034,7 +3034,7 @@ int Effect_command(effect_handle_t self, // *(int16_t *)((char *)pCmdData + sizeof(effect_param_t) +sizeof(int32_t))); if ( pCmdData == NULL|| - cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t))|| + cmdSize < (sizeof(effect_param_t) + sizeof(int32_t))|| pReplyData == NULL|| *replySize != sizeof(int32_t)){ ALOGV("\tLVM_ERROR : Volume_command cmdCode Case: " diff --git a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp index 0367302..c6d3759 100644 --- a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp +++ b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp @@ -181,7 +181,7 @@ void Reverb_getConfig (ReverbContext *pContext, effect_config_t *pConfig); int Reverb_setParameter (ReverbContext *pContext, void *pParam, void *pValue); int Reverb_getParameter (ReverbContext *pContext, void *pParam, - size_t *pValueSize, + uint32_t *pValueSize, void *pValue); int Reverb_LoadPreset (ReverbContext *pContext); @@ -1534,7 +1534,7 @@ int Reverb_LoadPreset(ReverbContext *pContext) int Reverb_getParameter(ReverbContext *pContext, void *pParam, - size_t *pValueSize, + uint32_t *pValueSize, void *pValue){ int status = 0; int32_t *pParamTemp = (int32_t *)pParam; @@ -1956,9 +1956,9 @@ int Reverb_command(effect_handle_t self, //ALOGV("\tReverb_command cmdCode Case: " // "EFFECT_CMD_GET_PARAM start"); if (pCmdData == NULL || - cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)) || + cmdSize < (sizeof(effect_param_t) + sizeof(int32_t)) || pReplyData == NULL || - *replySize < (int) (sizeof(effect_param_t) + sizeof(int32_t))){ + *replySize < (sizeof(effect_param_t) + sizeof(int32_t))){ ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: " "EFFECT_CMD_GET_PARAM: ERROR"); return -EINVAL; @@ -1973,7 +1973,7 @@ int Reverb_command(effect_handle_t self, p->status = android::Reverb_getParameter(pContext, (void *)p->data, - (size_t *)&p->vsize, + &p->vsize, p->data + voffset); *replySize = sizeof(effect_param_t) + voffset + p->vsize; @@ -1994,8 +1994,8 @@ int Reverb_command(effect_handle_t self, // *replySize, // *(int16_t *)((char *)pCmdData + sizeof(effect_param_t) + sizeof(int32_t))); - if (pCmdData == NULL || (cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t))) - || pReplyData == NULL || *replySize != (int)sizeof(int32_t)) { + if (pCmdData == NULL || (cmdSize < (sizeof(effect_param_t) + sizeof(int32_t))) + || pReplyData == NULL || *replySize != sizeof(int32_t)) { ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: " "EFFECT_CMD_SET_PARAM: ERROR"); return -EINVAL; diff --git a/media/libeffects/preprocessing/PreProcessing.cpp b/media/libeffects/preprocessing/PreProcessing.cpp index d72eaf5..a96a703 100644 --- a/media/libeffects/preprocessing/PreProcessing.cpp +++ b/media/libeffects/preprocessing/PreProcessing.cpp @@ -77,7 +77,7 @@ struct preproc_ops_s { void (* enable)(preproc_effect_t *fx); void (* disable)(preproc_effect_t *fx); int (* set_parameter)(preproc_effect_t *fx, void *param, void *value); - int (* get_parameter)(preproc_effect_t *fx, void *param, size_t *size, void *value); + int (* get_parameter)(preproc_effect_t *fx, void *param, uint32_t *size, void *value); int (* set_device)(preproc_effect_t *fx, uint32_t device); }; @@ -291,7 +291,7 @@ int AgcCreate(preproc_effect_t *effect) int AgcGetParameter(preproc_effect_t *effect, void *pParam, - size_t *pValueSize, + uint32_t *pValueSize, void *pValue) { int status = 0; @@ -452,9 +452,9 @@ int AecCreate(preproc_effect_t *effect) return 0; } -int AecGetParameter(preproc_effect_t *effect, +int AecGetParameter(preproc_effect_t *effect, void *pParam, - size_t *pValueSize, + uint32_t *pValueSize, void *pValue) { int status = 0; @@ -575,9 +575,9 @@ int NsCreate(preproc_effect_t *effect) return 0; } -int NsGetParameter(preproc_effect_t *effect, +int NsGetParameter(preproc_effect_t *effect, void *pParam, - size_t *pValueSize, + uint32_t *pValueSize, void *pValue) { int status = 0; @@ -1233,8 +1233,8 @@ int PreProcessingFx_Process(effect_handle_t self, if (session->framesIn < session->frameCount) { return 0; } - size_t frIn = session->framesIn; - size_t frOut = session->apmFrameCount; + spx_uint32_t frIn = session->framesIn; + spx_uint32_t frOut = session->apmFrameCount; if (session->inChannelCount == 1) { speex_resampler_process_int(session->inResampler, 0, @@ -1290,8 +1290,8 @@ int PreProcessingFx_Process(effect_handle_t self, } if (session->outResampler != NULL) { - size_t frIn = session->apmFrameCount; - size_t frOut = session->frameCount; + spx_uint32_t frIn = session->apmFrameCount; + spx_uint32_t frOut = session->frameCount; if (session->inChannelCount == 1) { speex_resampler_process_int(session->outResampler, 0, @@ -1453,7 +1453,7 @@ int PreProcessingFx_Command(effect_handle_t self, if (effect->ops->get_parameter) { p->status = effect->ops->get_parameter(effect, p->data, - (size_t *)&p->vsize, + &p->vsize, p->data + voffset); *replySize = sizeof(effect_param_t) + voffset + p->vsize; } @@ -1754,8 +1754,8 @@ int PreProcessingFx_ProcessReverse(effect_handle_t self, if (session->framesRev < session->frameCount) { return 0; } - size_t frIn = session->framesRev; - size_t frOut = session->apmFrameCount; + spx_uint32_t frIn = session->framesRev; + spx_uint32_t frOut = session->apmFrameCount; if (session->inChannelCount == 1) { speex_resampler_process_int(session->revResampler, 0, diff --git a/media/libeffects/testlibs/EffectEqualizer.cpp b/media/libeffects/testlibs/EffectEqualizer.cpp index 8d00206..3cb13f2 100644 --- a/media/libeffects/testlibs/EffectEqualizer.cpp +++ b/media/libeffects/testlibs/EffectEqualizer.cpp @@ -115,7 +115,7 @@ struct EqualizerContext { int Equalizer_init(EqualizerContext *pContext); int Equalizer_setConfig(EqualizerContext *pContext, effect_config_t *pConfig); -int Equalizer_getParameter(AudioEqualizer * pEqualizer, int32_t *pParam, size_t *pValueSize, void *pValue); +int Equalizer_getParameter(AudioEqualizer * pEqualizer, int32_t *pParam, uint32_t *pValueSize, void *pValue); int Equalizer_setParameter(AudioEqualizer * pEqualizer, int32_t *pParam, void *pValue); @@ -360,7 +360,7 @@ int Equalizer_init(EqualizerContext *pContext) // //---------------------------------------------------------------------------- -int Equalizer_getParameter(AudioEqualizer * pEqualizer, int32_t *pParam, size_t *pValueSize, void *pValue) +int Equalizer_getParameter(AudioEqualizer * pEqualizer, int32_t *pParam, uint32_t *pValueSize, void *pValue) { int status = 0; int32_t param = *pParam++; @@ -662,8 +662,8 @@ extern "C" int Equalizer_command(effect_handle_t self, uint32_t cmdCode, uint32_ Equalizer_setConfig(pContext, &pContext->config); break; case EFFECT_CMD_GET_PARAM: { - if (pCmdData == NULL || cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)) || - pReplyData == NULL || *replySize < (int) (sizeof(effect_param_t) + sizeof(int32_t))) { + if (pCmdData == NULL || cmdSize < (sizeof(effect_param_t) + sizeof(int32_t)) || + pReplyData == NULL || *replySize < (sizeof(effect_param_t) + sizeof(int32_t))) { return -EINVAL; } effect_param_t *p = (effect_param_t *)pCmdData; @@ -682,7 +682,7 @@ extern "C" int Equalizer_command(effect_handle_t self, uint32_t cmdCode, uint32_ case EFFECT_CMD_SET_PARAM: { ALOGV("Equalizer_command EFFECT_CMD_SET_PARAM cmdSize %d pCmdData %p, *replySize %d, pReplyData %p", cmdSize, pCmdData, *replySize, pReplyData); - if (pCmdData == NULL || cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)) || + if (pCmdData == NULL || cmdSize < (sizeof(effect_param_t) + sizeof(int32_t)) || pReplyData == NULL || *replySize != sizeof(int32_t)) { return -EINVAL; } diff --git a/media/libeffects/testlibs/EffectReverb.c b/media/libeffects/testlibs/EffectReverb.c index c37f392..f056d19 100644 --- a/media/libeffects/testlibs/EffectReverb.c +++ b/media/libeffects/testlibs/EffectReverb.c @@ -750,7 +750,7 @@ void Reverb_Reset(reverb_object_t *pReverb, bool init) { * *---------------------------------------------------------------------------- */ -int Reverb_getParameter(reverb_object_t *pReverb, int32_t param, size_t *pSize, +int Reverb_getParameter(reverb_object_t *pReverb, int32_t param, uint32_t *pSize, void *pValue) { int32_t *pValue32; int16_t *pValue16; @@ -758,7 +758,7 @@ int Reverb_getParameter(reverb_object_t *pReverb, int32_t param, size_t *pSize, int32_t i; int32_t temp; int32_t temp2; - size_t size; + uint32_t size; if (pReverb->m_Preset) { if (param != REVERB_PARAM_PRESET || *pSize < sizeof(int16_t)) { @@ -1033,7 +1033,7 @@ int Reverb_getParameter(reverb_object_t *pReverb, int32_t param, size_t *pSize, * *---------------------------------------------------------------------------- */ -int Reverb_setParameter(reverb_object_t *pReverb, int32_t param, size_t size, +int Reverb_setParameter(reverb_object_t *pReverb, int32_t param, uint32_t size, void *pValue) { int32_t value32; int16_t value16; @@ -1044,7 +1044,7 @@ int Reverb_setParameter(reverb_object_t *pReverb, int32_t param, size_t size, reverb_preset_t *pPreset; int maxSamples; int32_t averageDelay; - size_t paramSize; + uint32_t paramSize; ALOGV("Reverb_setParameter, context %p, param %d, value16 %d, value32 %d", pReverb, param, *(int16_t *)pValue, *(int32_t *)pValue); diff --git a/media/libeffects/testlibs/EffectReverb.h b/media/libeffects/testlibs/EffectReverb.h index e5248fe..756c5ea 100644 --- a/media/libeffects/testlibs/EffectReverb.h +++ b/media/libeffects/testlibs/EffectReverb.h @@ -330,8 +330,8 @@ int Reverb_setConfig(reverb_module_t *pRvbModule, effect_config_t *pConfig, bool void Reverb_getConfig(reverb_module_t *pRvbModule, effect_config_t *pConfig); void Reverb_Reset(reverb_object_t *pReverb, bool init); -int Reverb_setParameter (reverb_object_t *pReverb, int32_t param, size_t size, void *pValue); -int Reverb_getParameter(reverb_object_t *pReverb, int32_t param, size_t *pSize, void *pValue); +int Reverb_setParameter (reverb_object_t *pReverb, int32_t param, uint32_t size, void *pValue); +int Reverb_getParameter(reverb_object_t *pReverb, int32_t param, uint32_t *pSize, void *pValue); /*---------------------------------------------------------------------------- * ReverbUpdateXfade diff --git a/media/libeffects/visualizer/EffectVisualizer.cpp b/media/libeffects/visualizer/EffectVisualizer.cpp index 2d66eef..5bdaa03 100644 --- a/media/libeffects/visualizer/EffectVisualizer.cpp +++ b/media/libeffects/visualizer/EffectVisualizer.cpp @@ -544,56 +544,57 @@ int Visualizer_command(effect_handle_t self, uint32_t cmdCode, uint32_t cmdSize, break; - case VISUALIZER_CMD_CAPTURE: - if (pReplyData == NULL || *replySize != pContext->mCaptureSize) { - ALOGV("VISUALIZER_CMD_CAPTURE() error *replySize %d pContext->mCaptureSize %d", - *replySize, pContext->mCaptureSize); + case VISUALIZER_CMD_CAPTURE: { + int32_t captureSize = pContext->mCaptureSize; + if (pReplyData == NULL || *replySize != captureSize) { + ALOGV("VISUALIZER_CMD_CAPTURE() error *replySize %d captureSize %d", + *replySize, captureSize); return -EINVAL; } if (pContext->mState == VISUALIZER_STATE_ACTIVE) { - int32_t latencyMs = pContext->mLatency; const uint32_t deltaMs = Visualizer_getDeltaTimeMsFromUpdatedTime(pContext); - latencyMs -= deltaMs; - if (latencyMs < 0) { - latencyMs = 0; - } - const uint32_t deltaSmpl = pContext->mConfig.inputCfg.samplingRate * latencyMs / 1000; - - int32_t capturePoint = pContext->mCaptureIdx - pContext->mCaptureSize - deltaSmpl; - int32_t captureSize = pContext->mCaptureSize; - if (capturePoint < 0) { - int32_t size = -capturePoint; - if (size > captureSize) { - size = captureSize; - } - memcpy(pReplyData, - pContext->mCaptureBuf + CAPTURE_BUF_SIZE + capturePoint, - size); - pReplyData = (char *)pReplyData + size; - captureSize -= size; - capturePoint = 0; - } - memcpy(pReplyData, - pContext->mCaptureBuf + capturePoint, - captureSize); - // if audio framework has stopped playing audio although the effect is still // active we must clear the capture buffer to return silence if ((pContext->mLastCaptureIdx == pContext->mCaptureIdx) && - (pContext->mBufferUpdateTime.tv_sec != 0)) { - if (deltaMs > MAX_STALL_TIME_MS) { + (pContext->mBufferUpdateTime.tv_sec != 0) && + (deltaMs > MAX_STALL_TIME_MS)) { ALOGV("capture going to idle"); pContext->mBufferUpdateTime.tv_sec = 0; - memset(pReplyData, 0x80, pContext->mCaptureSize); + memset(pReplyData, 0x80, captureSize); + } else { + int32_t latencyMs = pContext->mLatency; + latencyMs -= deltaMs; + if (latencyMs < 0) { + latencyMs = 0; } + const uint32_t deltaSmpl = + pContext->mConfig.inputCfg.samplingRate * latencyMs / 1000; + int32_t capturePoint = pContext->mCaptureIdx - captureSize - deltaSmpl; + + if (capturePoint < 0) { + int32_t size = -capturePoint; + if (size > captureSize) { + size = captureSize; + } + memcpy(pReplyData, + pContext->mCaptureBuf + CAPTURE_BUF_SIZE + capturePoint, + size); + pReplyData = (char *)pReplyData + size; + captureSize -= size; + capturePoint = 0; + } + memcpy(pReplyData, + pContext->mCaptureBuf + capturePoint, + captureSize); } + pContext->mLastCaptureIdx = pContext->mCaptureIdx; } else { - memset(pReplyData, 0x80, pContext->mCaptureSize); + memset(pReplyData, 0x80, captureSize); } - break; + } break; case VISUALIZER_CMD_MEASURE: { uint16_t peakU16 = 0; diff --git a/media/libmedia/AudioSystem.cpp b/media/libmedia/AudioSystem.cpp index 8033c2c..cc5b810 100644 --- a/media/libmedia/AudioSystem.cpp +++ b/media/libmedia/AudioSystem.cpp @@ -370,8 +370,8 @@ status_t AudioSystem::setVoiceVolume(float value) return af->setVoiceVolume(value); } -status_t AudioSystem::getRenderPosition(audio_io_handle_t output, size_t *halFrames, - size_t *dspFrames, audio_stream_type_t stream) +status_t AudioSystem::getRenderPosition(audio_io_handle_t output, uint32_t *halFrames, + uint32_t *dspFrames, audio_stream_type_t stream) { const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger(); if (af == 0) return PERMISSION_DENIED; diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp index e290627..3f3a88c 100644 --- a/media/libmedia/AudioTrack.cpp +++ b/media/libmedia/AudioTrack.cpp @@ -779,7 +779,7 @@ status_t AudioTrack::getPosition(uint32_t *position) const return NO_ERROR; } -status_t AudioTrack::getBufferPosition(size_t *position) +status_t AudioTrack::getBufferPosition(uint32_t *position) { if (mSharedBuffer == 0 || mIsTimed) { return INVALID_OPERATION; @@ -897,6 +897,12 @@ status_t AudioTrack::createTrack_l( } ALOGV("createTrack_l() output %d afLatency %d", output, afLatency); + if ((flags & AUDIO_OUTPUT_FLAG_FAST) && sampleRate != afSampleRate) { + ALOGW("AUDIO_OUTPUT_FLAG_FAST denied by client due to mismatching sample rate (%d vs %d)", + sampleRate, afSampleRate); + flags = (audio_output_flags_t) (flags & ~AUDIO_OUTPUT_FLAG_FAST); + } + // The client's AudioTrack buffer is divided into n parts for purpose of wakeup by server, where // n = 1 fast track with single buffering; nBuffering is ignored // n = 2 fast track with double buffering @@ -928,7 +934,7 @@ status_t AudioTrack::createTrack_l( // More than 2 channels does not require stronger alignment than stereo alignment <<= 1; } - if (((size_t)sharedBuffer->pointer() & (alignment - 1)) != 0) { + if (((uintptr_t)sharedBuffer->pointer() & (alignment - 1)) != 0) { ALOGE("Invalid buffer alignment: address %p, channel count %u", sharedBuffer->pointer(), mChannelCount); return BAD_VALUE; @@ -1257,7 +1263,7 @@ ssize_t AudioTrack::write(const void* buffer, size_t userSize) if (ssize_t(userSize) < 0 || (buffer == NULL && userSize != 0)) { // Sanity-check: user is most-likely passing an error code, and it would // make the return value ambiguous (actualSize vs error). - ALOGE("AudioTrack::write(buffer=%p, size=%u (%d)", buffer, userSize, userSize); + ALOGE("AudioTrack::write(buffer=%p, size=%zu (%zd)", buffer, userSize, userSize); return BAD_VALUE; } @@ -1798,7 +1804,7 @@ status_t AudioTrack::dump(int fd, const Vector<String16>& args) const snprintf(buffer, 255, " stream type(%d), left - right volume(%f, %f)\n", mStreamType, mVolume[0], mVolume[1]); result.append(buffer); - snprintf(buffer, 255, " format(%d), channel count(%d), frame count(%d)\n", mFormat, + snprintf(buffer, 255, " format(%d), channel count(%d), frame count(%zu)\n", mFormat, mChannelCount, mFrameCount); result.append(buffer); snprintf(buffer, 255, " sample rate(%u), status(%d)\n", mSampleRate, mStatus); diff --git a/media/libmedia/AudioTrackShared.cpp b/media/libmedia/AudioTrackShared.cpp index caa7900..e898109 100644 --- a/media/libmedia/AudioTrackShared.cpp +++ b/media/libmedia/AudioTrackShared.cpp @@ -475,9 +475,14 @@ void StaticAudioTrackClientProxy::flush() void StaticAudioTrackClientProxy::setLoop(size_t loopStart, size_t loopEnd, int loopCount) { + // This can only happen on a 64-bit client + if (loopStart > UINT32_MAX || loopEnd > UINT32_MAX) { + // FIXME Should return an error status + return; + } StaticAudioTrackState newState; - newState.mLoopStart = loopStart; - newState.mLoopEnd = loopEnd; + newState.mLoopStart = (uint32_t) loopStart; + newState.mLoopEnd = (uint32_t) loopEnd; newState.mLoopCount = loopCount; mBufferPosition = loopStart; (void) mMutator.push(newState); @@ -487,7 +492,7 @@ size_t StaticAudioTrackClientProxy::getBufferPosition() { size_t bufferPosition; if (mMutator.ack()) { - bufferPosition = mCblk->u.mStatic.mBufferPosition; + bufferPosition = (size_t) mCblk->u.mStatic.mBufferPosition; if (bufferPosition > mFrameCount) { bufferPosition = mFrameCount; } @@ -622,7 +627,7 @@ void ServerProxy::releaseBuffer(Buffer* buffer) if (half == 0) { half = 1; } - size_t minimum = cblk->mMinimum; + size_t minimum = (size_t) cblk->mMinimum; if (minimum == 0) { minimum = mIsOut ? half : 1; } else if (minimum > half) { @@ -760,7 +765,8 @@ ssize_t StaticAudioTrackServerProxy::pollPosition() mIsShutdown = true; return (ssize_t) NO_INIT; } - mCblk->u.mStatic.mBufferPosition = position; + // This may overflow, but client is not supposed to rely on it + mCblk->u.mStatic.mBufferPosition = (uint32_t) position; } return (ssize_t) position; } @@ -836,7 +842,8 @@ void StaticAudioTrackServerProxy::releaseBuffer(Buffer* buffer) mPosition = newPosition; cblk->mServer += stepCount; - cblk->u.mStatic.mBufferPosition = newPosition; + // This may overflow, but client is not supposed to rely on it + cblk->u.mStatic.mBufferPosition = (uint32_t) newPosition; if (setFlags != 0) { (void) android_atomic_or(setFlags, &cblk->mFlags); // this would be a good place to wake a futex diff --git a/media/libmedia/IAudioFlinger.cpp b/media/libmedia/IAudioFlinger.cpp index acfaea0..86ff8bd 100644 --- a/media/libmedia/IAudioFlinger.cpp +++ b/media/libmedia/IAudioFlinger.cpp @@ -525,7 +525,7 @@ public: return reply.readInt32(); } - 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 { Parcel data, reply; @@ -546,7 +546,7 @@ public: return status; } - virtual size_t getInputFramesLost(audio_io_handle_t ioHandle) const + virtual uint32_t getInputFramesLost(audio_io_handle_t ioHandle) const { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); @@ -1013,8 +1013,8 @@ status_t BnAudioFlinger::onTransact( case GET_RENDER_POSITION: { CHECK_INTERFACE(IAudioFlinger, data, reply); audio_io_handle_t output = (audio_io_handle_t) data.readInt32(); - size_t halFrames; - size_t dspFrames; + uint32_t halFrames; + uint32_t dspFrames; status_t status = getRenderPosition(&halFrames, &dspFrames, output); reply->writeInt32(status); if (status == NO_ERROR) { diff --git a/media/libmediaplayerservice/Android.mk b/media/libmediaplayerservice/Android.mk index 8f21632..85c9464 100644 --- a/media/libmediaplayerservice/Android.mk +++ b/media/libmediaplayerservice/Android.mk @@ -54,6 +54,8 @@ LOCAL_C_INCLUDES := \ LOCAL_MODULE:= libmediaplayerservice +LOCAL_32_BIT_ONLY := true + include $(BUILD_SHARED_LIBRARY) include $(call all-makefiles-under,$(LOCAL_PATH)) diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp index 9ac9105..a392b76 100644 --- a/media/libmediaplayerservice/MediaPlayerService.cpp +++ b/media/libmediaplayerservice/MediaPlayerService.cpp @@ -319,7 +319,7 @@ status_t MediaPlayerService::AudioCache::dump(int fd, const Vector<String16>& ar result.append(" AudioCache\n"); if (mHeap != 0) { - snprintf(buffer, 255, " heap base(%p), size(%d), flags(%d)\n", + snprintf(buffer, 255, " heap base(%p), size(%zu), flags(%d)\n", mHeap->getBase(), mHeap->getSize(), mHeap->getFlags()); result.append(buffer); } diff --git a/media/libmediaplayerservice/StagefrightRecorder.cpp b/media/libmediaplayerservice/StagefrightRecorder.cpp index f9d9020..4da74e1 100644 --- a/media/libmediaplayerservice/StagefrightRecorder.cpp +++ b/media/libmediaplayerservice/StagefrightRecorder.cpp @@ -16,6 +16,7 @@ //#define LOG_NDEBUG 0 #define LOG_TAG "StagefrightRecorder" +#include <inttypes.h> #include <utils/Log.h> #include "StagefrightRecorder.h" @@ -1747,15 +1748,15 @@ status_t StagefrightRecorder::dump( result.append(buffer); snprintf(buffer, SIZE, " File format: %d\n", mOutputFormat); result.append(buffer); - snprintf(buffer, SIZE, " Max file size (bytes): %lld\n", mMaxFileSizeBytes); + snprintf(buffer, SIZE, " Max file size (bytes): %" PRId64 "\n", mMaxFileSizeBytes); result.append(buffer); - snprintf(buffer, SIZE, " Max file duration (us): %lld\n", mMaxFileDurationUs); + snprintf(buffer, SIZE, " Max file duration (us): %" PRId64 "\n", mMaxFileDurationUs); result.append(buffer); snprintf(buffer, SIZE, " File offset length (bits): %d\n", mUse64BitFileOffset? 64: 32); result.append(buffer); snprintf(buffer, SIZE, " Interleave duration (us): %d\n", mInterleaveDurationUs); result.append(buffer); - snprintf(buffer, SIZE, " Progress notification: %lld us\n", mTrackEveryTimeDurationUs); + snprintf(buffer, SIZE, " Progress notification: %" PRId64 " us\n", mTrackEveryTimeDurationUs); result.append(buffer); snprintf(buffer, SIZE, " Audio\n"); result.append(buffer); diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp index 47834fd..239296e 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp +++ b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp @@ -16,6 +16,7 @@ //#define LOG_NDEBUG 0 #define LOG_TAG "NuPlayerDriver" +#include <inttypes.h> #include <utils/Log.h> #include "NuPlayerDriver.h" @@ -499,7 +500,7 @@ status_t NuPlayerDriver::dump(int fd, const Vector<String16> &args) const { FILE *out = fdopen(dup(fd), "w"); fprintf(out, " NuPlayer\n"); - fprintf(out, " numFramesTotal(%lld), numFramesDropped(%lld), " + fprintf(out, " numFramesTotal(%" PRId64 "), numFramesDropped(%" PRId64 "), " "percentageDropped(%.2f)\n", mNumFramesTotal, mNumFramesDropped, diff --git a/media/libmediaplayerservice/nuplayer/mp4/MP4Source.cpp b/media/libmediaplayerservice/nuplayer/mp4/MP4Source.cpp index d31d947..2aae4dd 100644 --- a/media/libmediaplayerservice/nuplayer/mp4/MP4Source.cpp +++ b/media/libmediaplayerservice/nuplayer/mp4/MP4Source.cpp @@ -86,7 +86,7 @@ struct StreamSource : public FragmentedMP4Parser::Source { total += n; } - ALOGV("read %ld bytes at offset %lld", n, mPosition); + ALOGV("read %ld bytes at offset %lld", total, mPosition); mPosition += total; diff --git a/media/libnbaio/NBLog.cpp b/media/libnbaio/NBLog.cpp index 045bf64..d74a7a6 100644 --- a/media/libnbaio/NBLog.cpp +++ b/media/libnbaio/NBLog.cpp @@ -340,7 +340,7 @@ void NBLog::Reader::dump(int fd, size_t indent) if (i > 0) { lost += i; if (fd >= 0) { - fdprintf(fd, "%*swarning: lost %u bytes worth of events\n", indent, "", lost); + fdprintf(fd, "%*swarning: lost %zu bytes worth of events\n", indent, "", lost); } else { ALOGI("%*swarning: lost %u bytes worth of events\n", indent, "", lost); } diff --git a/media/libstagefright/AACWriter.cpp b/media/libstagefright/AACWriter.cpp index a6f7cfb..c9bcaba 100644 --- a/media/libstagefright/AACWriter.cpp +++ b/media/libstagefright/AACWriter.cpp @@ -171,7 +171,7 @@ status_t AACWriter::reset() { void *dummy; pthread_join(mThread, &dummy); - status_t err = (status_t) dummy; + status_t err = static_cast<status_t>(reinterpret_cast<uintptr_t>(dummy)); { status_t status = mSource->stop(); if (err == OK && @@ -200,7 +200,7 @@ bool AACWriter::exceedsFileDurationLimit() { // static void *AACWriter::ThreadWrapper(void *me) { - return (void *) static_cast<AACWriter *>(me)->threadFunc(); + return (void *)(uintptr_t)static_cast<AACWriter *>(me)->threadFunc(); } /* diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp index a8c95c3..6dcedca 100644 --- a/media/libstagefright/ACodec.cpp +++ b/media/libstagefright/ACodec.cpp @@ -3507,7 +3507,7 @@ void ACodec::BaseState::onOutputBufferDrained(const sp<AMessage> &msg) { int32_t render; if (mCodec->mNativeWindow != NULL && msg->findInt32("render", &render) && render != 0 - && (info->mData == NULL || info->mData->size() != 0)) { + && info->mData != NULL && info->mData->size() != 0) { // The client wants this buffer to be rendered. status_t err; diff --git a/media/libstagefright/AMRWriter.cpp b/media/libstagefright/AMRWriter.cpp index 8d5eec8..3fe247a 100644 --- a/media/libstagefright/AMRWriter.cpp +++ b/media/libstagefright/AMRWriter.cpp @@ -162,7 +162,7 @@ status_t AMRWriter::reset() { void *dummy; pthread_join(mThread, &dummy); - status_t err = (status_t) dummy; + status_t err = static_cast<status_t>(reinterpret_cast<uintptr_t>(dummy)); { status_t status = mSource->stop(); if (err == OK && @@ -191,7 +191,7 @@ bool AMRWriter::exceedsFileDurationLimit() { // static void *AMRWriter::ThreadWrapper(void *me) { - return (void *) static_cast<AMRWriter *>(me)->threadFunc(); + return (void *)(uintptr_t) static_cast<AMRWriter *>(me)->threadFunc(); } status_t AMRWriter::threadFunc() { diff --git a/media/libstagefright/AudioSource.cpp b/media/libstagefright/AudioSource.cpp index d7223d9..f0d1a14 100644 --- a/media/libstagefright/AudioSource.cpp +++ b/media/libstagefright/AudioSource.cpp @@ -308,7 +308,7 @@ status_t AudioSource::dataCallback(const AudioRecord::Buffer& audioBuffer) { if (numLostBytes > 0) { // Loss of audio frames should happen rarely; thus the LOGW should // not cause a logging spam - ALOGW("Lost audio record data: %d bytes", numLostBytes); + ALOGW("Lost audio record data: %zu bytes", numLostBytes); } while (numLostBytes > 0) { diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp index aae6800..29c007a 100644 --- a/media/libstagefright/AwesomePlayer.cpp +++ b/media/libstagefright/AwesomePlayer.cpp @@ -19,6 +19,7 @@ //#define LOG_NDEBUG 0 #define LOG_TAG "AwesomePlayer" #define ATRACE_TAG ATRACE_TAG_VIDEO +#include <inttypes.h> #include <utils/Log.h> #include <utils/Trace.h> @@ -725,7 +726,7 @@ void AwesomePlayer::onBufferingUpdate() { if ((mFlags & PLAYING) && !eos && (cachedDataRemaining < kLowWaterMarkBytes)) { - ALOGI("cache is running low (< %d) , pausing.", + ALOGI("cache is running low (< %zu) , pausing.", kLowWaterMarkBytes); modifyFlags(CACHE_UNDERRUN, SET); pause_l(); @@ -734,12 +735,12 @@ void AwesomePlayer::onBufferingUpdate() { notifyListener_l(MEDIA_INFO, MEDIA_INFO_BUFFERING_START); } else if (eos || cachedDataRemaining > kHighWaterMarkBytes) { if (mFlags & CACHE_UNDERRUN) { - ALOGI("cache has filled up (> %d), resuming.", + ALOGI("cache has filled up (> %zu), resuming.", kHighWaterMarkBytes); modifyFlags(CACHE_UNDERRUN, CLEAR); play_l(); } else if (mFlags & PREPARING) { - ALOGV("cache has filled up (> %d), prepare is done", + ALOGV("cache has filled up (> %zu), prepare is done", kHighWaterMarkBytes); finishAsyncPrepare_l(); } @@ -2295,8 +2296,8 @@ status_t AwesomePlayer::finishSetDataSource_l() { sniffedMIME = tmp.string(); if (meta == NULL - || !meta->findInt64( - "meta-data-size", &metaDataSize)) { + || !meta->findInt64("meta-data-size", + reinterpret_cast<int64_t*>(&metaDataSize))) { metaDataSize = kHighWaterMarkBytes; } @@ -2583,12 +2584,12 @@ status_t AwesomePlayer::getTrackInfo(Parcel *reply) const { status_t AwesomePlayer::selectAudioTrack_l( const sp<MediaSource>& source, size_t trackIndex) { - ALOGI("selectAudioTrack_l: trackIndex=%d, mFlags=0x%x", trackIndex, mFlags); + ALOGI("selectAudioTrack_l: trackIndex=%zu, mFlags=0x%x", trackIndex, mFlags); { Mutex::Autolock autoLock(mStatsLock); if ((ssize_t)trackIndex == mActiveAudioTrackIndex) { - ALOGI("Track %d is active. Does nothing.", trackIndex); + ALOGI("Track %zu is active. Does nothing.", trackIndex); return OK; } //mStats.mFlags = mFlags; @@ -2661,7 +2662,7 @@ status_t AwesomePlayer::selectTrack(size_t trackIndex, bool select) { trackCount += mTextDriver->countExternalTracks(); } if (trackIndex >= trackCount) { - ALOGE("Track index (%d) is out of range [0, %d)", trackIndex, trackCount); + ALOGE("Track index (%zu) is out of range [0, %zu)", trackIndex, trackCount); return ERROR_OUT_OF_RANGE; } @@ -2673,14 +2674,14 @@ status_t AwesomePlayer::selectTrack(size_t trackIndex, bool select) { isAudioTrack = !strncasecmp(mime, "audio/", 6); if (!isAudioTrack && strcasecmp(mime, MEDIA_MIMETYPE_TEXT_3GPP) != 0) { - ALOGE("Track %d is not either audio or timed text", trackIndex); + ALOGE("Track %zu is not either audio or timed text", trackIndex); return ERROR_UNSUPPORTED; } } if (isAudioTrack) { if (!select) { - ALOGE("Deselect an audio track (%d) is not supported", trackIndex); + ALOGE("Deselect an audio track (%zu) is not supported", trackIndex); return ERROR_UNSUPPORTED; } return selectAudioTrack_l(mExtractor->getTrack(trackIndex), trackIndex); @@ -2818,7 +2819,7 @@ status_t AwesomePlayer::dump(int fd, const Vector<String16> &args) const { fprintf(out, ", flags(0x%08x)", mStats.mFlags); if (mStats.mBitrate >= 0) { - fprintf(out, ", bitrate(%lld bps)", mStats.mBitrate); + fprintf(out, ", bitrate(%" PRId64 " bps)", mStats.mBitrate); } fprintf(out, "\n"); @@ -2826,7 +2827,7 @@ status_t AwesomePlayer::dump(int fd, const Vector<String16> &args) const { for (size_t i = 0; i < mStats.mTracks.size(); ++i) { const TrackStat &stat = mStats.mTracks.itemAt(i); - fprintf(out, " Track %d\n", i + 1); + fprintf(out, " Track %zu\n", i + 1); fprintf(out, " MIME(%s)", stat.mMIME.string()); if (!stat.mDecoderName.isEmpty()) { @@ -2838,8 +2839,8 @@ status_t AwesomePlayer::dump(int fd, const Vector<String16> &args) const { if ((ssize_t)i == mStats.mVideoTrackIndex) { fprintf(out, " videoDimensions(%d x %d), " - "numVideoFramesDecoded(%lld), " - "numVideoFramesDropped(%lld)\n", + "numVideoFramesDecoded(%" PRId64 "), " + "numVideoFramesDropped(%" PRId64 ")\n", mStats.mVideoWidth, mStats.mVideoHeight, mStats.mNumVideoFramesDecoded, diff --git a/media/libstagefright/MPEG4Extractor.cpp b/media/libstagefright/MPEG4Extractor.cpp index 4f1c5b3..6a33ce6 100644 --- a/media/libstagefright/MPEG4Extractor.cpp +++ b/media/libstagefright/MPEG4Extractor.cpp @@ -260,7 +260,7 @@ static void hexdump(const void *_data, size_t size) { const uint8_t *data = (const uint8_t *)_data; size_t offset = 0; while (offset < size) { - printf("0x%04x ", offset); + printf("0x%04zx ", offset); size_t n = size - offset; if (n > 16) { diff --git a/media/libstagefright/MPEG4Writer.cpp b/media/libstagefright/MPEG4Writer.cpp index 42885dd..2f1f449 100644 --- a/media/libstagefright/MPEG4Writer.cpp +++ b/media/libstagefright/MPEG4Writer.cpp @@ -16,6 +16,7 @@ //#define LOG_NDEBUG 0 #define LOG_TAG "MPEG4Writer" +#include <inttypes.h> #include <utils/Log.h> #include <arpa/inet.h> @@ -419,7 +420,7 @@ status_t MPEG4Writer::Track::dump( result.append(buffer); snprintf(buffer, SIZE, " frames encoded : %d\n", mStszTableEntries->count()); result.append(buffer); - snprintf(buffer, SIZE, " duration encoded : %lld us\n", mTrackDurationUs); + snprintf(buffer, SIZE, " duration encoded : %" PRId64 " us\n", mTrackDurationUs); result.append(buffer); ::write(fd, result.string(), result.size()); return OK; @@ -1406,7 +1407,7 @@ void MPEG4Writer::Track::addOneSttsTableEntry( size_t sampleCount, int32_t duration) { if (duration == 0) { - ALOGW("0-duration samples found: %d", sampleCount); + ALOGW("0-duration samples found: %zu", sampleCount); } mSttsTableEntries->add(htonl(sampleCount)); mSttsTableEntries->add(htonl(duration)); @@ -1586,7 +1587,7 @@ void MPEG4Writer::writeAllChunks() { sendSessionSummary(); mChunkInfos.clear(); - ALOGD("%d chunks are written in the last batch", outstandingChunks); + ALOGD("%zu chunks are written in the last batch", outstandingChunks); } bool MPEG4Writer::findChunkToWrite(Chunk *chunk) { @@ -1776,7 +1777,7 @@ status_t MPEG4Writer::Track::stop() { void *dummy; pthread_join(mThread, &dummy); - status_t err = (status_t) dummy; + status_t err = static_cast<status_t>(reinterpret_cast<uintptr_t>(dummy)); ALOGD("Stopping %s track source", mIsAudio? "Audio": "Video"); { @@ -1799,7 +1800,7 @@ void *MPEG4Writer::Track::ThreadWrapper(void *me) { Track *track = static_cast<Track *>(me); status_t err = track->threadEntry(); - return (void *) err; + return (void *)(uintptr_t)err; } static void getNalUnitType(uint8_t byte, uint8_t* type) { @@ -1871,7 +1872,7 @@ status_t MPEG4Writer::Track::copyAVCCodecSpecificData( // 2 bytes for each of the parameter set length field // plus the 7 bytes for the header if (size < 4 + 7) { - ALOGE("Codec specific data length too short: %d", size); + ALOGE("Codec specific data length too short: %zu", size); return ERROR_MALFORMED; } @@ -1940,7 +1941,7 @@ status_t MPEG4Writer::Track::parseAVCCodecSpecificData( } if (nSeqParamSets > 0x1F) { - ALOGE("Too many seq parameter sets (%d) found", nSeqParamSets); + ALOGE("Too many seq parameter sets (%zu) found", nSeqParamSets); return ERROR_MALFORMED; } } @@ -1953,7 +1954,7 @@ status_t MPEG4Writer::Track::parseAVCCodecSpecificData( return ERROR_MALFORMED; } if (nPicParamSets > 0xFF) { - ALOGE("Too many pic parameter sets (%d) found", nPicParamSets); + ALOGE("Too many pic parameter sets (%zd) found", nPicParamSets); return ERROR_MALFORMED; } } @@ -1983,7 +1984,7 @@ status_t MPEG4Writer::Track::makeAVCCodecSpecificData( } if (size < 4) { - ALOGE("Codec specific data length too short: %d", size); + ALOGE("Codec specific data length too short: %zu", size); return ERROR_MALFORMED; } diff --git a/media/libstagefright/MediaCodec.cpp b/media/libstagefright/MediaCodec.cpp index 8af1aaf..c4c47b3 100644 --- a/media/libstagefright/MediaCodec.cpp +++ b/media/libstagefright/MediaCodec.cpp @@ -1680,7 +1680,7 @@ status_t MediaCodec::onReleaseOutputBuffer(const sp<AMessage> &msg) { return -EACCES; } - if (render && (info->mData == NULL || info->mData->size() != 0)) { + if (render && info->mData != NULL && info->mData->size() != 0) { info->mNotify->setInt32("render", true); if (mSoftRenderer != NULL) { diff --git a/media/libstagefright/MetaData.cpp b/media/libstagefright/MetaData.cpp index 1daead7..74234a6 100644 --- a/media/libstagefright/MetaData.cpp +++ b/media/libstagefright/MetaData.cpp @@ -16,6 +16,7 @@ //#define LOG_NDEBUG 0 #define LOG_TAG "MetaData" +#include <inttypes.h> #include <utils/Log.h> #include <stdlib.h> @@ -307,7 +308,7 @@ String8 MetaData::typed_data::asString() const { const void *data = storage(); switch(mType) { case TYPE_NONE: - out = String8::format("no type, size %d)", mSize); + out = String8::format("no type, size %zu)", mSize); break; case TYPE_C_STRING: out = String8::format("(char*) %s", (const char *)data); @@ -316,7 +317,7 @@ String8 MetaData::typed_data::asString() const { out = String8::format("(int32_t) %d", *(int32_t *)data); break; case TYPE_INT64: - out = String8::format("(int64_t) %lld", *(int64_t *)data); + out = String8::format("(int64_t) %" PRId64, *(int64_t *)data); break; case TYPE_FLOAT: out = String8::format("(float) %f", *(float *)data); @@ -333,7 +334,7 @@ String8 MetaData::typed_data::asString() const { } default: - out = String8::format("(unknown type %d, size %d)", mType, mSize); + out = String8::format("(unknown type %d, size %zu)", mType, mSize); if (mSize <= 48) { // if it's less than three lines of hex data, dump it AString foo; hexdump(data, mSize, 0, &foo); diff --git a/media/libstagefright/StagefrightMetadataRetriever.cpp b/media/libstagefright/StagefrightMetadataRetriever.cpp index 19af4fb..fcd9a85 100644 --- a/media/libstagefright/StagefrightMetadataRetriever.cpp +++ b/media/libstagefright/StagefrightMetadataRetriever.cpp @@ -16,6 +16,7 @@ //#define LOG_NDEBUG 0 #define LOG_TAG "StagefrightMetadataRetriever" +#include <inttypes.h> #include <utils/Log.h> #include "include/StagefrightMetadataRetriever.h" @@ -488,7 +489,7 @@ void StagefrightMetadataRetriever::parseMetaData() { size_t numTracks = mExtractor->countTracks(); char tmp[32]; - sprintf(tmp, "%d", numTracks); + sprintf(tmp, "%zu", numTracks); mMetaData.add(METADATA_KEY_NUM_TRACKS, String8(tmp)); @@ -545,7 +546,7 @@ void StagefrightMetadataRetriever::parseMetaData() { } // The duration value is a string representing the duration in ms. - sprintf(tmp, "%lld", (maxDurationUs + 500) / 1000); + sprintf(tmp, "%" PRId64, (maxDurationUs + 500) / 1000); mMetaData.add(METADATA_KEY_DURATION, String8(tmp)); if (hasAudio) { @@ -573,7 +574,7 @@ void StagefrightMetadataRetriever::parseMetaData() { if (mSource->getSize(&sourceSize) == OK) { int64_t avgBitRate = (int64_t)(sourceSize * 8E6 / maxDurationUs); - sprintf(tmp, "%lld", avgBitRate); + sprintf(tmp, "%" PRId64, avgBitRate); mMetaData.add(METADATA_KEY_BITRATE, String8(tmp)); } } diff --git a/media/libstagefright/codecs/avc/enc/SoftAVCEncoder.cpp b/media/libstagefright/codecs/avc/enc/SoftAVCEncoder.cpp index 4a21a3e..1d398fb 100644 --- a/media/libstagefright/codecs/avc/enc/SoftAVCEncoder.cpp +++ b/media/libstagefright/codecs/avc/enc/SoftAVCEncoder.cpp @@ -593,6 +593,17 @@ OMX_ERRORTYPE SoftAVCEncoder::internalSetParameter( mVideoHeight = def->format.video.nFrameHeight; mVideoFrameRate = def->format.video.xFramerate >> 16; mVideoColorFormat = def->format.video.eColorFormat; + + OMX_PARAM_PORTDEFINITIONTYPE *portDef = + &editPortInfo(0)->mDef; + portDef->format.video.nFrameWidth = mVideoWidth; + portDef->format.video.nFrameHeight = mVideoHeight; + portDef->format.video.xFramerate = def->format.video.xFramerate; + portDef->format.video.eColorFormat = + (OMX_COLOR_FORMATTYPE) mVideoColorFormat; + portDef = &editPortInfo(1)->mDef; + portDef->format.video.nFrameWidth = mVideoWidth; + portDef->format.video.nFrameHeight = mVideoHeight; } else { mVideoBitRate = def->format.video.nBitrate; } diff --git a/media/libstagefright/codecs/avc/enc/src/bitstream_io.cpp b/media/libstagefright/codecs/avc/enc/src/bitstream_io.cpp index 0e3037f..d71c327 100644 --- a/media/libstagefright/codecs/avc/enc/src/bitstream_io.cpp +++ b/media/libstagefright/codecs/avc/enc/src/bitstream_io.cpp @@ -103,6 +103,15 @@ AVCEnc_Status AVCBitstreamSaveWord(AVCEncBitstream *stream) { num_bits -= 8; byte = (current_word >> num_bits) & 0xFF; + if (stream->count_zeros == 2) + { /* for num_bits = 32, this can add 2 more bytes extra for EPBS */ + if (byte <= 3) + { + *write_pnt++ = 0x3; + stream->write_pos++; + stream->count_zeros = 0; + } + } if (byte != 0) { *write_pnt++ = byte; @@ -114,12 +123,6 @@ AVCEnc_Status AVCBitstreamSaveWord(AVCEncBitstream *stream) stream->count_zeros++; *write_pnt++ = byte; stream->write_pos++; - if (stream->count_zeros == 2) - { /* for num_bits = 32, this can add 2 more bytes extra for EPBS */ - *write_pnt++ = 0x3; - stream->write_pos++; - stream->count_zeros = 0; - } } } diff --git a/media/libstagefright/codecs/common/Config.mk b/media/libstagefright/codecs/common/Config.mk index a6d4286..a843cef 100644 --- a/media/libstagefright/codecs/common/Config.mk +++ b/media/libstagefright/codecs/common/Config.mk @@ -14,8 +14,10 @@ VOTT := pc endif # Do we also need to check on ARCH_ARM_HAVE_ARMV7A? - probably not -ifeq ($(ARCH_ARM_HAVE_NEON),true) -VOTT := v7 +ifeq ($(TARGET_ARCH),arm) + ifeq ($(ARCH_ARM_HAVE_NEON),true) + VOTT := v7 + endif endif VOTEST := 0 diff --git a/media/libstagefright/codecs/m4v_h263/dec/src/get_pred_adv_b_add.cpp b/media/libstagefright/codecs/m4v_h263/dec/src/get_pred_adv_b_add.cpp index e23f23d..fe9e7dc 100644 --- a/media/libstagefright/codecs/m4v_h263/dec/src/get_pred_adv_b_add.cpp +++ b/media/libstagefright/codecs/m4v_h263/dec/src/get_pred_adv_b_add.cpp @@ -96,7 +96,7 @@ int GetPredAdvancedBy0x0( offset = width - B_SIZE; /* offset for prev */ offset2 = (pred_width_rnd >> 1) - 4; /* offset for pred_block */ - tmp = (uint32)prev & 0x3; + tmp = (uintptr_t)prev & 0x3; pred_block -= offset2; /* preset */ if (tmp == 0) /* word-aligned */ @@ -203,7 +203,7 @@ int GetPredAdvancedBy0x1( /* Branch based on pixel location (half-pel or full-pel) for x and y */ pred_block -= offset2; /* preset */ - tmp = (uint32)prev & 3; + tmp = (uintptr_t)prev & 3; mask = 254; mask |= (mask << 8); mask |= (mask << 16); /* 0xFEFEFEFE */ @@ -532,7 +532,7 @@ int GetPredAdvancedBy1x0( /* Branch based on pixel location (half-pel or full-pel) for x and y */ pred_block -= offset2; /* preset */ - tmp = (uint32)prev & 3; + tmp = (uintptr_t)prev & 3; mask = 254; mask |= (mask << 8); mask |= (mask << 16); /* 0xFEFEFEFE */ @@ -884,7 +884,7 @@ int GetPredAdvancedBy1x1( mask |= (mask << 8); mask |= (mask << 16); /* 0x3f3f3f3f */ - tmp = (uint32)prev & 3; + tmp = (uintptr_t)prev & 3; pred_block -= 4; /* preset */ diff --git a/media/libstagefright/codecs/m4v_h263/enc/src/dct.cpp b/media/libstagefright/codecs/m4v_h263/enc/src/dct.cpp index fa50eeb..fa4ae23 100644 --- a/media/libstagefright/codecs/m4v_h263/enc/src/dct.cpp +++ b/media/libstagefright/codecs/m4v_h263/enc/src/dct.cpp @@ -250,7 +250,7 @@ extern "C" out[40] = k4 ; /* row 5 */ out++; } - while ((UInt)out < (UInt)dst) ; + while ((uintptr_t)out < (uintptr_t)dst) ; return ; } @@ -455,7 +455,7 @@ extern "C" out[8] = k5 ; /* row 1 */ out++; } - while ((UInt)out < (UInt)dst) ; + while ((uintptr_t)out < (uintptr_t)dst) ; return ; } @@ -635,7 +635,7 @@ extern "C" out[8] = k5 ; /* row 1 */ out++; } - while ((UInt)out < (UInt)dst) ; + while ((uintptr_t)out < (uintptr_t)dst) ; return ; } @@ -846,7 +846,7 @@ extern "C" out[40] = k4 ; /* row 5 */ out++; } - while ((UInt)out < (UInt)dst) ; + while ((uintptr_t)out < (uintptr_t)dst) ; return ; } @@ -1033,7 +1033,7 @@ extern "C" out[8] = k5 ; /* row 1 */ out++; } - while ((UInt)out < (UInt)dst) ; + while ((uintptr_t)out < (uintptr_t)dst) ; return ; } @@ -1195,7 +1195,7 @@ extern "C" out[8] = k5 ; /* row 1 */ out++; } - while ((UInt)out < (UInt)dst) ; + while ((uintptr_t)out < (uintptr_t)dst) ; return ; } diff --git a/media/libstagefright/codecs/m4v_h263/enc/src/fastcodemb.cpp b/media/libstagefright/codecs/m4v_h263/enc/src/fastcodemb.cpp index 6fd41c3..0ad39a6 100644 --- a/media/libstagefright/codecs/m4v_h263/enc/src/fastcodemb.cpp +++ b/media/libstagefright/codecs/m4v_h263/enc/src/fastcodemb.cpp @@ -572,7 +572,7 @@ Int Sad8x8(UChar *cur, UChar *prev, Int width) cur2 = cur2 & (mask << 8); /* mask first and third bytes */ sum2 = sum2 + ((UInt)cur2 >> 8); } - while ((UInt)curInt < (UInt)end); + while ((uintptr_t)curInt < (uintptr_t)end); cur1 = sum4 - (sum2 << 8); /* get even-sum */ cur1 = cur1 + sum2; /* add 16 bit even-sum and odd-sum*/ @@ -611,7 +611,7 @@ Int getBlockSum(UChar *cur, Int width) load2 = load2 & (mask << 8); /* even bytes */ sum2 += ((UInt)load2 >> 8); /* sum even bytes, 16 bit */ } - while ((UInt)curInt < (UInt)end); + while ((uintptr_t)curInt < (uintptr_t)end); load1 = sum4 - (sum2 << 8); /* get even-sum */ load1 = load1 + sum2; /* add 16 bit even-sum and odd-sum*/ load1 = load1 + (load1 << 16); /* add upper and lower 16 bit sum */ diff --git a/media/libstagefright/codecs/m4v_h263/enc/src/motion_comp.cpp b/media/libstagefright/codecs/m4v_h263/enc/src/motion_comp.cpp index b81d278..06e8926 100644 --- a/media/libstagefright/codecs/m4v_h263/enc/src/motion_comp.cpp +++ b/media/libstagefright/codecs/m4v_h263/enc/src/motion_comp.cpp @@ -1959,7 +1959,7 @@ void PutSkippedBlock(UChar *rec, UChar *prev, Int lx) dst += offset; src += offset; } - while ((UInt)src < (UInt)end); + while ((uintptr_t)src < (uintptr_t)end); return ; } diff --git a/media/libstagefright/codecs/m4v_h263/enc/src/sad_inline.h b/media/libstagefright/codecs/m4v_h263/enc/src/sad_inline.h index ba77dfd..b865f23 100644 --- a/media/libstagefright/codecs/m4v_h263/enc/src/sad_inline.h +++ b/media/libstagefright/codecs/m4v_h263/enc/src/sad_inline.h @@ -85,7 +85,7 @@ extern "C" x9 = 0x80808080; /* const. */ - x8 = (uint32)ref & 0x3; + x8 = (uintptr_t)ref & 0x3; if (x8 == 3) goto SadMBOffset3; if (x8 == 2) diff --git a/media/libstagefright/codecs/on2/enc/SoftVPXEncoder.cpp b/media/libstagefright/codecs/on2/enc/SoftVPXEncoder.cpp index 8375cac..5efe022 100644 --- a/media/libstagefright/codecs/on2/enc/SoftVPXEncoder.cpp +++ b/media/libstagefright/codecs/on2/enc/SoftVPXEncoder.cpp @@ -677,6 +677,9 @@ OMX_ERRORTYPE SoftVPXEncoder::internalSetPortParams( def->format.video.nFrameHeight = mHeight; def->format.video.xFramerate = port->format.video.xFramerate; def->format.video.eColorFormat = mColorFormat; + def = &editPortInfo(kOutputPortIndex)->mDef; + def->format.video.nFrameWidth = mWidth; + def->format.video.nFrameHeight = mHeight; return OMX_ErrorNone; } else if (port->nPortIndex == kOutputPortIndex) { diff --git a/media/libstagefright/codecs/on2/h264dec/Android.mk b/media/libstagefright/codecs/on2/h264dec/Android.mk index 655b2ab..bf03ad9 100644 --- a/media/libstagefright/codecs/on2/h264dec/Android.mk +++ b/media/libstagefright/codecs/on2/h264dec/Android.mk @@ -84,8 +84,8 @@ MY_OMXDL_ASM_SRC := \ ./omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_DequantTransformResidualFromPairAndAdd_s.S \ ./omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_TransformDequantChromaDCFromPair_s.S \ - -ifeq ($(ARCH_ARM_HAVE_NEON),true) +ifeq ($(TARGET_ARCH),arm) + ifeq ($(ARCH_ARM_HAVE_NEON),true) LOCAL_ARM_NEON := true # LOCAL_CFLAGS := -std=c99 -D._NEON -D._OMXDL LOCAL_CFLAGS := -DH264DEC_NEON -DH264DEC_OMXDL @@ -94,6 +94,7 @@ ifeq ($(ARCH_ARM_HAVE_NEON),true) LOCAL_C_INCLUDES += $(LOCAL_PATH)/./omxdl/arm_neon/api \ $(LOCAL_PATH)/./omxdl/arm_neon/vc/api \ $(LOCAL_PATH)/./omxdl/arm_neon/vc/m4p10/api + endif endif LOCAL_SHARED_LIBRARIES := \ diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_intra_prediction.c b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_intra_prediction.c index 15eabfb..52c85e5 100755 --- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_intra_prediction.c +++ b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_intra_prediction.c @@ -1110,7 +1110,7 @@ void Intra16x16PlanePrediction(u8 *data, u8 *above, u8 *left) /* Variables */ - u32 i, j; + i32 i, j; i32 a, b, c; i32 tmp; @@ -1123,20 +1123,20 @@ void Intra16x16PlanePrediction(u8 *data, u8 *above, u8 *left) a = 16 * (above[15] + left[15]); for (i = 0, b = 0; i < 8; i++) - b += ((i32)i + 1) * (above[8+i] - above[6-i]); + b += (i + 1) * (above[8+i] - above[6-i]); b = (5 * b + 32) >> 6; for (i = 0, c = 0; i < 7; i++) - c += ((i32)i + 1) * (left[8+i] - left[6-i]); + c += (i + 1) * (left[8+i] - left[6-i]); /* p[-1,-1] has to be accessed through above pointer */ - c += ((i32)i + 1) * (left[8+i] - above[-1]); + c += (i + 1) * (left[8+i] - above[-1]); c = (5 * c + 32) >> 6; for (i = 0; i < 16; i++) { for (j = 0; j < 16; j++) { - tmp = (a + b * ((i32)j - 7) + c * ((i32)i - 7) + 16) >> 5; + tmp = (a + b * (j - 7) + c * (i - 7) + 16) >> 5; data[i*16+j] = (u8)CLIP1(tmp); } } diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_util.h b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_util.h index cb3adda..216ad04 100755 --- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_util.h +++ b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_util.h @@ -42,6 +42,7 @@ #include <stdio.h> #endif +#include <stdint.h> #include "basetype.h" #include "h264bsd_stream.h" #include "h264bsd_image.h" @@ -150,7 +151,7 @@ } #define ALIGN(ptr, bytePos) \ - (ptr + ( ((bytePos - (int)ptr) & (bytePos - 1)) / sizeof(*ptr) )) + (ptr + ( ((bytePos - (uintptr_t)ptr) & (bytePos - 1)) / sizeof(*ptr) )) extern const u32 h264bsdQpC[52]; diff --git a/media/libstagefright/foundation/ANetworkSession.cpp b/media/libstagefright/foundation/ANetworkSession.cpp index e629588..4cd51d0 100644 --- a/media/libstagefright/foundation/ANetworkSession.cpp +++ b/media/libstagefright/foundation/ANetworkSession.cpp @@ -579,7 +579,7 @@ status_t ANetworkSession::Session::writeMore() { if (err == -EAGAIN) { if (!mOutFragments.empty()) { - ALOGI("%d datagrams remain queued.", mOutFragments.size()); + ALOGI("%zu datagrams remain queued.", mOutFragments.size()); } err = OK; } diff --git a/media/libstagefright/httplive/LiveSession.cpp b/media/libstagefright/httplive/LiveSession.cpp index e53e35a..61c54c1 100644 --- a/media/libstagefright/httplive/LiveSession.cpp +++ b/media/libstagefright/httplive/LiveSession.cpp @@ -492,7 +492,7 @@ void LiveSession::onConnect(const sp<AMessage> &msg) { mPlaylist = fetchPlaylist(url.c_str(), NULL /* curPlaylistHash */, &dummy); if (mPlaylist == NULL) { - ALOGE("unable to fetch master playlist '%s'.", url.c_str()); + ALOGE("unable to fetch master playlist <URL suppressed>."); postPrepared(ERROR_IO); return; @@ -769,9 +769,6 @@ sp<M3UParser> LiveSession::fetchPlaylist( // playlist unchanged *unchanged = true; - ALOGV("Playlist unchanged, refresh state is now %d", - (int)mRefreshState); - return NULL; } diff --git a/media/libstagefright/httplive/M3UParser.cpp b/media/libstagefright/httplive/M3UParser.cpp index e31ad40..7b06a2f 100644 --- a/media/libstagefright/httplive/M3UParser.cpp +++ b/media/libstagefright/httplive/M3UParser.cpp @@ -798,8 +798,7 @@ status_t M3UParser::parseCipherInfo( if (MakeURL(baseURI.c_str(), val.c_str(), &absURI)) { val = absURI; } else { - ALOGE("failed to make absolute url for '%s'.", - val.c_str()); + ALOGE("failed to make absolute url for <URL suppressed>."); } } diff --git a/media/libstagefright/id3/testid3.cpp b/media/libstagefright/id3/testid3.cpp index bc4572c..b2f4188 100644 --- a/media/libstagefright/id3/testid3.cpp +++ b/media/libstagefright/id3/testid3.cpp @@ -33,7 +33,7 @@ static void hexdump(const void *_data, size_t size) { const uint8_t *data = (const uint8_t *)_data; size_t offset = 0; while (offset < size) { - printf("0x%04x ", offset); + printf("0x%04zx ", offset); size_t n = size - offset; if (n > 16) { @@ -101,7 +101,7 @@ void scanFile(const char *path) { const void *data = tag.getAlbumArt(&dataSize, &mime); if (data) { - printf("found album art: size=%d mime='%s'\n", dataSize, + printf("found album art: size=%zu mime='%s'\n", dataSize, mime.string()); hexdump(data, dataSize > 128 ? 128 : dataSize); diff --git a/media/libstagefright/mpeg2ts/ESQueue.cpp b/media/libstagefright/mpeg2ts/ESQueue.cpp index 2b0711b..c0c9717 100644 --- a/media/libstagefright/mpeg2ts/ESQueue.cpp +++ b/media/libstagefright/mpeg2ts/ESQueue.cpp @@ -794,7 +794,9 @@ sp<ABuffer> ElementaryStreamQueue::dequeueAccessUnitH264() { dstOffset += pos.nalSize + 4; } +#if !LOG_NDEBUG ALOGV("accessUnit contains nal types %s", out.c_str()); +#endif const NALPosition &pos = nals.itemAt(nals.size() - 1); size_t nextScan = pos.nalOffset + pos.nalSize; diff --git a/media/libstagefright/omx/OMX.cpp b/media/libstagefright/omx/OMX.cpp index 84a0e10..274f2eb 100644 --- a/media/libstagefright/omx/OMX.cpp +++ b/media/libstagefright/omx/OMX.cpp @@ -479,7 +479,7 @@ OMX_ERRORTYPE OMX::OnFillBufferDone( OMX::node_id OMX::makeNodeID(OMXNodeInstance *instance) { // mLock is already held. - node_id node = (node_id)++mNodeCounter; + node_id node = (node_id)(uintptr_t)++mNodeCounter; mNodeIDToInstance.add(node, instance); return node; diff --git a/media/libstagefright/omx/tests/Android.mk b/media/libstagefright/omx/tests/Android.mk index 1061c39..e368134 100644 --- a/media/libstagefright/omx/tests/Android.mk +++ b/media/libstagefright/omx/tests/Android.mk @@ -15,4 +15,6 @@ LOCAL_MODULE := omx_tests LOCAL_MODULE_TAGS := tests +LOCAL_32_BIT_ONLY := true + include $(BUILD_EXECUTABLE) diff --git a/media/libstagefright/omx/tests/OMXHarness.cpp b/media/libstagefright/omx/tests/OMXHarness.cpp index 4bee808..44e4f9d 100644 --- a/media/libstagefright/omx/tests/OMXHarness.cpp +++ b/media/libstagefright/omx/tests/OMXHarness.cpp @@ -16,6 +16,7 @@ //#define LOG_NDEBUG 0 #define LOG_TAG "OMXHarness" +#include <inttypes.h> #include <utils/Log.h> #include "OMXHarness.h" @@ -711,11 +712,11 @@ status_t Harness::testSeek( int64_t bufferTimeUs; CHECK(buffer->meta_data()->findInt64(kKeyTime, &bufferTimeUs)); if (!CloseEnough(bufferTimeUs, actualSeekTimeUs)) { - printf("\n * Attempted seeking to %lld us (%.2f secs)", + printf("\n * Attempted seeking to %" PRId64 " us (%.2f secs)", requestedSeekTimeUs, requestedSeekTimeUs / 1E6); - printf("\n * Nearest keyframe is at %lld us (%.2f secs)", + printf("\n * Nearest keyframe is at %" PRId64 " us (%.2f secs)", actualSeekTimeUs, actualSeekTimeUs / 1E6); - printf("\n * Returned buffer was at %lld us (%.2f secs)\n\n", + printf("\n * Returned buffer was at %" PRId64 " us (%.2f secs)\n\n", bufferTimeUs, bufferTimeUs / 1E6); buffer->release(); diff --git a/media/libstagefright/rtsp/ARTSPConnection.cpp b/media/libstagefright/rtsp/ARTSPConnection.cpp index efde7a9..492bd4a 100644 --- a/media/libstagefright/rtsp/ARTSPConnection.cpp +++ b/media/libstagefright/rtsp/ARTSPConnection.cpp @@ -239,7 +239,7 @@ void ARTSPConnection::onConnect(const sp<AMessage> &msg) { // right here, since we currently have no way of asking the user // for this information. - ALOGE("Malformed rtsp url %s", url.c_str()); + ALOGE("Malformed rtsp url <URL suppressed>"); reply->setInt32("result", ERROR_MALFORMED); reply->post(); diff --git a/media/libstagefright/rtsp/MyHandler.h b/media/libstagefright/rtsp/MyHandler.h index cd77aa0..e7580c2 100644 --- a/media/libstagefright/rtsp/MyHandler.h +++ b/media/libstagefright/rtsp/MyHandler.h @@ -149,7 +149,7 @@ struct MyHandler : public AHandler { mSessionURL.append(StringPrintf("%u", port)); mSessionURL.append(path); - ALOGI("rewritten session url: '%s'", mSessionURL.c_str()); + ALOGV("rewritten session url: '%s'", mSessionURL.c_str()); } mSessionHost = host; @@ -478,21 +478,32 @@ struct MyHandler : public AHandler { sp<ARTSPResponse> response = static_cast<ARTSPResponse *>(obj.get()); - if (response->mStatusCode == 302) { + if (response->mStatusCode == 301 || response->mStatusCode == 302) { ssize_t i = response->mHeaders.indexOfKey("location"); CHECK_GE(i, 0); - mSessionURL = response->mHeaders.valueAt(i); - - AString request; - request = "DESCRIBE "; - request.append(mSessionURL); - request.append(" RTSP/1.0\r\n"); - request.append("Accept: application/sdp\r\n"); - request.append("\r\n"); + mOriginalSessionURL = response->mHeaders.valueAt(i); + mSessionURL = mOriginalSessionURL; + + // Strip any authentication info from the session url, we don't + // want to transmit user/pass in cleartext. + AString host, path, user, pass; + unsigned port; + if (ARTSPConnection::ParseURL( + mSessionURL.c_str(), &host, &port, &path, &user, &pass) + && user.size() > 0) { + mSessionURL.clear(); + mSessionURL.append("rtsp://"); + mSessionURL.append(host); + mSessionURL.append(":"); + mSessionURL.append(StringPrintf("%u", port)); + mSessionURL.append(path); + + ALOGI("rewritten session url: '%s'", mSessionURL.c_str()); + } - sp<AMessage> reply = new AMessage('desc', id()); - mConn->sendRequest(request.c_str(), reply); + sp<AMessage> reply = new AMessage('conn', id()); + mConn->connect(mOriginalSessionURL.c_str(), reply); break; } diff --git a/media/libstagefright/rtsp/SDPLoader.cpp b/media/libstagefright/rtsp/SDPLoader.cpp index ed3fa7e..3c7d82a 100644 --- a/media/libstagefright/rtsp/SDPLoader.cpp +++ b/media/libstagefright/rtsp/SDPLoader.cpp @@ -95,7 +95,7 @@ void SDPLoader::onLoad(const sp<AMessage> &msg) { msg->findPointer("headers", (void **)&headers); if (!(mFlags & kFlagIncognito)) { - ALOGI("onLoad '%s'", url.c_str()); + ALOGV("onLoad '%s'", url.c_str()); } else { ALOGI("onLoad <URL suppressed>"); } diff --git a/media/libstagefright/tests/Android.mk b/media/libstagefright/tests/Android.mk index 06ce16b..903af49 100644 --- a/media/libstagefright/tests/Android.mk +++ b/media/libstagefright/tests/Android.mk @@ -41,6 +41,8 @@ LOCAL_C_INCLUDES := \ frameworks/av/media/libstagefright/include \ $(TOP)/frameworks/native/include/media/openmax \ +LOCAL_32_BIT_ONLY := true + include $(BUILD_EXECUTABLE) endif diff --git a/media/libstagefright/tests/DummyRecorder.cpp b/media/libstagefright/tests/DummyRecorder.cpp index ac37b28..8f17088 100644 --- a/media/libstagefright/tests/DummyRecorder.cpp +++ b/media/libstagefright/tests/DummyRecorder.cpp @@ -61,7 +61,7 @@ status_t DummyRecorder::stop() { mSource->stop(); void *dummy; pthread_join(mThread, &dummy); - status_t err = (status_t) dummy; + status_t err = static_cast<status_t>(reinterpret_cast<uintptr_t>(dummy)); ALOGV("Ending the reading thread"); return err; diff --git a/media/libstagefright/wifi-display/source/TSPacketizer.cpp b/media/libstagefright/wifi-display/source/TSPacketizer.cpp index eeb3700..50d317a 100644 --- a/media/libstagefright/wifi-display/source/TSPacketizer.cpp +++ b/media/libstagefright/wifi-display/source/TSPacketizer.cpp @@ -565,7 +565,7 @@ status_t TSPacketizer::packetize( } } - // size_t numPaddingBytes = sizeAvailableForPayload - numBytesOfPayload; + size_t numPaddingBytes = sizeAvailableForPayload - numBytesOfPayload; ALOGV("packet 1 contains %zd padding bytes and %zd bytes of payload", numPaddingBytes, numBytesOfPayload); diff --git a/media/mediaserver/Android.mk b/media/mediaserver/Android.mk index 1ac647a..d07bc99 100644 --- a/media/mediaserver/Android.mk +++ b/media/mediaserver/Android.mk @@ -35,5 +35,6 @@ LOCAL_C_INCLUDES := \ frameworks/av/services/camera/libcameraservice LOCAL_MODULE:= mediaserver +LOCAL_32_BIT_ONLY := true include $(BUILD_EXECUTABLE) diff --git a/media/mtp/MtpProperty.cpp b/media/mtp/MtpProperty.cpp index 64dd45b..375ed9a 100644 --- a/media/mtp/MtpProperty.cpp +++ b/media/mtp/MtpProperty.cpp @@ -16,6 +16,7 @@ #define LOG_TAG "MtpProperty" +#include <inttypes.h> #include "MtpDataPacket.h" #include "MtpDebug.h" #include "MtpProperty.h" @@ -385,10 +386,10 @@ void MtpProperty::print(MtpPropertyValue& value, MtpString& buffer) { buffer.appendFormat("%d", value.u.u32); break; case MTP_TYPE_INT64: - buffer.appendFormat("%lld", value.u.i64); + buffer.appendFormat("%" PRId64, value.u.i64); break; case MTP_TYPE_UINT64: - buffer.appendFormat("%lld", value.u.u64); + buffer.appendFormat("%" PRIu64, value.u.u64); break; case MTP_TYPE_INT128: buffer.appendFormat("%08X%08X%08X%08X", value.u.i128[0], value.u.i128[1], 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 646a317..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; } 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 9a6dc28..e4ec5fd 100644 --- a/services/camera/libcameraservice/gui/RingBufferConsumer.cpp +++ b/services/camera/libcameraservice/gui/RingBufferConsumer.cpp @@ -17,6 +17,9 @@ //#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> @@ -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) |