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

Commit da6bf5a9 authored by Vikash Garodia's avatar Vikash Garodia Committed by Steve Kondik
Browse files

libstagefright: customize delay to post video events

Calculate delay as a function of lateness rather
than fixed 10ms.
When video frames are decoded quite early, this
change will delay the wake up of video events.

We save some unwanted wake up of video events
which save power.

Change-Id: I12839b9df62d453f394894b499491e2cac3a0c8a
CRs-Fixed: 578988
parent c5919c9c
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -85,6 +85,7 @@ static const size_t kHighWaterMarkBytes = 200000;
#ifdef QCOM_DIRECTTRACK
int AwesomePlayer::mTunnelAliveAP = 0;
#endif
static int64_t kVideoEarlyMarginUs = -10000LL;

// maximum time in paused state when offloading audio decompression. When elapsed, the AudioPlayer
// is destroyed to allow the audio DSP to power down.
@@ -2349,7 +2350,8 @@ void AwesomePlayer::onVideoEvent() {
                Mutex::Autolock autoLock(mStatsLock);
                mStats.mConsecutiveFramesDropped = 0;
            }
            postVideoEvent_l(10000);
            postVideoEvent_l((kVideoEarlyMarginUs - latenessUs) > 100000LL ?
                                100000LL : (kVideoEarlyMarginUs - latenessUs));
            return;
        }
    }