Loading media/codec2/sfplugin/CCodec.cpp +8 −6 Original line number Diff line number Diff line Loading @@ -1826,15 +1826,13 @@ void CCodec::start() { return; } err2 = mChannel->requestInitialInputBuffers(); mCallback->onStartCompleted(); err2 = mChannel->requestInitialInputBuffers(); if (err2 != OK) { ALOGE("Initial request for Input Buffers failed"); mCallback->onError(err2, ACTION_CODE_FATAL); return; } mCallback->onStartCompleted(); } void CCodec::initiateShutdown(bool keepComponentAllocated) { Loading Loading @@ -2128,7 +2126,11 @@ void CCodec::signalResume() { state->set(RUNNING); } (void)mChannel->requestInitialInputBuffers(); status_t err = mChannel->requestInitialInputBuffers(); if (err != OK) { ALOGE("Resume request for Input Buffers failed"); mCallback->onError(err, ACTION_CODE_FATAL); } } void CCodec::signalSetParameters(const sp<AMessage> &msg) { Loading media/libaudioclient/ToneGenerator.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ //#define LOG_NDEBUG 0 #define LOG_TAG "ToneGenerator" #include <inttypes.h> #include <utility> #include <math.h> Loading Loading @@ -1229,7 +1230,8 @@ void ToneGenerator::stopTone() { sec = sec * 1000 + nsec / 1000000; // duration in milliseconds mMaxSmp = (unsigned int)(((int64_t)sec * mSamplingRate) / 1000); } ALOGV("stopTone() forcing mMaxSmp to %d, total for far %d", mMaxSmp, mTotalSmp); ALOGV("stopTone() forcing mMaxSmp to %d, total for far %" PRIu64, mMaxSmp, mTotalSmp); } else { mState = TONE_STOPPING; } Loading Loading @@ -1399,7 +1401,7 @@ size_t ToneGenerator::onMoreData(const AudioTrack::Buffer& buffer) { mNextSegSmp = TONEGEN_INF; // forced to skip state machine management below } if (mTotalSmp > mNextSegSmp) { if (mTotalSmp > mNextSegSmp && mNextSegSmp != TONEGEN_INF) { // Time to go to next sequence segment ALOGV("End Segment, time: %d", (unsigned int)(systemTime()/1000000)); Loading media/libaudioclient/include/media/ToneGenerator.h +3 −4 Original line number Diff line number Diff line Loading @@ -287,11 +287,10 @@ private: static const ToneDescriptor sToneDescriptors[]; bool mThreadCanCallJava; unsigned int mTotalSmp; // Total number of audio samples played (gives current time) uint64_t mTotalSmp; // Total number of audio samples played (gives current time) // Since these types are 32 bit, we may have issues with aborting on // overflow now that we have integer overflow sanitization enabled globally. unsigned int mNextSegSmp; // Position of next segment transition expressed in samples // NOTE: because mTotalSmp, mNextSegSmp are stored on 32 bit, current design will operate properly // only if tone duration is less than about 27 Hours(@44100Hz sampling rate). If this time is exceeded, // no crash will occur but tone sequence will show a glitch. unsigned int mMaxSmp; // Maximum number of audio samples played (maximun tone duration) int mDurationMs; // Maximum tone duration in ms Loading media/libheadtracking/SensorPoseProvider.cpp +0 −20 Original line number Diff line number Diff line Loading @@ -158,7 +158,6 @@ class SensorPoseProviderImpl : public SensorPoseProvider { enum DataFormat { kUnknown, kQuaternion, kRotationVectorsAndFlags, kRotationVectorsAndDiscontinuityCount, }; Loading Loading @@ -283,10 +282,6 @@ class SensorPoseProviderImpl : public SensorPoseProvider { return DataFormat::kRotationVectorsAndDiscontinuityCount; } if (sensor->getStringType() == "com.google.hardware.sensor.hid_dynamic.headtracker") { return DataFormat::kRotationVectorsAndFlags; } return DataFormat::kUnknown; } Loading Loading @@ -332,21 +327,6 @@ class SensorPoseProviderImpl : public SensorPoseProvider { return PoseEvent{Pose3f(quat), std::optional<Twist3f>(), false}; } case DataFormat::kRotationVectorsAndFlags: { // Custom sensor, assumed to contain: // 3 floats representing orientation as a rotation vector (in rad). // 3 floats representing angular velocity as a rotation vector (in rad/s). // 1 uint32_t of flags, where: // - LSb is '1' iff the given sample is the first one in a new frame of reference. // - The rest of the bits are reserved for future use. Eigen::Vector3f rotation = {event.data[0], event.data[1], event.data[2]}; Eigen::Vector3f twist = {event.data[3], event.data[4], event.data[5]}; Eigen::Quaternionf quat = rotationVectorToQuaternion(rotation); uint32_t flags = *reinterpret_cast<const uint32_t*>(&event.data[6]); return PoseEvent{Pose3f(quat), Twist3f(Eigen::Vector3f::Zero(), twist), (flags & (1 << 0)) != 0}; } case DataFormat::kRotationVectorsAndDiscontinuityCount: { Eigen::Vector3f rotation = {event.head_tracker.rx, event.head_tracker.ry, event.head_tracker.rz}; Loading Loading
media/codec2/sfplugin/CCodec.cpp +8 −6 Original line number Diff line number Diff line Loading @@ -1826,15 +1826,13 @@ void CCodec::start() { return; } err2 = mChannel->requestInitialInputBuffers(); mCallback->onStartCompleted(); err2 = mChannel->requestInitialInputBuffers(); if (err2 != OK) { ALOGE("Initial request for Input Buffers failed"); mCallback->onError(err2, ACTION_CODE_FATAL); return; } mCallback->onStartCompleted(); } void CCodec::initiateShutdown(bool keepComponentAllocated) { Loading Loading @@ -2128,7 +2126,11 @@ void CCodec::signalResume() { state->set(RUNNING); } (void)mChannel->requestInitialInputBuffers(); status_t err = mChannel->requestInitialInputBuffers(); if (err != OK) { ALOGE("Resume request for Input Buffers failed"); mCallback->onError(err, ACTION_CODE_FATAL); } } void CCodec::signalSetParameters(const sp<AMessage> &msg) { Loading
media/libaudioclient/ToneGenerator.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ //#define LOG_NDEBUG 0 #define LOG_TAG "ToneGenerator" #include <inttypes.h> #include <utility> #include <math.h> Loading Loading @@ -1229,7 +1230,8 @@ void ToneGenerator::stopTone() { sec = sec * 1000 + nsec / 1000000; // duration in milliseconds mMaxSmp = (unsigned int)(((int64_t)sec * mSamplingRate) / 1000); } ALOGV("stopTone() forcing mMaxSmp to %d, total for far %d", mMaxSmp, mTotalSmp); ALOGV("stopTone() forcing mMaxSmp to %d, total for far %" PRIu64, mMaxSmp, mTotalSmp); } else { mState = TONE_STOPPING; } Loading Loading @@ -1399,7 +1401,7 @@ size_t ToneGenerator::onMoreData(const AudioTrack::Buffer& buffer) { mNextSegSmp = TONEGEN_INF; // forced to skip state machine management below } if (mTotalSmp > mNextSegSmp) { if (mTotalSmp > mNextSegSmp && mNextSegSmp != TONEGEN_INF) { // Time to go to next sequence segment ALOGV("End Segment, time: %d", (unsigned int)(systemTime()/1000000)); Loading
media/libaudioclient/include/media/ToneGenerator.h +3 −4 Original line number Diff line number Diff line Loading @@ -287,11 +287,10 @@ private: static const ToneDescriptor sToneDescriptors[]; bool mThreadCanCallJava; unsigned int mTotalSmp; // Total number of audio samples played (gives current time) uint64_t mTotalSmp; // Total number of audio samples played (gives current time) // Since these types are 32 bit, we may have issues with aborting on // overflow now that we have integer overflow sanitization enabled globally. unsigned int mNextSegSmp; // Position of next segment transition expressed in samples // NOTE: because mTotalSmp, mNextSegSmp are stored on 32 bit, current design will operate properly // only if tone duration is less than about 27 Hours(@44100Hz sampling rate). If this time is exceeded, // no crash will occur but tone sequence will show a glitch. unsigned int mMaxSmp; // Maximum number of audio samples played (maximun tone duration) int mDurationMs; // Maximum tone duration in ms Loading
media/libheadtracking/SensorPoseProvider.cpp +0 −20 Original line number Diff line number Diff line Loading @@ -158,7 +158,6 @@ class SensorPoseProviderImpl : public SensorPoseProvider { enum DataFormat { kUnknown, kQuaternion, kRotationVectorsAndFlags, kRotationVectorsAndDiscontinuityCount, }; Loading Loading @@ -283,10 +282,6 @@ class SensorPoseProviderImpl : public SensorPoseProvider { return DataFormat::kRotationVectorsAndDiscontinuityCount; } if (sensor->getStringType() == "com.google.hardware.sensor.hid_dynamic.headtracker") { return DataFormat::kRotationVectorsAndFlags; } return DataFormat::kUnknown; } Loading Loading @@ -332,21 +327,6 @@ class SensorPoseProviderImpl : public SensorPoseProvider { return PoseEvent{Pose3f(quat), std::optional<Twist3f>(), false}; } case DataFormat::kRotationVectorsAndFlags: { // Custom sensor, assumed to contain: // 3 floats representing orientation as a rotation vector (in rad). // 3 floats representing angular velocity as a rotation vector (in rad/s). // 1 uint32_t of flags, where: // - LSb is '1' iff the given sample is the first one in a new frame of reference. // - The rest of the bits are reserved for future use. Eigen::Vector3f rotation = {event.data[0], event.data[1], event.data[2]}; Eigen::Vector3f twist = {event.data[3], event.data[4], event.data[5]}; Eigen::Quaternionf quat = rotationVectorToQuaternion(rotation); uint32_t flags = *reinterpret_cast<const uint32_t*>(&event.data[6]); return PoseEvent{Pose3f(quat), Twist3f(Eigen::Vector3f::Zero(), twist), (flags & (1 << 0)) != 0}; } case DataFormat::kRotationVectorsAndDiscontinuityCount: { Eigen::Vector3f rotation = {event.head_tracker.rx, event.head_tracker.ry, event.head_tracker.rz}; Loading