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

Commit 492ccd6f authored by Wei Jia's avatar Wei Jia
Browse files

NuPlayerRenderer: always update MediaClock with max media duration.

Bug: 24345295
Change-Id: I868c9c44ea22de98a083432262e485d0f134203f
(cherry picked from commit d005c5dd)
parent c4c68f63
Loading
Loading
Loading
Loading
+7 −9
Original line number Diff line number Diff line
@@ -910,6 +910,13 @@ bool NuPlayer::Renderer::onDrainAudioQueue() {

        {
            Mutex::Autolock autoLock(mLock);
            int64_t maxTimeMedia;
            maxTimeMedia =
                mAnchorTimeMediaUs +
                        (int64_t)(max((long long)mNumFramesWritten - mAnchorNumFramesWritten, 0LL)
                                * 1000LL * mAudioSink->msecsPerFrame());
            mMediaClock->updateMaxTimeMedia(maxTimeMedia);

            notifyIfMediaRenderingStarted_l();
        }

@@ -936,15 +943,6 @@ bool NuPlayer::Renderer::onDrainAudioQueue() {
            break;
        }
    }
    int64_t maxTimeMedia;
    {
        Mutex::Autolock autoLock(mLock);
        maxTimeMedia =
            mAnchorTimeMediaUs +
                    (int64_t)(max((long long)mNumFramesWritten - mAnchorNumFramesWritten, 0LL)
                            * 1000LL * mAudioSink->msecsPerFrame());
    }
    mMediaClock->updateMaxTimeMedia(maxTimeMedia);

    // calculate whether we need to reschedule another write.
    bool reschedule = !mAudioQueue.empty()