Loading media/libmediaplayerservice/nuplayer/NuPlayer.cpp +21 −9 Original line number Diff line number Diff line Loading @@ -186,6 +186,7 @@ NuPlayer::NuPlayer() mPlaybackSettings(AUDIO_PLAYBACK_RATE_DEFAULT), mVideoFpsHint(-1.f), mStarted(false), mSourceStarted(false), mPaused(false), mPausedByClient(false), mPausedForBuffering(false) { Loading Loading @@ -1010,6 +1011,7 @@ void NuPlayer::onMessageReceived(const sp<AMessage> &msg) { // Widevine source reads must stop before releasing the video decoder. if (!audio && mSource != NULL && mSourceFlags & Source::FLAG_SECURE) { mSource->stop(); mSourceStarted = false; } getDecoder(audio)->initiateShutdown(); // In the middle of a seek. *flushing = SHUTTING_DOWN_DECODER; // Shut down. Loading Loading @@ -1158,11 +1160,12 @@ void NuPlayer::onMessageReceived(const sp<AMessage> &msg) { // 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. // Audio-only cases are handled separately. onStart(seekTimeUs); if (mStarted) { onPause(); mPausedByClient = true; } if (needNotify) { notifyDriverSeekComplete(); } Loading Loading @@ -1263,16 +1266,22 @@ status_t NuPlayer::onInstantiateSecureDecoders() { } void NuPlayer::onStart(int64_t startPositionUs) { mOffloadAudio = false; mAudioEOS = false; mVideoEOS = false; mStarted = true; if (!mSourceStarted) { mSourceStarted = true; mSource->start(); } if (startPositionUs > 0) { performSeek(startPositionUs); if (mSource->getFormat(false /* audio */) == NULL) { return; } } mOffloadAudio = false; mAudioEOS = false; mVideoEOS = false; mStarted = true; uint32_t flags = 0; if (mSource->isRealTime()) { Loading Loading @@ -1305,6 +1314,7 @@ void NuPlayer::onStart(int64_t startPositionUs) { status_t err = mRenderer->setPlaybackSettings(mPlaybackSettings); if (err != OK) { mSource->stop(); mSourceStarted = false; notifyListener(MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, err); return; } Loading Loading @@ -1372,6 +1382,7 @@ void NuPlayer::handleFlushComplete(bool audio, bool isDecoder) { // Widevine source reads must stop before releasing the video decoder. if (mSource != NULL && mSourceFlags & Source::FLAG_SECURE) { mSource->stop(); mSourceStarted = false; } } getDecoder(audio)->initiateShutdown(); Loading Loading @@ -1871,6 +1882,7 @@ void NuPlayer::performReset() { } mStarted = false; mSourceStarted = false; } void NuPlayer::performScanSources() { Loading media/libmediaplayerservice/nuplayer/NuPlayer.h +1 −0 Original line number Diff line number Diff line Loading @@ -194,6 +194,7 @@ private: AVSyncSettings mSyncSettings; float mVideoFpsHint; bool mStarted; bool mSourceStarted; // Actual pause state, either as requested by client or due to buffering. bool mPaused; Loading Loading
media/libmediaplayerservice/nuplayer/NuPlayer.cpp +21 −9 Original line number Diff line number Diff line Loading @@ -186,6 +186,7 @@ NuPlayer::NuPlayer() mPlaybackSettings(AUDIO_PLAYBACK_RATE_DEFAULT), mVideoFpsHint(-1.f), mStarted(false), mSourceStarted(false), mPaused(false), mPausedByClient(false), mPausedForBuffering(false) { Loading Loading @@ -1010,6 +1011,7 @@ void NuPlayer::onMessageReceived(const sp<AMessage> &msg) { // Widevine source reads must stop before releasing the video decoder. if (!audio && mSource != NULL && mSourceFlags & Source::FLAG_SECURE) { mSource->stop(); mSourceStarted = false; } getDecoder(audio)->initiateShutdown(); // In the middle of a seek. *flushing = SHUTTING_DOWN_DECODER; // Shut down. Loading Loading @@ -1158,11 +1160,12 @@ void NuPlayer::onMessageReceived(const sp<AMessage> &msg) { // 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. // Audio-only cases are handled separately. onStart(seekTimeUs); if (mStarted) { onPause(); mPausedByClient = true; } if (needNotify) { notifyDriverSeekComplete(); } Loading Loading @@ -1263,16 +1266,22 @@ status_t NuPlayer::onInstantiateSecureDecoders() { } void NuPlayer::onStart(int64_t startPositionUs) { mOffloadAudio = false; mAudioEOS = false; mVideoEOS = false; mStarted = true; if (!mSourceStarted) { mSourceStarted = true; mSource->start(); } if (startPositionUs > 0) { performSeek(startPositionUs); if (mSource->getFormat(false /* audio */) == NULL) { return; } } mOffloadAudio = false; mAudioEOS = false; mVideoEOS = false; mStarted = true; uint32_t flags = 0; if (mSource->isRealTime()) { Loading Loading @@ -1305,6 +1314,7 @@ void NuPlayer::onStart(int64_t startPositionUs) { status_t err = mRenderer->setPlaybackSettings(mPlaybackSettings); if (err != OK) { mSource->stop(); mSourceStarted = false; notifyListener(MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, err); return; } Loading Loading @@ -1372,6 +1382,7 @@ void NuPlayer::handleFlushComplete(bool audio, bool isDecoder) { // Widevine source reads must stop before releasing the video decoder. if (mSource != NULL && mSourceFlags & Source::FLAG_SECURE) { mSource->stop(); mSourceStarted = false; } } getDecoder(audio)->initiateShutdown(); Loading Loading @@ -1871,6 +1882,7 @@ void NuPlayer::performReset() { } mStarted = false; mSourceStarted = false; } void NuPlayer::performScanSources() { Loading
media/libmediaplayerservice/nuplayer/NuPlayer.h +1 −0 Original line number Diff line number Diff line Loading @@ -194,6 +194,7 @@ private: AVSyncSettings mSyncSettings; float mVideoFpsHint; bool mStarted; bool mSourceStarted; // Actual pause state, either as requested by client or due to buffering. bool mPaused; Loading