summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/AwesomePlayer.cpp
diff options
context:
space:
mode:
authorLajos Molnar <lajos@google.com>2013-09-25 08:09:41 -0700
committerLajos Molnar <lajos@google.com>2013-09-30 15:12:23 -0700
commit6218fdc2bef7b9c912bc4d132c12ee43b7b2dd37 (patch)
tree5ef5c0ecca29a36a6ebb3cc8569ff6ef4cac8c50 /media/libstagefright/AwesomePlayer.cpp
parent3d97e23fcd78f752443cb6c30a1ee39f49f1f987 (diff)
downloadframeworks_av-6218fdc2bef7b9c912bc4d132c12ee43b7b2dd37.zip
frameworks_av-6218fdc2bef7b9c912bc4d132c12ee43b7b2dd37.tar.gz
frameworks_av-6218fdc2bef7b9c912bc4d132c12ee43b7b2dd37.tar.bz2
MediaTimeProvider support fixes
Add MEDIA_SKIPPED event when resuming at a different time than seeked to. Send MEDIA_STARTED/PAUSED events only when playing (vs. when doing seek previews) Change-Id: I243ebf054303755ea8863229c3211694f2c204a7 Signed-off-by: Lajos Molnar <lajos@google.com> Bug: 10954008
Diffstat (limited to 'media/libstagefright/AwesomePlayer.cpp')
-rw-r--r--media/libstagefright/AwesomePlayer.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp
index 3b516af..e7cfc78 100644
--- a/media/libstagefright/AwesomePlayer.cpp
+++ b/media/libstagefright/AwesomePlayer.cpp
@@ -1413,8 +1413,10 @@ status_t AwesomePlayer::seekTo_l(int64_t timeUs) {
mSeekTimeUs = timeUs;
modifyFlags((AT_EOS | AUDIO_AT_EOS | VIDEO_AT_EOS), CLEAR);
- notifyListener_l(MEDIA_PAUSED);
- mMediaRenderingStartGeneration = ++mStartGeneration;
+ if (mFlags & PLAYING) {
+ notifyListener_l(MEDIA_PAUSED);
+ mMediaRenderingStartGeneration = ++mStartGeneration;
+ }
seekAudioIfNecessary_l();
@@ -1659,6 +1661,16 @@ void AwesomePlayer::finishSeekIfNecessary(int64_t videoTimeUs) {
return;
}
+ // If we paused, then seeked, then resumed, it is possible that we have
+ // signaled SEEK_COMPLETE at a copmletely different media time than where
+ // we are now resuming. Signal new position to media time provider.
+ // Cannot signal another SEEK_COMPLETE, as existing clients may not expect
+ // multiple SEEK_COMPLETE responses to a single seek() request.
+ if (mSeekNotificationSent && abs(mSeekTimeUs - videoTimeUs) > 10000) {
+ // notify if we are resuming more than 10ms away from desired seek time
+ notifyListener_l(MEDIA_SKIPPED);
+ }
+
if (mAudioPlayer != NULL) {
ALOGV("seeking audio to %lld us (%.2f secs).", videoTimeUs, videoTimeUs / 1E6);
@@ -1930,7 +1942,9 @@ void AwesomePlayer::onVideoEvent() {
notifyListener_l(MEDIA_INFO, MEDIA_INFO_RENDERING_START);
}
- notifyIfMediaStarted_l();
+ if (mFlags & PLAYING) {
+ notifyIfMediaStarted_l();
+ }
}
mVideoBuffer->release();