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

Commit d5766875 authored by Eric Laurent's avatar Eric Laurent
Browse files

AwesomePlayer: fix concurrent pause and teardown

There was a race condition if a pause request was received
while we were executing a teardown event. Although we hold
a mutex while processing the teardown event, there is a step
of the prepare sequence where we release the mutex if streaming.
In this case, the pause request is executed but ignored because
the player state is still preparing. At the end of the teardown
event processing we restore previous playback state and resume.

The fix consists in clearing the saved teardown playback state
when a pause request is received while processing a teardown event.

Bug: 11225491.
Change-Id: If0e61855ce5a336322f1ba8e5559bdc190beeb76
parent 014e7fa2
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -1225,6 +1225,12 @@ status_t AwesomePlayer::pause() {

status_t AwesomePlayer::pause_l(bool at_eos) {
    if (!(mFlags & PLAYING)) {
        if (mAudioTearDown && mAudioTearDownWasPlaying) {
            ALOGV("pause_l() during teardown and finishSetDataSource_l() mFlags %x" , mFlags);
            mAudioTearDownWasPlaying = false;
            notifyListener_l(MEDIA_PAUSED);
            mMediaRenderingStartGeneration = ++mStartGeneration;
        }
        return OK;
    }