summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2011-03-25 16:38:57 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2011-03-25 16:38:57 -0700
commite8ab51f5937d879e2fc0558b424d21d86446cd23 (patch)
treea60e0a6f7e9119d644727fcedfebfa1ea5831f59 /media
parent1be6cce70175bd90744498d5fca95e3f9eec1cf6 (diff)
parente2cb08bd4c3bc7e7045e107af41f7228d780be04 (diff)
downloadframeworks_base-e8ab51f5937d879e2fc0558b424d21d86446cd23.zip
frameworks_base-e8ab51f5937d879e2fc0558b424d21d86446cd23.tar.gz
frameworks_base-e8ab51f5937d879e2fc0558b424d21d86446cd23.tar.bz2
am e2cb08bd: am 2fee96bc: am 1457ef74: Merge "Make sure we post a video event when seeking after seeing video EOS before." into honeycomb-mr1
* commit 'e2cb08bd4c3bc7e7045e107af41f7228d780be04': Make sure we post a video event when seeking after seeing video EOS before.
Diffstat (limited to 'media')
-rw-r--r--media/libstagefright/AwesomePlayer.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp
index c9a0b60..7940de0 100644
--- a/media/libstagefright/AwesomePlayer.cpp
+++ b/media/libstagefright/AwesomePlayer.cpp
@@ -575,7 +575,7 @@ void AwesomePlayer::onVideoLagUpdate() {
int64_t audioTimeUs = mAudioPlayer->getMediaTimeUs();
int64_t videoLateByUs = audioTimeUs - mVideoTimeUs;
- if (videoLateByUs > 300000ll) {
+ if (!(mFlags & VIDEO_AT_EOS) && videoLateByUs > 300000ll) {
LOGV("video late by %lld ms.", videoLateByUs / 1000ll);
notifyListener_l(
@@ -1063,7 +1063,8 @@ status_t AwesomePlayer::getPosition(int64_t *positionUs) {
}
else if (mSeeking != NO_SEEK) {
*positionUs = mSeekTimeUs;
- } else if (mVideoSource != NULL) {
+ } else if (mVideoSource != NULL
+ && (mAudioPlayer == NULL || !(mFlags & VIDEO_AT_EOS))) {
Mutex::Autolock autoLock(mMiscStateLock);
*positionUs = mVideoTimeUs;
} else if (mAudioPlayer != NULL) {
@@ -1105,6 +1106,14 @@ status_t AwesomePlayer::seekTo_l(int64_t timeUs) {
play_l();
}
+ if ((mFlags & PLAYING) && mVideoSource != NULL && (mFlags & VIDEO_AT_EOS)) {
+ // Video playback completed before, there's no pending
+ // video event right now. In order for this new seek
+ // to be honored, we need to post one.
+
+ postVideoEvent_l();
+ }
+
mSeeking = SEEK;
mSeekNotificationSent = false;
mSeekTimeUs = timeUs;
@@ -1287,6 +1296,7 @@ void AwesomePlayer::finishSeekIfNecessary(int64_t videoTimeUs) {
mAudioPlayer->seekTo(videoTimeUs < 0 ? mSeekTimeUs : videoTimeUs);
mWatchForAudioSeekComplete = true;
+ mWatchForAudioEOS = true;
} else if (!mSeekNotificationSent) {
// If we're playing video only, report seek complete now,
// otherwise audio player will notify us later.
@@ -1377,6 +1387,11 @@ void AwesomePlayer::onVideoEvent() {
}
finishSeekIfNecessary(-1);
+ if (mAudioPlayer != NULL
+ && !(mFlags & (AUDIO_RUNNING | SEEK_PREVIEW))) {
+ startAudioPlayer_l();
+ }
+
mFlags |= VIDEO_AT_EOS;
postStreamDoneEvent_l(err);
return;