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

Commit eaf2c5a5 authored by Andreas Huber's avatar Andreas Huber
Browse files

If we basically finished the preparation phase and are only buffering enough...

If we basically finished the preparation phase and are only buffering enough data to start playback, cancel this early on reset().

Change-Id: I71a59d5e019e7b9ec3d9375d6231cc301ad3999b
parent 92f987a0
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -412,6 +412,12 @@ void AwesomePlayer::reset_l() {
            LOGI("interrupting the connection process");
            mConnectingDataSource->disconnect();
        }

        if (mFlags & PREPARING_CONNECTED) {
            // We are basically done preparing, we're just buffering
            // enough data to start playback, we can safely interrupt that.
            finishAsyncPrepare_l();
        }
    }

    while (mFlags & PREPARING) {
@@ -1625,7 +1631,7 @@ void AwesomePlayer::abortPrepare(status_t err) {
    }

    mPrepareResult = err;
    mFlags &= ~(PREPARING|PREPARE_CANCELLED);
    mFlags &= ~(PREPARING|PREPARE_CANCELLED|PREPARING_CONNECTED);
    mAsyncPrepareEvent = NULL;
    mPreparedCondition.broadcast();
}
@@ -1673,6 +1679,8 @@ void AwesomePlayer::onPrepareAsyncEvent() {
        }
    }

    mFlags |= PREPARING_CONNECTED;

    if (mCachedSource != NULL || mRTSPController != NULL) {
        postBufferingEvent_l();
    } else {
@@ -1692,7 +1700,7 @@ void AwesomePlayer::finishAsyncPrepare_l() {
    }

    mPrepareResult = OK;
    mFlags &= ~(PREPARING|PREPARE_CANCELLED);
    mFlags &= ~(PREPARING|PREPARE_CANCELLED|PREPARING_CONNECTED);
    mFlags |= PREPARED;
    mAsyncPrepareEvent = NULL;
    mPreparedCondition.broadcast();
+5 −0
Original line number Diff line number Diff line
@@ -111,6 +111,11 @@ private:
        AUDIO_AT_EOS        = 256,
        VIDEO_AT_EOS        = 512,
        AUTO_LOOPING        = 1024,

        // We are basically done preparing but are currently buffering
        // sufficient data to begin playback and finish the preparation phase
        // for good.
        PREPARING_CONNECTED = 2048,
    };

    mutable Mutex mLock;