diff options
author | Chong Zhang <chz@google.com> | 2015-01-16 00:29:13 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-01-16 00:29:13 +0000 |
commit | 9e308de9214e55dd0d102484ea44b117ec050540 (patch) | |
tree | 65233f48967b2de8c1ce6ac794db49c59f9e6110 | |
parent | 65cb339de0f628c82bdd5c68d868b6f3dc83cf04 (diff) | |
parent | 4d4ea7f7ca04cfe70ecf6f35658389f52ae6d3c1 (diff) | |
download | frameworks_av-9e308de9214e55dd0d102484ea44b117ec050540.zip frameworks_av-9e308de9214e55dd0d102484ea44b117ec050540.tar.gz frameworks_av-9e308de9214e55dd0d102484ea44b117ec050540.tar.bz2 |
am 4d4ea7f7: Merge "do not use paused postition if it\'s not available" into lmp-mr1-dev
* commit '4d4ea7f7ca04cfe70ecf6f35658389f52ae6d3c1':
do not use paused postition if it's not available
-rw-r--r-- | media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp index 57fcfe5..80b8493 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp +++ b/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp @@ -77,7 +77,7 @@ NuPlayer::Renderer::Renderer( mNotifyCompleteVideo(false), mSyncQueues(false), mPaused(false), - mPausePositionMediaTimeUs(0), + mPausePositionMediaTimeUs(-1), mVideoSampleReceived(false), mVideoRenderingStarted(false), mVideoRenderingStartGeneration(0), @@ -210,7 +210,7 @@ status_t NuPlayer::Renderer::getCurrentPositionOnLooper( // Called either with mLock acquired or on renderer's thread. bool NuPlayer::Renderer::getCurrentPositionIfPaused_l(int64_t *mediaUs) { - if (!mPaused) { + if (!mPaused || mPausePositionMediaTimeUs < 0ll) { return false; } *mediaUs = mPausePositionMediaTimeUs; @@ -1232,6 +1232,12 @@ void NuPlayer::Renderer::onPause() { if (getCurrentPositionFromAnchor( ¤tPositionUs, ALooper::GetNowUs()) == OK) { mPausePositionMediaTimeUs = currentPositionUs; + } else { + // Set paused position to -1 (unavailabe) if we don't have anchor time + // This could happen if client does a seekTo() immediately followed by + // pause(). Renderer will be flushed with anchor time cleared. We don't + // want to leave stale value in mPausePositionMediaTimeUs. + mPausePositionMediaTimeUs = -1; } { Mutex::Autolock autoLock(mLock); |