diff options
author | Andreas Huber <andih@google.com> | 2010-03-31 09:40:15 -0700 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2010-03-31 09:40:15 -0700 |
commit | 1321fdd94d354431b930735e9f38f32ecd189a2d (patch) | |
tree | e1fe11cc77be0853ba8fe29368d4a4705ba8cd7d | |
parent | 08f00853886c0d26e087c23da3e24df5d36d3674 (diff) | |
download | frameworks_av-1321fdd94d354431b930735e9f38f32ecd189a2d.zip frameworks_av-1321fdd94d354431b930735e9f38f32ecd189a2d.tar.gz frameworks_av-1321fdd94d354431b930735e9f38f32ecd189a2d.tar.bz2 |
Properly send a MEDIA_SEEK_COMPLETE notification for a seek request while paused (legacy behaviour).
Change-Id: I64da5eb97c75b269b4668b3628ed0f05f2e36e51
related-to-bug: 2557482
-rw-r--r-- | media/libstagefright/AwesomePlayer.cpp | 20 | ||||
-rw-r--r-- | media/libstagefright/include/AwesomePlayer.h | 1 |
2 files changed, 19 insertions, 2 deletions
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp index 842176e..27add0a 100644 --- a/media/libstagefright/AwesomePlayer.cpp +++ b/media/libstagefright/AwesomePlayer.cpp @@ -395,6 +395,7 @@ void AwesomePlayer::reset_l() { mVideoTimeUs = 0; mSeeking = false; + mSeekNotificationSent = false; mSeekTimeUs = 0; mUri.setTo(""); @@ -686,11 +687,20 @@ status_t AwesomePlayer::seekTo(int64_t timeUs) { status_t AwesomePlayer::seekTo_l(int64_t timeUs) { mSeeking = true; + mSeekNotificationSent = false; mSeekTimeUs = timeUs; mFlags &= ~AT_EOS; seekAudioIfNecessary_l(); + if (!(mFlags & PLAYING)) { + LOGV("seeking while paused, sending SEEK_COMPLETE notification" + " immediately."); + + notifyListener_l(MEDIA_SEEK_COMPLETE); + mSeekNotificationSent = true; + } + return OK; } @@ -701,6 +711,7 @@ void AwesomePlayer::seekAudioIfNecessary_l() { mWatchForAudioSeekComplete = true; mWatchForAudioEOS = true; mSeeking = false; + mSeekNotificationSent = false; } } @@ -869,7 +880,7 @@ void AwesomePlayer::onVideoEvent() { mAudioPlayer->seekTo(timeUs); mWatchForAudioSeekComplete = true; mWatchForAudioEOS = true; - } else { + } else if (!mSeekNotificationSent) { // If we're playing video only, report seek complete now, // otherwise audio player will notify us later. notifyListener_l(MEDIA_SEEK_COMPLETE); @@ -877,6 +888,7 @@ void AwesomePlayer::onVideoEvent() { mFlags |= FIRST_FRAME; mSeeking = false; + mSeekNotificationSent = false; } if (mFlags & FIRST_FRAME) { @@ -984,7 +996,11 @@ void AwesomePlayer::onCheckAudioStatus() { if (mWatchForAudioSeekComplete && !mAudioPlayer->isSeeking()) { mWatchForAudioSeekComplete = false; - notifyListener_l(MEDIA_SEEK_COMPLETE); + + if (!mSeekNotificationSent) { + notifyListener_l(MEDIA_SEEK_COMPLETE); + mSeekNotificationSent = true; + } } status_t finalStatus; diff --git a/media/libstagefright/include/AwesomePlayer.h b/media/libstagefright/include/AwesomePlayer.h index c985dff..9e8a674 100644 --- a/media/libstagefright/include/AwesomePlayer.h +++ b/media/libstagefright/include/AwesomePlayer.h @@ -132,6 +132,7 @@ private: int64_t mVideoTimeUs; bool mSeeking; + bool mSeekNotificationSent; int64_t mSeekTimeUs; bool mWatchForAudioSeekComplete; |