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

Commit b13820ff authored by Marco Nelissen's avatar Marco Nelissen
Browse files

Reject unprepared MediaPlayers

Don't allow a MediaPlayer that has been reset() or release()d to be
used as the argument to setNextMediaPlayer.

Change-Id: I47da1460ec3742f5b2bd7b79e7998b290032d5a1
parent f36dbfe3
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -811,6 +811,13 @@ status_t MediaPlayer::setNextMediaPlayer(const sp<MediaPlayer>& next) {
    if (mPlayer == NULL) {
        return NO_INIT;
    }

    if (next != NULL && !(next->mCurrentState &
            (MEDIA_PLAYER_PREPARED | MEDIA_PLAYER_PAUSED | MEDIA_PLAYER_PLAYBACK_COMPLETE))) {
        ALOGE("next player is not prepared");
        return INVALID_OPERATION;
    }

    return mPlayer->setNextPlayer(next == NULL ? NULL : next->mPlayer);
}