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

Commit 5b297ba7 authored by Lajos Molnar's avatar Lajos Molnar Committed by Android Git Automerger
Browse files

am 67a10c52: Merge "httplive: clear access units before returning from seekTo." into klp-dev

* commit '67a10c52':
  httplive: clear access units before returning from seekTo.
parents bd77a1b5 67a10c52
Loading
Loading
Loading
Loading
+19 −7
Original line number Original line Diff line number Diff line
@@ -67,7 +67,8 @@ LiveSession::LiveSession(
      mRealTimeBaseUs(0ll),
      mRealTimeBaseUs(0ll),
      mReconfigurationInProgress(false),
      mReconfigurationInProgress(false),
      mSwitchInProgress(false),
      mSwitchInProgress(false),
      mDisconnectReplyID(0) {
      mDisconnectReplyID(0),
      mSeekReplyID(0) {
    if (mUIDValid) {
    if (mUIDValid) {
        mHTTPDataSource->setUID(mUID);
        mHTTPDataSource->setUID(mUID);
    }
    }
@@ -234,6 +235,10 @@ status_t LiveSession::seekTo(int64_t timeUs) {
    sp<AMessage> response;
    sp<AMessage> response;
    status_t err = msg->postAndAwaitResponse(&response);
    status_t err = msg->postAndAwaitResponse(&response);


    uint32_t replyID;
    CHECK(response == mSeekReply && 0 != mSeekReplyID);
    mSeekReply.clear();
    mSeekReplyID = 0;
    return err;
    return err;
}
}


@@ -259,15 +264,12 @@ void LiveSession::onMessageReceived(const sp<AMessage> &msg) {


        case kWhatSeek:
        case kWhatSeek:
        {
        {
            uint32_t replyID;
            CHECK(msg->senderAwaitsResponse(&mSeekReplyID));
            CHECK(msg->senderAwaitsResponse(&replyID));


            status_t err = onSeek(msg);
            status_t err = onSeek(msg);


            sp<AMessage> response = new AMessage;
            mSeekReply = new AMessage;
            response->setInt32("err", err);
            mSeekReply->setInt32("err", err);

            response->postReply(replyID);
            break;
            break;
        }
        }


@@ -297,6 +299,11 @@ void LiveSession::onMessageReceived(const sp<AMessage> &msg) {
                        CHECK_GT(mContinuationCounter, 0);
                        CHECK_GT(mContinuationCounter, 0);
                        if (--mContinuationCounter == 0) {
                        if (--mContinuationCounter == 0) {
                            mContinuation->post();
                            mContinuation->post();

                            if (mSeekReplyID != 0) {
                                CHECK(mSeekReply != NULL);
                                mSeekReply->postReply(mSeekReplyID);
                            }
                        }
                        }
                    }
                    }
                    break;
                    break;
@@ -1035,6 +1042,11 @@ void LiveSession::changeConfiguration(


    if (mContinuationCounter == 0) {
    if (mContinuationCounter == 0) {
        msg->post();
        msg->post();

        if (mSeekReplyID != 0) {
            CHECK(mSeekReply != NULL);
            mSeekReply->postReply(mSeekReplyID);
        }
    }
    }
}
}


+2 −0
Original line number Original line Diff line number Diff line
@@ -175,6 +175,7 @@ private:


    size_t mContinuationCounter;
    size_t mContinuationCounter;
    sp<AMessage> mContinuation;
    sp<AMessage> mContinuation;
    sp<AMessage> mSeekReply;


    int64_t mLastDequeuedTimeUs;
    int64_t mLastDequeuedTimeUs;
    int64_t mRealTimeBaseUs;
    int64_t mRealTimeBaseUs;
@@ -182,6 +183,7 @@ private:
    bool mReconfigurationInProgress;
    bool mReconfigurationInProgress;
    bool mSwitchInProgress;
    bool mSwitchInProgress;
    uint32_t mDisconnectReplyID;
    uint32_t mDisconnectReplyID;
    uint32_t mSeekReplyID;


    sp<PlaylistFetcher> addFetcher(const char *uri);
    sp<PlaylistFetcher> addFetcher(const char *uri);


+19 −6
Original line number Original line Diff line number Diff line
@@ -364,8 +364,10 @@ void PlaylistFetcher::pauseAsync() {
    (new AMessage(kWhatPause, id()))->post();
    (new AMessage(kWhatPause, id()))->post();
}
}


