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

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

Enable cancelling the rtsp connection process early.

Change-Id: Ie2059c54541ad8c675944d71b39c772b0f6f04c8
related-to-bug: 3452699
parent 718dfa8d
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -399,6 +399,9 @@ void AwesomePlayer::reset_l() {
        if (mConnectingDataSource != NULL) {
            LOGI("interrupting the connection process");
            mConnectingDataSource->disconnect();
        } else if (mConnectingRTSPController != NULL) {
            LOGI("interrupting the connection process");
            mConnectingRTSPController->disconnect();
        }

        if (mFlags & PREPARING_CONNECTED) {
@@ -409,7 +412,7 @@ void AwesomePlayer::reset_l() {
    }

    if (mFlags & PREPARING) {
        LOGI("waiting until preparation is completes.");
        LOGI("waiting until preparation is completed.");
    }

    while (mFlags & PREPARING) {
@@ -1633,7 +1636,13 @@ status_t AwesomePlayer::finishSetDataSource_l() {
            mLooper->start();
        }
        mRTSPController = new ARTSPController(mLooper);
        mConnectingRTSPController = mRTSPController;

        mLock.unlock();
        status_t err = mRTSPController->connect(mUri.string());
        mLock.lock();

        mConnectingRTSPController.clear();

        LOGI("ARTSPController::connect returned %d", err);

+1 −0
Original line number Diff line number Diff line
@@ -205,6 +205,7 @@ private:

    sp<ALooper> mLooper;
    sp<ARTSPController> mRTSPController;
    sp<ARTSPController> mConnectingRTSPController;

    sp<LiveSession> mLiveSession;

+8 −1
Original line number Diff line number Diff line
@@ -69,7 +69,14 @@ status_t ARTSPController::connect(const char *url) {
void ARTSPController::disconnect() {
    Mutex::Autolock autoLock(mLock);

    if (mState != CONNECTED) {
    if (mState == CONNECTING) {
        mState = DISCONNECTED;
        mConnectionResult = ERROR_IO;
        mCondition.broadcast();

        mHandler.clear();
        return;
    } else if (mState != CONNECTED) {
        return;
    }