diff options
author | pmehendale <pmehendale@nvidia.com> | 2011-01-06 14:43:49 -0800 |
---|---|---|
committer | James Dong <jdong@google.com> | 2011-01-07 16:14:40 -0800 |
commit | aee6c07b3572bf2510cd9e7d29c454fcfedde31d (patch) | |
tree | 7a337a7a6f343226d2f0b337ee7340cf1a50bb4b /media/libstagefright/AwesomePlayer.cpp | |
parent | 11f8109ad8646d3acd9a0987613229cde59d52c1 (diff) | |
download | frameworks_av-aee6c07b3572bf2510cd9e7d29c454fcfedde31d.zip frameworks_av-aee6c07b3572bf2510cd9e7d29c454fcfedde31d.tar.gz frameworks_av-aee6c07b3572bf2510cd9e7d29c454fcfedde31d.tar.bz2 |
Awesomeplayer : Frame dropping logic change
Changed late frame drop policy, now we are dropping only 1 in 8,
late (> 40ms) frames. Dropping every late frame result in lot of noticible
pauses, usually with peaky bitrate activity these pauses become more prominant.
Dropping few frames is still required to allow overall playback chain,
to regain the performance.
Experimentally decided to drop Max one late frame in 8.
Change-Id: If20848d619a76aaf8179b1e5c3155610e3bc85fd
Diffstat (limited to 'media/libstagefright/AwesomePlayer.cpp')
-rw-r--r-- | media/libstagefright/AwesomePlayer.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp index b350daf..914e409 100644 --- a/media/libstagefright/AwesomePlayer.cpp +++ b/media/libstagefright/AwesomePlayer.cpp @@ -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,12 +1284,16 @@ 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; - mVideoBuffer->release(); - mVideoBuffer = NULL; - - postVideoEvent_l(); - return; + postVideoEvent_l(); + return; + } } if (latenessUs < -10000) { @@ -1305,6 +1310,7 @@ void AwesomePlayer::onVideoEvent() { } if (mVideoRenderer != NULL) { + mSinceLastDropped++; mVideoRenderer->render(mVideoBuffer); } |