Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4486f97b authored by Weiyin Jiang's avatar Weiyin Jiang Committed by Steve Kondik
Browse files

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
parent 9dae27c0
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -750,12 +750,19 @@ void NuPlayerDriver::notifyListener_l(
                    }
                }
                if (mLooping || mAutoLoop) {
                    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;
                }