Merge "SoundPool: Fix clang-tidy" am: c337968e03 am: fa59a51450

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1625766

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I8f47e7b2a63cdb446854eb09b105f27aef244940
This commit is contained in:
Andy Hung
2021-03-12 18:50:08 +00:00
committed by Automerger Merge Worker
4 changed files with 12 additions and 9 deletions

View File

@ -99,8 +99,8 @@ static status_t decode(int fd, int64_t offset, int64_t length,
__func__);
break;
}
int sampleSize = AMediaExtractor_readSampleData(ex.get(), buf, bufsize);
ALOGV("%s: read %d", __func__, sampleSize);
ssize_t sampleSize = AMediaExtractor_readSampleData(ex.get(), buf, bufsize);
ALOGV("%s: read %zd", __func__, sampleSize);
if (sampleSize < 0) {
sampleSize = 0;
sawInputEOS = true;
@ -124,8 +124,8 @@ static status_t decode(int fd, int64_t offset, int64_t length,
}
AMediaCodecBufferInfo info;
const int status = AMediaCodec_dequeueOutputBuffer(codec.get(), &info, 1);
ALOGV("%s: dequeueoutput returned: %d", __func__, status);
const ssize_t status = AMediaCodec_dequeueOutputBuffer(codec.get(), &info, 1);
ALOGV("%s: dequeueoutput returned: %zd", __func__, status);
if (status >= 0) {
if (info.flags & AMEDIACODEC_BUFFER_FLAG_END_OF_STREAM) {
ALOGV("%s: output EOS", __func__);
@ -167,10 +167,10 @@ static status_t decode(int fd, int64_t offset, int64_t length,
} else if (status == AMEDIACODEC_INFO_TRY_AGAIN_LATER) {
ALOGV("%s: no output buffer right now", __func__);
} else if (status <= AMEDIA_ERROR_BASE) {
ALOGE("%s: decode error: %d", __func__, status);
ALOGE("%s: decode error: %zd", __func__, status);
break;
} else {
ALOGV("%s: unexpected info code: %d", __func__, status);
ALOGV("%s: unexpected info code: %zd", __func__, status);
}
}

View File

@ -317,7 +317,8 @@ void Stream::play_l(const std::shared_ptr<Sound>& sound, int32_t nextStreamID,
// audio track while the new one is being started and avoids processing them with
// wrong audio audio buffer size (mAudioBufferSize)
auto toggle = mToggle ^ 1;
void* userData = (void*)((uintptr_t)this | toggle);
// NOLINTNEXTLINE(performance-no-int-to-ptr)
void* userData = reinterpret_cast<void*>((uintptr_t)this | toggle);
audio_channel_mask_t soundChannelMask = sound->getChannelMask();
// When sound contains a valid channel mask, use it as is.
// Otherwise, use stream count to calculate channel mask.
@ -386,6 +387,7 @@ exit:
void Stream::staticCallback(int event, void* user, void* info)
{
const auto userAsInt = (uintptr_t)user;
// NOLINTNEXTLINE(performance-no-int-to-ptr)
auto stream = reinterpret_cast<Stream*>(userAsInt & ~1);
stream->callback(event, info, int(userAsInt & 1), 0 /* tries */);
}

View File

@ -330,7 +330,7 @@ ssize_t StreamManager::removeFromQueues_l(
// streams on mProcessingStreams are undergoing processing by the StreamManager thread
// and do not participate in normal stream migration.
return found;
return (ssize_t)found;
}
void StreamManager::addToRestartQueue_l(Stream *stream) {

View File

@ -34,7 +34,8 @@ static struct fields_t {
jclass mSoundPoolClass;
} fields;
static inline SoundPool* MusterSoundPool(JNIEnv *env, jobject thiz) {
return (SoundPool*)env->GetLongField(thiz, fields.mNativeContext);
// NOLINTNEXTLINE(performance-no-int-to-ptr)
return reinterpret_cast<SoundPool*>(env->GetLongField(thiz, fields.mNativeContext));
}
static const char* const kAudioAttributesClassPathName = "android/media/AudioAttributes";
struct audio_attributes_fields_t {