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

Commit 69deea32 authored by Ashish Jain's avatar Ashish Jain Committed by Steve Kondik
Browse files

libmediaplayerservice:Fix deadlock on gapless start failure

Issue:- Current gapless implementation starts the next clip when
MEDIA_PLAYBACK_COMPLETE event for the first clip is recieved
by MediaPlayerService.
-Even if start for next clip fails, application is notified with
MEDIA_INFO_STARTED_AS_NEXT.
- This causes the framework to trigger mediaplayer start which
again fails as it being for the same clip resulting in a deadlock
in the mediaplayer.
Fix:- Notify application with MEDIA_INFO_STARTED_AS_NEXT only when
start for the next clip is successful.

Change-Id: I77c570074c7c98c996122e275161ba88298e56fc
parent 135bd22c
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -1101,8 +1101,15 @@ void MediaPlayerService::Client::notify(
                client->mAudioOutput->switchToNextOutput();
            ALOGD("gapless:current track played back");
            ALOGD("gapless:try to do a gapless switch to next track");
            client->mNextClient->start();
            client->mNextClient->mClient->notify(MEDIA_INFO, MEDIA_INFO_STARTED_AS_NEXT, 0, obj);
            status_t ret;
            ret = client->mNextClient->start();
            if (ret == NO_ERROR) {
                client->mNextClient->mClient->notify(MEDIA_INFO,
                        MEDIA_INFO_STARTED_AS_NEXT, 0, obj);
            } else {
                client->mClient->notify(MEDIA_ERROR, MEDIA_ERROR_UNKNOWN , 0, obj);
                ALOGW("gapless:start playback for next track failed");
            }
        }
    }