summaryrefslogtreecommitdiffstats
path: root/media/libmediaplayerservice
diff options
context:
space:
mode:
authorWei Jia <wjia@google.com>2015-08-10 15:11:54 -0700
committerWei Jia <wjia@google.com>2015-08-10 15:53:57 -0700
commit6b7d2ed40c4e7f7bac824c44795e2cd83459844c (patch)
treeeefcfb24321cce42cb0f4f025513e3cde4757e20 /media/libmediaplayerservice
parent7db7948908b21ca2d878d6882cdf1a23a121182f (diff)
downloadframeworks_av-6b7d2ed40c4e7f7bac824c44795e2cd83459844c.zip
frameworks_av-6b7d2ed40c4e7f7bac824c44795e2cd83459844c.tar.gz
frameworks_av-6b7d2ed40c4e7f7bac824c44795e2cd83459844c.tar.bz2
NuPlayer: set video surface directly when NuPlayer has not started yet.
Bug: 22119956 Change-Id: Ie174f4fc495ab8418993ff7887aaa6ae721c6008
Diffstat (limited to 'media/libmediaplayerservice')
-rw-r--r--media/libmediaplayerservice/nuplayer/NuPlayer.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
index 214315f..77b9799 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
@@ -632,10 +632,13 @@ void NuPlayer::onMessageReceived(const sp<AMessage> &msg) {
ALOGD("onSetVideoSurface(%p, %s video decoder)",
surface.get(),
- (mSource != NULL && mSource->getFormat(false /* audio */) != NULL
+ (mSource != NULL && mStarted && mSource->getFormat(false /* audio */) != NULL
&& mVideoDecoder != NULL) ? "have" : "no");
- if (mSource == NULL || mSource->getFormat(false /* audio */) == NULL
+ // Need to check mStarted before calling mSource->getFormat because NuPlayer might
+ // be in preparing state and it could take long time.
+ // When mStarted is true, mSource must have been set.
+ if (mSource == NULL || !mStarted || mSource->getFormat(false /* audio */) == NULL
// NOTE: mVideoDecoder's mSurface is always non-null
|| (mVideoDecoder != NULL && mVideoDecoder->setVideoSurface(surface) == OK)) {
performSetSurface(surface);