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

Commit 1da7ee09 authored by Robert Shih's avatar Robert Shih
Browse files

PlaylistFetcher: start queueing AUs after the 1st IDR nalu

Bug: 14159556
Change-Id: I4fc16dda9357e1251d2909571a79215d13d0104b
parent ce65a05e
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -69,6 +69,7 @@ PlaylistFetcher::PlaylistFetcher(
      mNumRetries(0),
      mStartup(true),
      mPrepared(false),
      mSkipToFirstIDRAfterConnect(false),
      mNextPTSTimeUs(-1ll),
      mMonitorQueueGeneration(0),
      mRefreshState(INITIAL_MINIMUM_RELOAD_DELAY),
@@ -1096,12 +1097,30 @@ status_t PlaylistFetcher::extractAndQueueAccessUnitsFromTs(const sp<ABuffer> &bu
            continue;
        }

        if (stream == LiveSession::STREAMTYPE_VIDEO && mVideoMime.empty()) {
            const char *mime;
            if (source->getFormat()->findCString(kKeyMIMEType, &mime)) {
                mVideoMime.setTo(mime);
                if (!strcasecmp(mime, MEDIA_MIMETYPE_VIDEO_AVC)) {
                    mSkipToFirstIDRAfterConnect = true;
                }
            }
        }

        int64_t timeUs;
        sp<ABuffer> accessUnit;
        status_t finalResult;
        while (source->hasBufferAvailable(&finalResult)
                && source->dequeueAccessUnit(&accessUnit) == OK) {

            if (stream == LiveSession::STREAMTYPE_VIDEO && mSkipToFirstIDRAfterConnect) {
                if (!IsIDR(accessUnit)) {
                    continue;
                } else {
                    mSkipToFirstIDRAfterConnect = false;
                }
            }

            CHECK(accessUnit->meta()->findInt64("timeUs", &timeUs));
            if (mMinStartTimeUs > 0) {
                if (timeUs < mMinStartTimeUs) {
+2 −0
Original line number Diff line number Diff line
@@ -98,6 +98,7 @@ private:

    sp<LiveSession> mSession;
    AString mURI;
    AString mVideoMime;

    uint32_t mStreamTypeMask;
    int64_t mStartTimeUs;
@@ -115,6 +116,7 @@ private:
    int32_t mNumRetries;
    bool mStartup;
    bool mPrepared;
    bool mSkipToFirstIDRAfterConnect;
    int64_t mNextPTSTimeUs;

    int32_t mMonitorQueueGeneration;