diff options
author | Lajos Molnar <lajos@google.com> | 2013-10-23 15:19:47 -0700 |
---|---|---|
committer | Lajos Molnar <lajos@google.com> | 2013-11-12 17:40:38 -0800 |
commit | 0c3684f5996be3b1226ed229eff39a74ae28a879 (patch) | |
tree | a262f7638c7bed641fc956fde7a859866ef145c5 /media | |
parent | 22990fe1ee3531e84dbadb7ff9ffd68d5bbe9060 (diff) | |
download | frameworks_av-0c3684f5996be3b1226ed229eff39a74ae28a879.zip frameworks_av-0c3684f5996be3b1226ed229eff39a74ae28a879.tar.gz frameworks_av-0c3684f5996be3b1226ed229eff39a74ae28a879.tar.bz2 |
AwesomePlayer: Improve performance on high-fps clips
- Immediately retry rendering next frame after frame skip.
- Schedule next videoEvent based on the timestamp of the
next frame.
Change-Id: Ia106382c4c225321b682c1f7c2d126d7eab7d56d
Signed-off-by: Lajos Molnar <lajos@google.com>
Bug: 11159147
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 e1f6563..87ed96a 100644 --- a/media/libstagefright/AwesomePlayer.cpp +++ b/media/libstagefright/AwesomePlayer.cpp @@ -1932,7 +1932,7 @@ void AwesomePlayer::onVideoEvent() { ++mStats.mNumVideoFramesDropped; } - postVideoEvent_l(); + postVideoEvent_l(0); return; } } @@ -1972,6 +1972,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(); } |