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

Commit be9d7d9c authored by Manikanta Kanamarlapudi's avatar Manikanta Kanamarlapudi Committed by Steve Kondik
Browse files

nuplayer: Modify seek and resume latency calculation

- Seek latency is calculated as time taken for the
  first buffer submit to the render after seek event.

- Stop resume latency calculation after media
  rendering start notification

CRs-Fixed: 776012
Change-Id: Ida2b65a329041d0af0db8d338807f652c1b9f27b
parent 42d068e5
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -185,7 +185,8 @@ NuPlayer::NuPlayer()
      mPlaying(false),
      mImageShowed(false),
      mSkipAudioFlushAfterSuspend(false),
      mSkipVideoFlushAfterSuspend(false) {
      mSkipVideoFlushAfterSuspend(false),
      mSeeking(false) {

    clearFlushComplete();
    mPlayerExtendedStats = (PlayerExtendedStats *)ExtendedStats::Create(
@@ -978,9 +979,9 @@ void NuPlayer::onMessageReceived(const sp<AMessage> &msg) {
                finishFlushIfPossible();
            } else if (what == Renderer::kWhatVideoRenderingStart) {
                PLAYER_STATS(profileStop, STATS_PROFILE_START_LATENCY);
                PLAYER_STATS(profileStop, STATS_PROFILE_RESUME);
                notifyListener(MEDIA_INFO, MEDIA_INFO_RENDERING_START, 0);
            } else if (what == Renderer::kWhatMediaRenderingStart) {
                PLAYER_STATS(profileStop, STATS_PROFILE_RESUME);
                ALOGV("media rendering started");
                notifyListener(MEDIA_STARTED, 0, 0);
            } else if (what == Renderer::kWhatAudioOffloadTearDown) {
@@ -1658,6 +1659,11 @@ void NuPlayer::renderBuffer(bool audio, const sp<AMessage> &msg) {
        mCCDecoder->display(mediaTimeUs);
    }

    if (!audio && mSeeking) {
        buffer->meta()->setInt32("seeking", mSeeking);
        mSeeking = false;
    }

    mRenderer->queueBuffer(audio, buffer, reply);
}

@@ -1926,6 +1932,7 @@ void NuPlayer::performSeek(int64_t seekTimeUs, bool needNotify) {
          seekTimeUs / 1E6,
          needNotify);

    mSeeking = true;
    if (mSource == NULL) {
        // This happens when reset occurs right before the loop mode
        // asynchronously seeks to the start of the stream.
@@ -1947,7 +1954,6 @@ void NuPlayer::performSeek(int64_t seekTimeUs, bool needNotify) {
    }

    PLAYER_STATS(notifySeekDone);
    PLAYER_STATS(profileStop, STATS_PROFILE_SEEK);
    // everything's flushed, continue playback.
}

+1 −0
Original line number Diff line number Diff line
@@ -207,6 +207,7 @@ private:
    bool mPlaying;

    bool mImageShowed;
    bool mSeeking;

    bool mSkipAudioFlushAfterSuspend;
    bool mSkipVideoFlushAfterSuspend;
+7 −0
Original line number Diff line number Diff line
@@ -4599,6 +4599,13 @@ void ACodec::BaseState::onOutputBufferDrained(const sp<AMessage> &msg) {
        info->mStatus = BufferInfo::OWNED_BY_US;
    }

    if (mCodec->mMediaExtendedStats != NULL) {
        int32_t seeking;
        if (info->mData->meta()->findInt32("seeking", &seeking)) {
            mCodec->mMediaExtendedStats->profileStop(STATS_PROFILE_SEEK);
        }
    }

    PortMode mode = getPortMode(kPortIndexOutput);

    switch (mode) {