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

Commit 3f0c1353 authored by James Dong's avatar James Dong Committed by Android (Google) Code Review
Browse files

Merge "Awesomeplayer : Frame dropping logic change" into honeycomb

parents 539802e7 28f939db
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@
#include "include/LiveSession.h"

#define USE_SURFACE_ALLOC 1
#define FRAME_DROP_FREQ 7

namespace android {

@@ -1255,7 +1256,7 @@ void AwesomePlayer::onVideoEvent() {

    if (mFlags & FIRST_FRAME) {
        mFlags &= ~FIRST_FRAME;

        mSinceLastDropped = 0;
        mTimeSourceDeltaUs = ts->getRealTimeUs() - timeUs;
    }

@@ -1283,13 +1284,17 @@ void AwesomePlayer::onVideoEvent() {
    if (latenessUs > 40000) {
        // We're more than 40ms late.
        LOGV("we're late by %lld us (%.2f secs)", latenessUs, latenessUs / 1E6);

        if ( mSinceLastDropped > FRAME_DROP_FREQ)
        {
            LOGV("we're late by %lld us (%.2f secs) dropping one after %d frames", latenessUs, latenessUs / 1E6, mSinceLastDropped);
            mSinceLastDropped = 0;
            mVideoBuffer->release();
            mVideoBuffer = NULL;

            postVideoEvent_l();
            return;
        }
    }

    if (latenessUs < -10000) {
        // We're more than 10ms early.
@@ -1305,6 +1310,7 @@ void AwesomePlayer::onVideoEvent() {
    }

    if (mVideoRenderer != NULL) {
        mSinceLastDropped++;
        mVideoRenderer->render(mVideoBuffer);
    }

+1 −0
Original line number Diff line number Diff line
@@ -151,6 +151,7 @@ private:

    uint32_t mFlags;
    uint32_t mExtractorFlags;
    uint32_t mSinceLastDropped;

    int64_t mTimeSourceDeltaUs;
    int64_t mVideoTimeUs;