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

Commit 7bd3d7d1 authored by Nicolas Catania's avatar Nicolas Catania
Browse files

Allow invoke in all the player states except idle and error.

Previously invoke would work only after prepare but not
when the player is in play or pause state (for instance).
This new change just check that the player has been initialized
and is not in the error state.

Bug:2488931
Change-Id: I9b9f3679593a3b7697c1a84d993fdcd7e1693a90
parent 84eb8d2a
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -159,8 +159,10 @@ status_t MediaPlayer::setDataSource(int fd, int64_t offset, int64_t length)
status_t MediaPlayer::invoke(const Parcel& request, Parcel *reply)
{
    Mutex::Autolock _l(mLock);
    if ((mPlayer != NULL) && ( mCurrentState & MEDIA_PLAYER_INITIALIZED ))
    {
    const bool hasBeenInitialized =
            (mCurrentState != MEDIA_PLAYER_STATE_ERROR) &&
            ((mCurrentState & MEDIA_PLAYER_IDLE) != MEDIA_PLAYER_IDLE);
    if ((mPlayer != NULL) && hasBeenInitialized) {
         LOGV("invoke %d", request.dataSize());
         return  mPlayer->invoke(request, reply);
    }