From 4486f97b6652b6b111a809827355b6ce5bf9c21e Mon Sep 17 00:00:00 2001 From: Weiyin Jiang Date: Wed, 6 Jan 2016 15:49:06 +0800 Subject: nuplayer: looping playback only if it was running Audio buffer filling in renderer is still happening, though pause was issued. As a result, EOS was reported irrespective of renderer state. If nuplayer driver receives playback complete after stopped, it will again be activated, which appears stop is not taking effect. Add a check for driver state to allow looping only if it was in running state. Change-Id: Ic9f8eac635a774cd805b3978fab640d73ae35744 CRs-Fixed: 958311 --- media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'media/libmediaplayerservice') diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp index 7c71e4e..4383fce 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp +++ b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp @@ -750,12 +750,19 @@ void NuPlayerDriver::notifyListener_l( } } if (mLooping || mAutoLoop) { - mPlayer->seekToAsync(0); - if (mAudioSink != NULL) { - // The renderer has stopped the sink at the end in order to play out - // the last little bit of audio. If we're looping, we need to restart it. - mAudioSink->start(); + if (mState == STATE_RUNNING) { + mPlayer->seekToAsync(0); + if (mAudioSink != NULL) { + // The renderer has stopped the sink at the end in order to play out + // the last little bit of audio. If we're looping, we need to restart it. + mAudioSink->start(); + } + } else { + mPlayer->pause(); + mState = STATE_PAUSED; + mAtEOS = true; } + // don't send completion event when looping return; } -- cgit v1.1