NuPlayer: Discard seeks when source and decoders are NULL
Problem occurs when loop mode asynchronously seeks to the
start of the source after a MediaPlayer::reset().
Bug: 17379148
Change-Id: I50bfe65a753afffb1d478db54c76067a9c61a0ae
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
index ae22123..cf4757e 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
@@ -1665,6 +1665,14 @@
seekTimeUs,
seekTimeUs / 1E6);
+ if (mSource == NULL) {
+ // This happens when reset occurs right before the loop mode
+ // asynchronously seeks to the start of the stream.
+ LOG_ALWAYS_FATAL_IF(mAudioDecoder != NULL || mVideoDecoder != NULL,
+ "mSource is NULL and decoders not NULL audio(%p) video(%p)",
+ mAudioDecoder.get(), mVideoDecoder.get());
+ return;
+ }
mSource->seekTo(seekTimeUs);
++mTimedTextGeneration;
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp
index 2423f5f..09324ae 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp
@@ -626,7 +626,7 @@
switch (msg) {
case MEDIA_PLAYBACK_COMPLETE:
{
- if (mLooping) {
+ if (mLooping && mState != STATE_RESET_IN_PROGRESS) {
mLock.unlock();
mPlayer->seekToAsync(0);
mLock.lock();