notify seek complete upon first video output frame
Bug: 18541814
Change-Id: Ie4e0976885f26eb253460eab371cb181ea85f2db
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp
index 0439a9a..012d33e 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp
@@ -58,6 +58,7 @@
mFormatChangePending(false),
mBufferGeneration(0),
mPaused(true),
+ mResumePending(false),
mComponentName("decoder") {
mCodecLooper = new ALooper;
mCodecLooper->setName("NPDecoder-CL");
@@ -208,6 +209,7 @@
requestCodecNotification();
}
mPaused = false;
+ mResumePending = false;
}
void NuPlayer::Decoder::onSetRenderer(const sp<Renderer> &renderer) {
@@ -226,8 +228,12 @@
}
}
-void NuPlayer::Decoder::onResume() {
+void NuPlayer::Decoder::onResume(bool notifyComplete) {
mPaused = false;
+
+ if (notifyComplete) {
+ mResumePending = true;
+ }
}
void NuPlayer::Decoder::onFlush(bool notifyComplete) {
@@ -265,6 +271,10 @@
void NuPlayer::Decoder::onShutdown(bool notifyComplete) {
status_t err = OK;
+
+ // if there is a pending resume request, notify complete now
+ notifyResumeCompleteIfNecessary();
+
if (mCodec != NULL) {
err = mCodec->release();
mCodec = NULL;
@@ -494,6 +504,9 @@
mSkipRenderingUntilMediaTimeUs = -1;
}
+ // wait until 1st frame comes out to signal resume complete
+ notifyResumeCompleteIfNecessary();
+
if (mRenderer != NULL) {
// send the buffer to renderer.
mRenderer->queueBuffer(mIsAudio, buffer, reply);
@@ -884,5 +897,15 @@
}
}
+void NuPlayer::Decoder::notifyResumeCompleteIfNecessary() {
+ if (mResumePending) {
+ mResumePending = false;
+
+ sp<AMessage> notify = mNotify->dup();
+ notify->setInt32("what", kWhatResumeCompleted);
+ notify->post();
+ }
+}
+
} // namespace android