summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2011-03-25 13:03:14 -0700
committerAndreas Huber <andih@google.com>2011-03-25 14:47:38 -0700
commit5dac87b088556b8ed7f2a4f5546d31be0bb68680 (patch)
tree98ea42e6bde58e3b8738b125e696aa93ae1d0743 /media
parent75ae0de858be5cddf60b70d3056e393aa12b224e (diff)
downloadframeworks_av-5dac87b088556b8ed7f2a4f5546d31be0bb68680.zip
frameworks_av-5dac87b088556b8ed7f2a4f5546d31be0bb68680.tar.gz
frameworks_av-5dac87b088556b8ed7f2a4f5546d31be0bb68680.tar.bz2
Make sure we post a video event when seeking after seeing video EOS before.
Change-Id: I513bf94c0732a85324160977ea5723d8aafd6aba related-to-bug: 3316960
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 435a1b0..37a93a4 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(
@@ -1052,7 +1052,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) {
@@ -1094,6 +1095,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;
@@ -1277,6 +1286,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.
@@ -1367,6 +1377,11 @@ void AwesomePlayer::onVideoEvent() {
}
finishSeekIfNecessary(-1);
+ if (mAudioPlayer != NULL
+ && !(mFlags & (AUDIO_RUNNING | SEEK_PREVIEW))) {
+ startAudioPlayer_l();
+ }
+
mFlags |= VIDEO_AT_EOS;
postStreamDoneEvent_l(err);
return;