Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3794b24a authored by Chih-Hung Hsieh's avatar Chih-Hung Hsieh Committed by Chih-hung Hsieh
Browse files

Fix cert-dcl16-c clang-tidy warnings in libstagefright.

Bug: 120614316
Test: make with WITH_TIDY=1 DEFAULT_GLOBAL_TIDY_CHECKS=-*,cert-dcl16-c
Change-Id: I3b7b9895da4960c4b7549a49869dd257fe7ab4cc
parent 04cc6db7
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -566,8 +566,8 @@ ACodec::ACodec()
      mDequeueCounter(0),
      mMetadataBuffersToSubmit(0),
      mNumUndequeuedBuffers(0),
      mRepeatFrameDelayUs(-1ll),
      mMaxPtsGapUs(0ll),
      mRepeatFrameDelayUs(-1LL),
      mMaxPtsGapUs(0LL),
      mMaxFps(-1),
      mFps(-1.0),
      mCaptureFps(-1.0),
@@ -1818,15 +1818,15 @@ status_t ACodec::configureCodec(
        if (!msg->findInt64(
                    "repeat-previous-frame-after",
                    &mRepeatFrameDelayUs)) {
            mRepeatFrameDelayUs = -1ll;
            mRepeatFrameDelayUs = -1LL;
        }

        // only allow 32-bit value, since we pass it as U32 to OMX.
        if (!msg->findInt64("max-pts-gap-to-encoder", &mMaxPtsGapUs)) {
            mMaxPtsGapUs = 0ll;
            mMaxPtsGapUs = 0LL;
        } else if (mMaxPtsGapUs > INT32_MAX || mMaxPtsGapUs < INT32_MIN) {
            ALOGW("Unsupported value for max pts gap %lld", (long long) mMaxPtsGapUs);
            mMaxPtsGapUs = 0ll;
            mMaxPtsGapUs = 0LL;
        }

        if (!msg->findFloat("max-fps-to-encoder", &mMaxFps)) {
@@ -1834,7 +1834,7 @@ status_t ACodec::configureCodec(
        }

        // notify GraphicBufferSource to allow backward frames
        if (mMaxPtsGapUs < 0ll) {
        if (mMaxPtsGapUs < 0LL) {
            mMaxFps = -1;
        }

@@ -6538,7 +6538,7 @@ void ACodec::LoadedState::stateEntered() {

    mCodec->mDequeueCounter = 0;
    mCodec->mMetadataBuffersToSubmit = 0;
    mCodec->mRepeatFrameDelayUs = -1ll;
    mCodec->mRepeatFrameDelayUs = -1LL;
    mCodec->mInputFormat.clear();
    mCodec->mOutputFormat.clear();
    mCodec->mBaseOutputFormat.clear();
@@ -6680,7 +6680,7 @@ status_t ACodec::LoadedState::setupInputSurface() {
        return err;
    }

    if (mCodec->mRepeatFrameDelayUs > 0ll) {
    if (mCodec->mRepeatFrameDelayUs > 0LL) {
        err = statusFromBinderStatus(
                mCodec->mGraphicBufferSource->setRepeatPreviousFrameDelayUs(
                        mCodec->mRepeatFrameDelayUs));
@@ -6693,7 +6693,7 @@ status_t ACodec::LoadedState::setupInputSurface() {
        }
    }

    if (mCodec->mMaxPtsGapUs != 0ll) {
    if (mCodec->mMaxPtsGapUs != 0LL) {
        OMX_PARAM_U32TYPE maxPtsGapParams;
        InitOMXParams(&maxPtsGapParams);
        maxPtsGapParams.nPortIndex = kPortIndexInput;
+1 −1
Original line number Diff line number Diff line
@@ -337,7 +337,7 @@ status_t AudioSource::dataCallback(const AudioRecord::Buffer& audioBuffer) {
    } else {
        // This should not happen in normal case.
        ALOGW("Failed to get audio timestamp, fallback to use systemclock");
        timeUs = systemTime() / 1000ll;
        timeUs = systemTime() / 1000LL;
        // Estimate the real sampling time of the 1st sample in this buffer
        // from AudioRecord's latency. (Apply this adjustment first so that
        // the start time logic is not affected.)
+4 −4
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@

namespace android {

static const int64_t kBufferTimeOutUs = 10000ll; // 10 msec
static const int64_t kBufferTimeOutUs = 10000LL; // 10 msec
static const size_t kRetryCount = 50; // must be >0

sp<IMemory> allocVideoFrame(const sp<MetaData>& trackMeta,
@@ -274,7 +274,7 @@ status_t FrameDecoder::extractInternal() {
    size_t retriesLeft = kRetryCount;
    do {
        size_t index;
        int64_t ptsUs = 0ll;
        int64_t ptsUs = 0LL;
        uint32_t flags = 0;

        // Queue as many inputs as we possibly can, then block on dequeuing
@@ -406,7 +406,7 @@ VideoFrameDecoder::VideoFrameDecoder(
    : FrameDecoder(componentName, trackMeta, source),
      mIsAvcOrHevc(false),
      mSeekMode(MediaSource::ReadOptions::SEEK_PREVIOUS_SYNC),
      mTargetTimeUs(-1ll),
      mTargetTimeUs(-1LL),
      mNumFrames(0),
      mNumFramesDecoded(0) {
}
@@ -487,7 +487,7 @@ status_t VideoFrameDecoder::onOutputReceived(
        const sp<MediaCodecBuffer> &videoFrameBuffer,
        const sp<AMessage> &outputFormat,
        int64_t timeUs, bool *done) {
    bool shouldOutput = (mTargetTimeUs < 0ll) || (timeUs >= mTargetTimeUs);
    bool shouldOutput = (mTargetTimeUs < 0LL) || (timeUs >= mTargetTimeUs);

    // If this is not the target frame, skip color convert.
    if (!shouldOutput) {
+2 −2
Original line number Diff line number Diff line
@@ -240,7 +240,7 @@ void MPEG2TSWriter::SourceInfo::extractCodecSpecificData() {
        size -= length;
    }

    out->meta()->setInt64("timeUs", 0ll);
    out->meta()->setInt64("timeUs", 0LL);

    sp<AMessage> notify = mNotify->dup();
    notify->setInt32("what", kNotifyBuffer);
@@ -842,7 +842,7 @@ void MPEG2TSWriter::writeAccessUnit(
    int64_t timeUs;
    CHECK(accessUnit->meta()->findInt64("timeUs", &timeUs));

    uint32_t PTS = (timeUs * 9ll) / 100ll;
    uint32_t PTS = (timeUs * 9LL) / 100LL;

    size_t PES_packet_length = accessUnit->size() + 8;
    bool padding = (accessUnit->size() < (188 - 18));
+7 −7
Original line number Diff line number Diff line
@@ -481,7 +481,7 @@ void MPEG4Writer::initInternal(int fd, bool isFirstSession) {

    mInterleaveDurationUs = 1000000;

    mStartTimestampUs = -1ll;
    mStartTimestampUs = -1LL;
    mStartTimeOffsetMs = -1;
    mPaused = false;
    mStarted = false;
@@ -1734,7 +1734,7 @@ bool MPEG4Writer::reachedEOS() {

void MPEG4Writer::setStartTimestampUs(int64_t timeUs) {
    ALOGI("setStartTimestampUs: %" PRId64, timeUs);
    CHECK_GE(timeUs, 0ll);
    CHECK_GE(timeUs, 0LL);
    Mutex::Autolock autoLock(mLock);
    if (mStartTimestampUs < 0 || mStartTimestampUs > timeUs) {
        mStartTimestampUs = timeUs;
@@ -3067,7 +3067,7 @@ status_t MPEG4Writer::Track::threadEntry() {

            if (mResumed) {
                int64_t durExcludingEarlierPausesUs = timestampUs - previousPausedDurationUs;
                if (WARN_UNLESS(durExcludingEarlierPausesUs >= 0ll, "for %s track", trackName)) {
                if (WARN_UNLESS(durExcludingEarlierPausesUs >= 0LL, "for %s track", trackName)) {
                    copy->release();
                    mSource->stop();
                    mIsMalformed = true;
@@ -3088,7 +3088,7 @@ status_t MPEG4Writer::Track::threadEntry() {
            TimestampDebugHelperEntry timestampDebugEntry;
            timestampUs -= previousPausedDurationUs;
            timestampDebugEntry.pts = timestampUs;
            if (WARN_UNLESS(timestampUs >= 0ll, "for %s track", trackName)) {
            if (WARN_UNLESS(timestampUs >= 0LL, "for %s track", trackName)) {
                copy->release();
                mSource->stop();
                mIsMalformed = true;
@@ -3127,7 +3127,7 @@ status_t MPEG4Writer::Track::threadEntry() {

                cttsOffsetTimeUs =
                        timestampUs + kMaxCttsOffsetTimeUs - decodingTimeUs;
                if (WARN_UNLESS(cttsOffsetTimeUs >= 0ll, "for %s track", trackName)) {
                if (WARN_UNLESS(cttsOffsetTimeUs >= 0LL, "for %s track", trackName)) {
                    copy->release();
                    mSource->stop();
                    mIsMalformed = true;
@@ -3185,7 +3185,7 @@ status_t MPEG4Writer::Track::threadEntry() {
                }
            }

            if (WARN_UNLESS(timestampUs >= 0ll, "for %s track", trackName)) {
            if (WARN_UNLESS(timestampUs >= 0LL, "for %s track", trackName)) {
                copy->release();
                mSource->stop();
                mIsMalformed = true;
@@ -3206,7 +3206,7 @@ status_t MPEG4Writer::Track::threadEntry() {
            currDurationTicks =
                ((timestampUs * mTimeScale + 500000LL) / 1000000LL -
                    (lastTimestampUs * mTimeScale + 500000LL) / 1000000LL);
            if (currDurationTicks < 0ll) {
            if (currDurationTicks < 0LL) {
                ALOGE("do not support out of order frames (timestamp: %lld < last: %lld for %s track",
                        (long long)timestampUs, (long long)lastTimestampUs, trackName);
                copy->release();
Loading