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

Commit cd422ac2 authored by Praveen Chavan's avatar Praveen Chavan Committed by Linux Build Service Account
Browse files

NuPlayerRenderer: Update position of AV stream even after audio EOS

For AV streams with shorter audio, anchorTime does not update beyond
audio EOS causing MediaPlayer.getCurrentPosition to return the same
fixed value (progress bar does not update).
Allow updating the current position in renderer beyond the anchorTime
to update the player's position if audio stream is present.

CRs-Fixed: 808073

Change-Id: I75625d24a6c155ff12f27fd0848503657e9219aa
parent ce35c5f2
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -102,6 +102,7 @@ NuPlayer::Renderer::Renderer(
      mVideoLateByUs(0ll),
      mHasAudio(false),
      mHasVideo(false),
      mFoundAudioEOS(false),
      mNotifyCompleteAudio(false),
      mNotifyCompleteVideo(false),
      mSyncQueues(false),
@@ -311,7 +312,8 @@ void NuPlayer::Renderer::setVideoFrameRate(float fps) {

// Called on any threads.
status_t NuPlayer::Renderer::getCurrentPosition(int64_t *mediaUs) {
    return mMediaClock->getMediaTime(ALooper::GetNowUs(), mediaUs);
    return mMediaClock->getMediaTime(
            ALooper::GetNowUs(), mediaUs, (mHasAudio && mFoundAudioEOS));
}

void NuPlayer::Renderer::clearAudioFirstAnchorTime_l() {
@@ -1145,6 +1147,9 @@ void NuPlayer::Renderer::notifyVideoRenderingStart() {
}

void NuPlayer::Renderer::notifyEOS(bool audio, status_t finalResult, int64_t delayUs) {
    if (audio) {
        mFoundAudioEOS = true;
    }
    sp<AMessage> notify = mNotify->dup();
    notify->setInt32("what", kWhatEOS);
    notify->setInt32("audio", static_cast<int32_t>(audio));
+1 −0
Original line number Diff line number Diff line
@@ -162,6 +162,7 @@ private:
    int64_t mVideoLateByUs;
    bool mHasAudio;
    bool mHasVideo;
    bool mFoundAudioEOS;

    bool mNotifyCompleteAudio;
    bool mNotifyCompleteVideo;