summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorWei Jia <wjia@google.com>2014-09-24 04:13:05 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-09-24 04:13:05 +0000
commitd996c4698bda072866d77bac9e9a7685a2c9349b (patch)
treed55f62a5aefbf1aad1fd9ccaa91c919268dbf3f1 /media
parentde979d88917cceb96581f82be9ef95c6bdc625ed (diff)
parentfc55783d0886d5dbaa234f85a4313796d9ef1df4 (diff)
downloadframeworks_av-d996c4698bda072866d77bac9e9a7685a2c9349b.zip
frameworks_av-d996c4698bda072866d77bac9e9a7685a2c9349b.tar.gz
frameworks_av-d996c4698bda072866d77bac9e9a7685a2c9349b.tar.bz2
am fc55783d: Merge "NuPlayer will notify SeekComplete only when requested so." into lmp-dev
* commit 'fc55783d0886d5dbaa234f85a4313796d9ef1df4': NuPlayer will notify SeekComplete only when requested so.
Diffstat (limited to 'media')
-rw-r--r--media/libmediaplayerservice/nuplayer/NuPlayer.cpp35
-rw-r--r--media/libmediaplayerservice/nuplayer/NuPlayer.h7
-rw-r--r--media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp6
3 files changed, 29 insertions, 19 deletions
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
index 2ea12ae..ceedb40 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
@@ -64,16 +64,18 @@ private:
};
struct NuPlayer::SeekAction : public Action {
- SeekAction(int64_t seekTimeUs)
- : mSeekTimeUs(seekTimeUs) {
+ SeekAction(int64_t seekTimeUs, bool needNotify)
+ : mSeekTimeUs(seekTimeUs),
+ mNeedNotify(needNotify) {
}
virtual void execute(NuPlayer *player) {
- player->performSeek(mSeekTimeUs);
+ player->performSeek(mSeekTimeUs, mNeedNotify);
}
private:
int64_t mSeekTimeUs;
+ bool mNeedNotify;
DISALLOW_EVIL_CONSTRUCTORS(SeekAction);
};
@@ -324,9 +326,10 @@ void NuPlayer::resetAsync() {
(new AMessage(kWhatReset, id()))->post();
}
-void NuPlayer::seekToAsync(int64_t seekTimeUs) {
+void NuPlayer::seekToAsync(int64_t seekTimeUs, bool needNotify) {
sp<AMessage> msg = new AMessage(kWhatSeek, id());
msg->setInt64("seekTimeUs", seekTimeUs);
+ msg->setInt32("needNotify", needNotify);
msg->post();
}
@@ -561,7 +564,8 @@ void NuPlayer::onMessageReceived(const sp<AMessage> &msg) {
// the extractor may not yet be started and will assert.
// If the video decoder is not set (perhaps audio only in this case)
// do not perform a seek as it is not needed.
- mDeferredActions.push_back(new SeekAction(mCurrentPositionUs));
+ mDeferredActions.push_back(
+ new SeekAction(mCurrentPositionUs, false /* needNotify */));
}
// If there is a new surface texture, instantiate decoders
@@ -940,7 +944,7 @@ void NuPlayer::onMessageReceived(const sp<AMessage> &msg) {
mRenderer->signalDisableOffloadAudio();
mOffloadAudio = false;
- performSeek(positionUs);
+ performSeek(positionUs, false /* needNotify */);
instantiateDecoder(true /* audio */, &mAudioDecoder);
}
break;
@@ -969,14 +973,18 @@ void NuPlayer::onMessageReceived(const sp<AMessage> &msg) {
case kWhatSeek:
{
int64_t seekTimeUs;
+ int32_t needNotify;
CHECK(msg->findInt64("seekTimeUs", &seekTimeUs));
+ CHECK(msg->findInt32("needNotify", &needNotify));
- ALOGV("kWhatSeek seekTimeUs=%lld us", seekTimeUs);
+ ALOGV("kWhatSeek seekTimeUs=%lld us, needNotify=%d",
+ seekTimeUs, needNotify);
mDeferredActions.push_back(
new SimpleAction(&NuPlayer::performDecoderFlush));
- mDeferredActions.push_back(new SeekAction(seekTimeUs));
+ mDeferredActions.push_back(
+ new SeekAction(seekTimeUs, needNotify));
processDeferredActions();
break;
@@ -1802,10 +1810,11 @@ void NuPlayer::processDeferredActions() {
}
}
-void NuPlayer::performSeek(int64_t seekTimeUs) {
- ALOGV("performSeek seekTimeUs=%lld us (%.2f secs)",
+void NuPlayer::performSeek(int64_t seekTimeUs, bool needNotify) {
+ ALOGV("performSeek seekTimeUs=%lld us (%.2f secs), needNotify(%d)",
seekTimeUs,
- seekTimeUs / 1E6);
+ seekTimeUs / 1E6,
+ needNotify);
if (mSource == NULL) {
// This happens when reset occurs right before the loop mode
@@ -1822,7 +1831,9 @@ void NuPlayer::performSeek(int64_t seekTimeUs) {
sp<NuPlayerDriver> driver = mDriver.promote();
if (driver != NULL) {
driver->notifyPosition(seekTimeUs);
- driver->notifySeekComplete();
+ if (needNotify) {
+ driver->notifySeekComplete();
+ }
}
}
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.h b/media/libmediaplayerservice/nuplayer/NuPlayer.h
index eee96ca..8fa7269 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayer.h
+++ b/media/libmediaplayerservice/nuplayer/NuPlayer.h
@@ -59,8 +59,9 @@ struct NuPlayer : public AHandler {
// Will notify the driver through "notifyResetComplete" once finished.
void resetAsync();
- // Will notify the driver through "notifySeekComplete" once finished.
- void seekToAsync(int64_t seekTimeUs);
+ // Will notify the driver through "notifySeekComplete" once finished
+ // and needNotify is true.
+ void seekToAsync(int64_t seekTimeUs, bool needNotify = false);
status_t setVideoScalingMode(int32_t mode);
status_t getTrackInfo(Parcel* reply) const;
@@ -215,7 +216,7 @@ private:
void processDeferredActions();
- void performSeek(int64_t seekTimeUs);
+ void performSeek(int64_t seekTimeUs, bool needNotify);
void performDecoderFlush();
void performDecoderShutdown(bool audio, bool video);
void performReset();
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp
index 7ec9876..a9bca49 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp
@@ -240,9 +240,7 @@ status_t NuPlayerDriver::start() {
mPlayer->start();
if (mStartupSeekTimeUs >= 0) {
- if (mStartupSeekTimeUs == 0) {
- notifySeekComplete_l();
- } else {
+ if (mStartupSeekTimeUs > 0) {
mPlayer->seekToAsync(mStartupSeekTimeUs);
}
@@ -369,7 +367,7 @@ status_t NuPlayerDriver::seekTo(int msec) {
mAtEOS = false;
// seeks can take a while, so we essentially paused
notifyListener_l(MEDIA_PAUSED);
- mPlayer->seekToAsync(seekTimeUs);
+ mPlayer->seekToAsync(seekTimeUs, true /* needNotify */);
break;
}