Merge "Make sure we post a video event when seeking after seeing video EOS before." into honeycomb-mr1
This commit is contained in:
committed by
Android (Google) Code Review
commit
1457ef74d4
@@ -575,7 +575,7 @@ void AwesomePlayer::onVideoLagUpdate() {
|
|||||||
int64_t audioTimeUs = mAudioPlayer->getMediaTimeUs();
|
int64_t audioTimeUs = mAudioPlayer->getMediaTimeUs();
|
||||||
int64_t videoLateByUs = audioTimeUs - mVideoTimeUs;
|
int64_t videoLateByUs = audioTimeUs - mVideoTimeUs;
|
||||||
|
|
||||||
if (videoLateByUs > 300000ll) {
|
if (!(mFlags & VIDEO_AT_EOS) && videoLateByUs > 300000ll) {
|
||||||
LOGV("video late by %lld ms.", videoLateByUs / 1000ll);
|
LOGV("video late by %lld ms.", videoLateByUs / 1000ll);
|
||||||
|
|
||||||
notifyListener_l(
|
notifyListener_l(
|
||||||
@@ -1052,7 +1052,8 @@ status_t AwesomePlayer::getPosition(int64_t *positionUs) {
|
|||||||
}
|
}
|
||||||
else if (mSeeking != NO_SEEK) {
|
else if (mSeeking != NO_SEEK) {
|
||||||
*positionUs = mSeekTimeUs;
|
*positionUs = mSeekTimeUs;
|
||||||
} else if (mVideoSource != NULL) {
|
} else if (mVideoSource != NULL
|
||||||
|
&& (mAudioPlayer == NULL || !(mFlags & VIDEO_AT_EOS))) {
|
||||||
Mutex::Autolock autoLock(mMiscStateLock);
|
Mutex::Autolock autoLock(mMiscStateLock);
|
||||||
*positionUs = mVideoTimeUs;
|
*positionUs = mVideoTimeUs;
|
||||||
} else if (mAudioPlayer != NULL) {
|
} else if (mAudioPlayer != NULL) {
|
||||||
@@ -1094,6 +1095,14 @@ status_t AwesomePlayer::seekTo_l(int64_t timeUs) {
|
|||||||
play_l();
|
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;
|
mSeeking = SEEK;
|
||||||
mSeekNotificationSent = false;
|
mSeekNotificationSent = false;
|
||||||
mSeekTimeUs = timeUs;
|
mSeekTimeUs = timeUs;
|
||||||
@@ -1277,6 +1286,7 @@ void AwesomePlayer::finishSeekIfNecessary(int64_t videoTimeUs) {
|
|||||||
|
|
||||||
mAudioPlayer->seekTo(videoTimeUs < 0 ? mSeekTimeUs : videoTimeUs);
|
mAudioPlayer->seekTo(videoTimeUs < 0 ? mSeekTimeUs : videoTimeUs);
|
||||||
mWatchForAudioSeekComplete = true;
|
mWatchForAudioSeekComplete = true;
|
||||||
|
mWatchForAudioEOS = true;
|
||||||
} else if (!mSeekNotificationSent) {
|
} else if (!mSeekNotificationSent) {
|
||||||
// If we're playing video only, report seek complete now,
|
// If we're playing video only, report seek complete now,
|
||||||
// otherwise audio player will notify us later.
|
// otherwise audio player will notify us later.
|
||||||
@@ -1367,6 +1377,11 @@ void AwesomePlayer::onVideoEvent() {
|
|||||||
}
|
}
|
||||||
finishSeekIfNecessary(-1);
|
finishSeekIfNecessary(-1);
|
||||||
|
|
||||||
|
if (mAudioPlayer != NULL
|
||||||
|
&& !(mFlags & (AUDIO_RUNNING | SEEK_PREVIEW))) {
|
||||||
|
startAudioPlayer_l();
|
||||||
|
}
|
||||||
|
|
||||||
mFlags |= VIDEO_AT_EOS;
|
mFlags |= VIDEO_AT_EOS;
|
||||||
postStreamDoneEvent_l(err);
|
postStreamDoneEvent_l(err);
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user