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

Commit 698e9e88 authored by Chih-Hung Hsieh's avatar Chih-Hung Hsieh Committed by android-build-merger
Browse files

Merge "Fix cert-dcl16-c clang-tidy warnings in nuplayer." am: 83c76fb6

am: 45dbe4cb

Change-Id: Idc5b28ad12bb2b85a9478939c533d8c45d451b4a
parents 957bb244 45dbe4cb
Loading
Loading
Loading
Loading
+13 −13
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@ NuPlayer::GenericSource::GenericSource(
      mVideoDataGeneration(0),
      mFetchSubtitleDataGeneration(0),
      mFetchTimedTextDataGeneration(0),
      mDurationUs(-1ll),
      mDurationUs(-1LL),
      mAudioIsVorbis(false),
      mIsSecure(false),
      mIsStreaming(false),
@@ -76,7 +76,7 @@ NuPlayer::GenericSource::GenericSource(
      mUID(uid),
      mMediaClock(mediaClock),
      mFd(-1),
      mBitrate(-1ll),
      mBitrate(-1LL),
      mPendingReadBufferTypes(0) {
    ALOGV("GenericSource");
    CHECK(mediaClock != NULL);
@@ -727,7 +727,7 @@ void NuPlayer::GenericSource::fetchTextData(
    }

    if (msg->what() == kWhatFetchSubtitleData) {
        subTimeUs -= 1000000ll;  // send subtile data one second earlier
        subTimeUs -= 1000000LL;  // send subtile data one second earlier
    }
    sp<AMessage> msg2 = new AMessage(sendWhat, this);
    msg2->setInt32("generation", msgGeneration);
@@ -764,7 +764,7 @@ void NuPlayer::GenericSource::sendTextData(
        notify->post();

        if (msg->what() == kWhatSendSubtitleData) {
            nextSubTimeUs -= 1000000ll;  // send subtile data one second earlier
            nextSubTimeUs -= 1000000LL;  // send subtile data one second earlier
        }
        mMediaClock->addTimer(msg, nextSubTimeUs);
    }
@@ -855,7 +855,7 @@ status_t NuPlayer::GenericSource::dequeueAccessUnit(
        // TODO: maxRebufferingMarkMs could be larger than
        // mBufferingSettings.mResumePlaybackMarkMs
        int64_t restartBufferingMarkUs =
             mBufferingSettings.mResumePlaybackMarkMs * 1000ll / 2;
             mBufferingSettings.mResumePlaybackMarkMs * 1000LL / 2;
        if (finalResult == OK) {
            if (durationUs < restartBufferingMarkUs) {
                postReadBuffer(audio? MEDIA_TRACK_TYPE_AUDIO : MEDIA_TRACK_TYPE_VIDEO);
@@ -1446,7 +1446,7 @@ void NuPlayer::GenericSource::readBuffer(
        // TODO: maxRebufferingMarkMs could be larger than
        // mBufferingSettings.mResumePlaybackMarkMs
        int64_t markUs = (mPreparing ? mBufferingSettings.mInitialMarkMs
            : mBufferingSettings.mResumePlaybackMarkMs) * 1000ll;
            : mBufferingSettings.mResumePlaybackMarkMs) * 1000LL;
        if (finalResult == ERROR_END_OF_STREAM || durationUs >= markUs) {
            if (mPreparing || mSentPauseOnBuffering) {
                Track *counterTrack =
@@ -1514,12 +1514,12 @@ void NuPlayer::GenericSource::schedulePollBuffering() {
    sp<AMessage> msg = new AMessage(kWhatPollBuffering, this);
    msg->setInt32("generation", mPollBufferingGeneration);
    // Enquires buffering status every second.
    msg->post(1000000ll);
    msg->post(1000000LL);
}

void NuPlayer::GenericSource::onPollBuffering() {
    status_t finalStatus = UNKNOWN_ERROR;
    int64_t cachedDurationUs = -1ll;
    int64_t cachedDurationUs = -1LL;
    ssize_t cachedDataRemaining = -1;

    if (mCachedSource != NULL) {
@@ -1527,15 +1527,15 @@ void NuPlayer::GenericSource::onPollBuffering() {

        if (finalStatus == OK) {
            off64_t size;
            int64_t bitrate = 0ll;
            int64_t bitrate = 0LL;
            if (mDurationUs > 0 && mCachedSource->getSize(&size) == OK) {
                // |bitrate| uses bits/second unit, while size is number of bytes.
                bitrate = size * 8000000ll / mDurationUs;
                bitrate = size * 8000000LL / mDurationUs;
            } else if (mBitrate > 0) {
                bitrate = mBitrate;
            }
            if (bitrate > 0) {
                cachedDurationUs = cachedDataRemaining * 8000000ll / bitrate;
                cachedDurationUs = cachedDataRemaining * 8000000LL / bitrate;
            }
        }
    }
@@ -1550,8 +1550,8 @@ void NuPlayer::GenericSource::onPollBuffering() {
        return;
    }

    if (cachedDurationUs >= 0ll) {
        if (mDurationUs > 0ll) {
    if (cachedDurationUs >= 0LL) {
        if (mDurationUs > 0LL) {
            int64_t cachedPosUs = getLastReadPosition() + cachedDurationUs;
            int percentage = 100.0 * cachedPosUs / mDurationUs;
            if (percentage > 100) {
+3 −3
Original line number Diff line number Diff line
@@ -271,10 +271,10 @@ void NuPlayer::HTTPLiveSource::pollForRawData(

        if (fetchType == LiveSession::STREAMTYPE_SUBTITLES) {
            notify->post();
            msg->post(delayUs > 0ll ? delayUs : 0ll);
            msg->post(delayUs > 0LL ? delayUs : 0LL);
            return;
        } else if (fetchType == LiveSession::STREAMTYPE_METADATA) {
            if (delayUs < -1000000ll) { // 1 second
            if (delayUs < -1000000LL) { // 1 second
                continue;
            }
            notify->post();
@@ -286,7 +286,7 @@ void NuPlayer::HTTPLiveSource::pollForRawData(
    }

    // try again in 1 second
    msg->post(1000000ll);
    msg->post(1000000LL);
}

void NuPlayer::HTTPLiveSource::onMessageReceived(const sp<AMessage> &msg) {
+3 −3
Original line number Diff line number Diff line
@@ -750,7 +750,7 @@ void NuPlayer::onMessageReceived(const sp<AMessage> &msg) {
                }
            }

            msg->post(1000000ll);  // poll again in a second.
            msg->post(1000000LL);  // poll again in a second.
            break;
        }

@@ -1038,7 +1038,7 @@ void NuPlayer::onMessageReceived(const sp<AMessage> &msg) {
            }

            if (rescan) {
                msg->post(100000ll);
                msg->post(100000LL);
                mScanSourcesPending = true;
            }
            break;
@@ -2659,7 +2659,7 @@ void NuPlayer::onSourceNotify(const sp<AMessage> &msg) {
            int posMs;
            int64_t timeUs, posUs;
            driver->getCurrentPosition(&posMs);
            posUs = (int64_t) posMs * 1000ll;
            posUs = (int64_t) posMs * 1000LL;
            CHECK(buffer->meta()->findInt64("timeUs", &timeUs));

            if (posUs < timeUs) {
+1 −1
Original line number Diff line number Diff line
@@ -542,7 +542,7 @@ void NuPlayer::CCDecoder::display(int64_t timeUs) {

        ccBuf->meta()->setInt32("track-index", mSelectedTrack);
        ccBuf->meta()->setInt64("timeUs", timeUs);
        ccBuf->meta()->setInt64("durationUs", 0ll);
        ccBuf->meta()->setInt64("durationUs", 0LL);

        sp<AMessage> msg = mNotify->dup();
        msg->setInt32("what", kWhatClosedCaptionData);
+7 −7
Original line number Diff line number Diff line
@@ -71,10 +71,10 @@ NuPlayer::Decoder::Decoder(
      mCCDecoder(ccDecoder),
      mPid(pid),
      mUid(uid),
      mSkipRenderingUntilMediaTimeUs(-1ll),
      mNumFramesTotal(0ll),
      mNumInputFramesDropped(0ll),
      mNumOutputFramesDropped(0ll),
      mSkipRenderingUntilMediaTimeUs(-1LL),
      mNumFramesTotal(0LL),
      mNumInputFramesDropped(0LL),
      mNumOutputFramesDropped(0LL),
      mVideoWidth(0),
      mVideoHeight(0),
      mIsAudio(true),
@@ -408,10 +408,10 @@ void NuPlayer::Decoder::onSetParameters(const sp<AMessage> &params) {
        // TODO: For now, layer fps is calculated for some specific architectures.
        // But it really should be extracted from the stream.
        mVideoTemporalLayerAggregateFps[0] =
            mFrameRateTotal / (float)(1ll << (mNumVideoTemporalLayerTotal - 1));
            mFrameRateTotal / (float)(1LL << (mNumVideoTemporalLayerTotal - 1));
        for (int32_t i = 1; i < mNumVideoTemporalLayerTotal; ++i) {
            mVideoTemporalLayerAggregateFps[i] =
                mFrameRateTotal / (float)(1ll << (mNumVideoTemporalLayerTotal - i))
                mFrameRateTotal / (float)(1LL << (mNumVideoTemporalLayerTotal - i))
                + mVideoTemporalLayerAggregateFps[i - 1];
        }
    }
@@ -933,7 +933,7 @@ status_t NuPlayer::Decoder::fetchInputData(sp<AMessage> &reply) {

            int32_t layerId = 0;
            bool haveLayerId = accessUnit->meta()->findInt32("temporal-layer-id", &layerId);
            if (mRenderer->getVideoLateByUs() > 100000ll
            if (mRenderer->getVideoLateByUs() > 100000LL
                    && mIsVideoAVC
                    && !IsAVCReferenceFrame(accessUnit)) {
                dropAccessUnit = true;
Loading