diff options
author | Lajos Molnar <lajos@google.com> | 2013-11-13 15:57:41 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-11-13 15:57:41 -0800 |
commit | 47afcc5f5fb94263977717bd12433d594fbbc43f (patch) | |
tree | d4a8f83042b8b462658f746b26991dd7dcd85d7b /media | |
parent | 0e0278e333aab7c87ae4d264d8ad1ab38c8b9b56 (diff) | |
parent | 069bcc5084c3d8c6f9373a2890d40a0d1a36a94e (diff) | |
download | frameworks_av-47afcc5f5fb94263977717bd12433d594fbbc43f.zip frameworks_av-47afcc5f5fb94263977717bd12433d594fbbc43f.tar.gz frameworks_av-47afcc5f5fb94263977717bd12433d594fbbc43f.tar.bz2 |
am 069bcc50: Merge "AwesomePlayer: Improve performance on high-fps clips" into klp-dev
* commit '069bcc5084c3d8c6f9373a2890d40a0d1a36a94e':
AwesomePlayer: Improve performance on high-fps clips
Diffstat (limited to 'media')
-rw-r--r-- | media/libstagefright/AwesomePlayer.cpp | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp index e5be878..3f64b66 100644 --- a/media/libstagefright/AwesomePlayer.cpp +++ b/media/libstagefright/AwesomePlayer.cpp @@ -1931,7 +1931,7 @@ void AwesomePlayer::onVideoEvent() { ++mStats.mNumVideoFramesDropped; } - postVideoEvent_l(); + postVideoEvent_l(0); return; } } @@ -1971,6 +1971,41 @@ void AwesomePlayer::onVideoEvent() { return; } + /* get next frame time */ + if (wasSeeking == NO_SEEK) { + MediaSource::ReadOptions options; + for (;;) { + status_t err = mVideoSource->read(&mVideoBuffer, &options); + if (err != OK) { + // deal with any errors next time + CHECK(mVideoBuffer == NULL); + postVideoEvent_l(0); + return; + } + + if (mVideoBuffer->range_length() != 0) { + break; + } + + // Some decoders, notably the PV AVC software decoder + // return spurious empty buffers that we just want to ignore. + + mVideoBuffer->release(); + mVideoBuffer = NULL; + } + + { + Mutex::Autolock autoLock(mStatsLock); + ++mStats.mNumVideoFramesDecoded; + } + + int64_t nextTimeUs; + CHECK(mVideoBuffer->meta_data()->findInt64(kKeyTime, &nextTimeUs)); + int64_t delayUs = nextTimeUs - ts->getRealTimeUs() + mTimeSourceDeltaUs; + postVideoEvent_l(delayUs > 10000 ? 10000 : delayUs < 0 ? 0 : delayUs); + return; + } + postVideoEvent_l(); } |