Loading media/libmediaplayerservice/nuplayer/NuPlayer.cpp +29 −6 Original line number Diff line number Diff line Loading @@ -1140,6 +1140,22 @@ void NuPlayer::onMessageReceived(const sp<AMessage> &msg) { ALOGV("kWhatSeek seekTimeUs=%lld us, needNotify=%d", (long long)seekTimeUs, needNotify); if (!mStarted) { // Seek before the player is started. In order to preview video, // need to start the player and pause it. This branch is called // only once if needed. After the player is started, any seek // operation will go through normal path. // All cases, including audio-only, are handled in the same way // for the sake of simplicity. onStart(seekTimeUs); onPause(); mPausedByClient = true; if (needNotify) { notifyDriverSeekComplete(); } break; } mDeferredActions.push_back( new FlushDecoderAction(FLUSH_CMD_FLUSH /* audio */, FLUSH_CMD_FLUSH /* video */)); Loading Loading @@ -1233,13 +1249,16 @@ status_t NuPlayer::onInstantiateSecureDecoders() { return OK; } void NuPlayer::onStart() { void NuPlayer::onStart(int64_t startPositionUs) { mOffloadAudio = false; mAudioEOS = false; mVideoEOS = false; mStarted = true; mSource->start(); if (startPositionUs > 0) { performSeek(startPositionUs); } uint32_t flags = 0; Loading Loading @@ -1895,6 +1914,11 @@ void NuPlayer::performResumeDecoders(bool needNotify) { void NuPlayer::finishResume() { if (mResumePending) { mResumePending = false; notifyDriverSeekComplete(); } } void NuPlayer::notifyDriverSeekComplete() { if (mDriver != NULL) { sp<NuPlayerDriver> driver = mDriver.promote(); if (driver != NULL) { Loading @@ -1902,7 +1926,6 @@ void NuPlayer::finishResume() { } } } } void NuPlayer::onSourceNotify(const sp<AMessage> &msg) { int32_t what; Loading media/libmediaplayerservice/nuplayer/NuPlayer.h +2 −1 Original line number Diff line number Diff line Loading @@ -233,7 +233,7 @@ private: void handleFlushComplete(bool audio, bool isDecoder); void finishFlushIfPossible(); void onStart(); void onStart(int64_t startPositionUs = -1); void onResume(); void onPause(); Loading @@ -242,6 +242,7 @@ private: void flushDecoder(bool audio, bool needShutdown); void finishResume(); void notifyDriverSeekComplete(); void postScanSources(); Loading media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp +2 −12 Original line number Diff line number Diff line Loading @@ -397,23 +397,13 @@ status_t NuPlayerDriver::seekTo(int msec) { switch (mState) { case STATE_PREPARED: case STATE_STOPPED_AND_PREPARED: { case STATE_PAUSED: mStartupSeekTimeUs = seekTimeUs; // pretend that the seek completed. It will actually happen when starting playback. // TODO: actually perform the seek here, so the player is ready to go at the new // location notifySeekComplete_l(); break; } // fall through. case STATE_RUNNING: case STATE_PAUSED: { mAtEOS = false; mSeekInProgress = true; if (mState == STATE_PAUSED) { mStartupSeekTimeUs = seekTimeUs; } // seeks can take a while, so we essentially paused notifyListener_l(MEDIA_PAUSED); mPlayer->seekToAsync(seekTimeUs, true /* needNotify */); Loading Loading
media/libmediaplayerservice/nuplayer/NuPlayer.cpp +29 −6 Original line number Diff line number Diff line Loading @@ -1140,6 +1140,22 @@ void NuPlayer::onMessageReceived(const sp<AMessage> &msg) { ALOGV("kWhatSeek seekTimeUs=%lld us, needNotify=%d", (long long)seekTimeUs, needNotify); if (!mStarted) { // Seek before the player is started. In order to preview video, // need to start the player and pause it. This branch is called // only once if needed. After the player is started, any seek // operation will go through normal path. // All cases, including audio-only, are handled in the same way // for the sake of simplicity. onStart(seekTimeUs); onPause(); mPausedByClient = true; if (needNotify) { notifyDriverSeekComplete(); } break; } mDeferredActions.push_back( new FlushDecoderAction(FLUSH_CMD_FLUSH /* audio */, FLUSH_CMD_FLUSH /* video */)); Loading Loading @@ -1233,13 +1249,16 @@ status_t NuPlayer::onInstantiateSecureDecoders() { return OK; } void NuPlayer::onStart() { void NuPlayer::onStart(int64_t startPositionUs) { mOffloadAudio = false; mAudioEOS = false; mVideoEOS = false; mStarted = true; mSource->start(); if (startPositionUs > 0) { performSeek(startPositionUs); } uint32_t flags = 0; Loading Loading @@ -1895,6 +1914,11 @@ void NuPlayer::performResumeDecoders(bool needNotify) { void NuPlayer::finishResume() { if (mResumePending) { mResumePending = false; notifyDriverSeekComplete(); } } void NuPlayer::notifyDriverSeekComplete() { if (mDriver != NULL) { sp<NuPlayerDriver> driver = mDriver.promote(); if (driver != NULL) { Loading @@ -1902,7 +1926,6 @@ void NuPlayer::finishResume() { } } } } void NuPlayer::onSourceNotify(const sp<AMessage> &msg) { int32_t what; Loading
media/libmediaplayerservice/nuplayer/NuPlayer.h +2 −1 Original line number Diff line number Diff line Loading @@ -233,7 +233,7 @@ private: void handleFlushComplete(bool audio, bool isDecoder); void finishFlushIfPossible(); void onStart(); void onStart(int64_t startPositionUs = -1); void onResume(); void onPause(); Loading @@ -242,6 +242,7 @@ private: void flushDecoder(bool audio, bool needShutdown); void finishResume(); void notifyDriverSeekComplete(); void postScanSources(); Loading
media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp +2 −12 Original line number Diff line number Diff line Loading @@ -397,23 +397,13 @@ status_t NuPlayerDriver::seekTo(int msec) { switch (mState) { case STATE_PREPARED: case STATE_STOPPED_AND_PREPARED: { case STATE_PAUSED: mStartupSeekTimeUs = seekTimeUs; // pretend that the seek completed. It will actually happen when starting playback. // TODO: actually perform the seek here, so the player is ready to go at the new // location notifySeekComplete_l(); break; } // fall through. case STATE_RUNNING: case STATE_PAUSED: { mAtEOS = false; mSeekInProgress = true; if (mState == STATE_PAUSED) { mStartupSeekTimeUs = seekTimeUs; } // seeks can take a while, so we essentially paused notifyListener_l(MEDIA_PAUSED); mPlayer->seekToAsync(seekTimeUs, true /* needNotify */); Loading