void PlaylistFetcher::stopAsync() {
void PlaylistFetcher::stopAsync(bool selfTriggered) {
    (new AMessage(kWhatStop, id()))->post();
    sp<AMessage> msg = new AMessage(kWhatStop, id());
    msg->setInt32("selfTriggered", selfTriggered);
    msg->post();
}
}


void PlaylistFetcher::resumeUntilAsync(const sp<AMessage> &params) {
void PlaylistFetcher::resumeUntilAsync(const sp<AMessage> &params) {
@@ -399,7 +401,7 @@ void PlaylistFetcher::onMessageReceived(const sp<AMessage> &msg) {


        case kWhatStop:
        case kWhatStop:
        {
        {
            onStop();
            onStop(msg);


            sp<AMessage> notify = mNotify->dup();
            sp<AMessage> notify = mNotify->dup();
            notify->setInt32("what", kWhatStopped);
            notify->setInt32("what", kWhatStopped);
@@ -498,9 +500,20 @@ void PlaylistFetcher::onPause() {
    cancelMonitorQueue();
    cancelMonitorQueue();
}
}


void PlaylistFetcher::onStop() {
void PlaylistFetcher::onStop(const sp<AMessage> &msg) {
    cancelMonitorQueue();
    cancelMonitorQueue();


    int32_t selfTriggered;
    CHECK(msg->findInt32("selfTriggered", &selfTriggered));
    if (!selfTriggered) {
        // Self triggered stops only happen during switching, in which case we do not want
        // to clear the discontinuities queued at the end of packet sources.
        for (size_t i = 0; i < mPacketSources.size(); i++) {
            sp<AnotherPacketSource> packetSource = mPacketSources.valueAt(i);
            packetSource->clear();
        }
    }

    mPacketSources.clear();
    mPacketSources.clear();
    mStreamTypeMask = 0;
    mStreamTypeMask = 0;
}
}
@@ -552,7 +565,7 @@ status_t PlaylistFetcher::onResumeUntil(const sp<AMessage> &msg) {
        for (size_t i = 0; i < mPacketSources.size(); i++) {
        for (size_t i = 0; i < mPacketSources.size(); i++) {
            mPacketSources.valueAt(i)->queueAccessUnit(mSession->createFormatChangeBuffer());
            mPacketSources.valueAt(i)->queueAccessUnit(mSession->createFormatChangeBuffer());
        }
        }
        stopAsync();
        stopAsync(/* selfTriggered = */ true);
        return OK;
        return OK;
    }
    }


@@ -866,7 +879,7 @@ void PlaylistFetcher::onDownloadNext() {


    if (err == ERROR_OUT_OF_RANGE) {
    if (err == ERROR_OUT_OF_RANGE) {
        // reached stopping point
        // reached stopping point
        stopAsync();
        stopAsync(/* selfTriggered = */ true);
        return;
        return;
    }
    }


+2 −2
Original line number Original line Diff line number Diff line
@@ -63,7 +63,7 @@ struct PlaylistFetcher : public AHandler {


    void pauseAsync();
    void pauseAsync();


    void stopAsync();
    void stopAsync(bool selfTriggered = false);


    void resumeUntilAsync(const sp<AMessage> &params);
    void resumeUntilAsync(const sp<AMessage> &params);


@@ -162,7 +162,7 @@ private:


    status_t onStart(const sp<AMessage> &msg);
    status_t onStart(const sp<AMessage> &msg);
    void onPause();
    void onPause();
    void onStop();
    void onStop(const sp<AMessage> &msg);
    void onMonitorQueue();
    void onMonitorQueue();
    void onDownloadNext();
    void onDownloadNext();