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

Commit 6575313c authored by huiy's avatar huiy Committed by Linux Build Service Account
Browse files

NuPlayer:RTSP: Fix some issues while seeking RTSP source

- Some Q6-based platforms observe green frames on seek
- Clear the obsolete packets after sending the seek request
- Stop queueing any obsolete units to source while seeking

CRs-Fixed: 623269
Change-Id: I432de355d8e601a4d434cb78c699043dea2c6b55
parent 8cb0c038
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -322,6 +322,15 @@ void NuPlayer::RTSPSource::performSeek(int64_t seekTimeUs) {

    mState = SEEKING;
    mHandler->seek(seekTimeUs);

    // After seek, the previous packets in the source are obsolete, so clear them
    for (size_t index = 0; index < mTracks.size(); index++) {
        TrackInfo *info = &mTracks.editItemAt(index);
        sp<AnotherPacketSource> source = info->mSource;
        if (source != NULL) {
            source->queueDiscontinuity(ATSParser::DISCONTINUITY_SEEK, NULL, true);
        }
    }
}

void NuPlayer::RTSPSource::onMessageReceived(const sp<AMessage> &msg) {
@@ -388,6 +397,11 @@ void NuPlayer::RTSPSource::onMessageReceived(const sp<AMessage> &msg) {

        case MyHandler::kWhatAccessUnit:
        {
            // While seeking, stop queueing the units which are already obsolete to the source
            if (mState == SEEKING) {
                break;
            }

            size_t trackIndex;
            CHECK(msg->findSize("trackIndex", &trackIndex));

+9 −0
Original line number Diff line number Diff line
@@ -1242,6 +1242,15 @@ struct MyHandler : public AHandler {
                request.append("\r\n");

                mConn->sendRequest(request.c_str(), reply);

                // After seek, the previous packets are obsolete
                for (int i = 0; i < mTracks.size(); i++) {
                    TrackInfo *track = &mTracks.editItemAt(i);
                    if (!track->mPackets.empty()) {
                        track->mPackets.clear();
                    }
                }

                break;
            }