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

Commit a1b71a5f authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 5357520 from 943c94e7 to qt-release

Change-Id: I2253dc39b8a63005db9ee1bec7d24504911e1ced
parents c89594a9 943c94e7
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -81,6 +81,7 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib/libmediacodecservice.so)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib/libstagefright_xmlparser@1.0.so)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib/libstagefright_soft_*)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib/vndk/libstagefright_soft_*)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib/libaudiopolicyengineconfig*)

# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
+15 −10
Original line number Diff line number Diff line
@@ -252,20 +252,25 @@ void C2SoftOpusDec::process(
    const uint8_t *data = rView.data() + inOffset;
    if (mInputBufferCount < 3) {
        if (mInputBufferCount == 0) {
            size_t opusHeadSize = inSize;
            size_t opusHeadSize = 0;
            size_t codecDelayBufSize = 0;
            size_t seekPreRollBufSize = 0;
            void *opusHeadBuf = (void *)data;
            void *opusHeadBuf = NULL;
            void *codecDelayBuf = NULL;
            void *seekPreRollBuf = NULL;

            GetOpusHeaderBuffers(data, inSize, &opusHeadBuf,
            if (!GetOpusHeaderBuffers(data, inSize, &opusHeadBuf,
                                     &opusHeadSize, &codecDelayBuf,
                                     &codecDelayBufSize, &seekPreRollBuf,
                                &seekPreRollBufSize);
                                     &seekPreRollBufSize)) {
                ALOGE("%s encountered error in GetOpusHeaderBuffers", __func__);
                mSignalledError = true;
                work->result = C2_CORRUPTED;
                return;
            }

            if (!ParseOpusHeader((uint8_t *)opusHeadBuf, opusHeadSize, &mHeader)) {
                ALOGE("Encountered error while Parsing Opus Header.");
                ALOGE("%s Encountered error while Parsing Opus Header.", __func__);
                mSignalledError = true;
                work->result = C2_CORRUPTED;
                return;
@@ -304,16 +309,16 @@ void C2SoftOpusDec::process(
                return;
            }

            if (codecDelayBuf && codecDelayBufSize == 8) {
            if (codecDelayBuf && codecDelayBufSize == sizeof(uint64_t)) {
                uint64_t value;
                memcpy(&value, codecDelayBuf, sizeof(uint64_t));
                mCodecDelay = ns_to_samples(value, kRate);
                mSamplesToDiscard = mCodecDelay;
                ++mInputBufferCount;
            }
            if (seekPreRollBuf && seekPreRollBufSize == 8) {
            if (seekPreRollBuf && seekPreRollBufSize == sizeof(uint64_t)) {
                uint64_t value;
                memcpy(&value, codecDelayBuf, sizeof(uint64_t));
                memcpy(&value, seekPreRollBuf, sizeof(uint64_t));
                mSeekPreRoll = ns_to_samples(value, kRate);
                ++mInputBufferCount;
            }
+86 −13
Original line number Diff line number Diff line
@@ -119,6 +119,9 @@ private:
    const mkvparser::BlockEntry *mBlockEntry;
    long mBlockEntryIndex;

    unsigned long mTrackType;
    void seekwithoutcue_l(int64_t seekTimeUs, int64_t *actualFrameTimeUs);

    void advance_l();

    BlockIterator(const BlockIterator &);
@@ -290,6 +293,7 @@ BlockIterator::BlockIterator(
      mCluster(NULL),
      mBlockEntry(NULL),
      mBlockEntryIndex(0) {
    mTrackType = mExtractor->mSegment->GetTracks()->GetTrackByNumber(trackNum)->GetType();
    reset();
}

@@ -442,12 +446,14 @@ void BlockIterator::seek(
        }

        if (!pCues) {
            ALOGE("No Cues in file");
            ALOGV("No Cues in file,seek without cue data");
            seekwithoutcue_l(seekTimeUs, actualFrameTimeUs);
            return;
        }
    }
    else if (!pSH) {
        ALOGE("No SeekHead");
        ALOGV("No SeekHead, seek without cue data");
        seekwithoutcue_l(seekTimeUs, actualFrameTimeUs);
        return;
    }

@@ -456,7 +462,9 @@ void BlockIterator::seek(
    while (!pCues->DoneParsing()) {
        pCues->LoadCuePoint();
        pCP = pCues->GetLast();
        CHECK(pCP);
        ALOGV("pCP = %s", pCP == NULL ? "NULL" : "not NULL");
        if (pCP == NULL)
            continue;

        size_t trackCount = mExtractor->mTracks.size();
        for (size_t index = 0; index < trackCount; ++index) {
@@ -494,6 +502,7 @@ void BlockIterator::seek(
    // Always *search* based on the video track, but finalize based on mTrackNum
    if (!pTP) {
        ALOGE("Did not locate the video track for seeking");
        seekwithoutcue_l(seekTimeUs, actualFrameTimeUs);
        return;
    }

@@ -537,6 +546,31 @@ int64_t BlockIterator::blockTimeUs() const {
    return (mBlockEntry->GetBlock()->GetTime(mCluster) + 500ll) / 1000ll;
}

void BlockIterator::seekwithoutcue_l(int64_t seekTimeUs, int64_t *actualFrameTimeUs) {
    mCluster = mExtractor->mSegment->FindCluster(seekTimeUs * 1000ll);
    const long status = mCluster->GetFirst(mBlockEntry);
    if (status < 0) {  // error
        ALOGE("get last blockenry failed!");
        mCluster = NULL;
        return;
    }
    mBlockEntryIndex = 0;
    while (!eos() && ((block()->GetTrackNumber() != mTrackNum) || (blockTimeUs() < seekTimeUs))) {
        advance_l();
    }

    // video track will seek to the next key frame.
    if (mTrackType == 1) {
        while (!eos() && ((block()->GetTrackNumber() != mTrackNum) ||
                      !mBlockEntry->GetBlock()->IsKey())) {
            advance_l();
        }
    }
    *actualFrameTimeUs = blockTimeUs();
     ALOGV("seekTimeUs:%lld, actualFrameTimeUs:%lld, tracknum:%lld",
              (long long)seekTimeUs, (long long)*actualFrameTimeUs, (long long)mTrackNum);
}

////////////////////////////////////////////////////////////////////////////////

static unsigned U24_AT(const uint8_t *ptr) {
@@ -956,6 +990,7 @@ MatroskaExtractor::MatroskaExtractor(DataSourceHelper *source)
        return;
    }

    if (mIsLiveStreaming) {
        // from mkvparser::Segment::Load(), but stop at first cluster
        ret = mSegment->ParseHeaders();
        if (ret == 0) {
@@ -968,6 +1003,44 @@ MatroskaExtractor::MatroskaExtractor(DataSourceHelper *source)
        } else if (ret > 0) {
            ret = mkvparser::E_BUFFER_NOT_FULL;
        }
    } else {
        ret = mSegment->ParseHeaders();
        if (ret < 0) {
            ALOGE("Segment parse header return fail %lld", ret);
            delete mSegment;
            mSegment = NULL;
            return;
        } else if (ret == 0) {
            const mkvparser::Cues* mCues = mSegment->GetCues();
            const mkvparser::SeekHead* mSH = mSegment->GetSeekHead();
            if ((mCues == NULL) && (mSH != NULL)) {
                size_t count = mSH->GetCount();
                const mkvparser::SeekHead::Entry* mEntry;
                for (size_t index = 0; index < count; index++) {
                    mEntry = mSH->GetEntry(index);
                    if (mEntry->id == 0x0C53BB6B) {  // Cues ID
                        long len;
                        long long pos;
                        mSegment->ParseCues(mEntry->pos, pos, len);
                        mCues = mSegment->GetCues();
                        ALOGV("find cue data by seekhead");
                        break;
                    }
                }
            }

            if (mCues) {
                long len;
                ret = mSegment->LoadCluster(pos, len);
                ALOGV("has Cue data, Cluster num=%ld", mSegment->GetCount());
            } else  {
                long status_Load = mSegment->Load();
                ALOGW("no Cue data,Segment Load status:%ld",status_Load);
            }
        } else if (ret > 0) {
            ret = mkvparser::E_BUFFER_NOT_FULL;
        }
    }

    if (ret < 0) {
        char uri[1024];
+0 −1
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ cc_test {
    ],

    cflags: [
        "-v",
        "-Werror",
        "-Wextra",
    ],
+12 −0
Original line number Diff line number Diff line
@@ -295,6 +295,18 @@ status_t OggWriter::threadFunc() {
                  mEstimatedSizeBytes, mMaxFileSizeLimitBytes);
            break;
        }

        int32_t isCodecSpecific;
        if ((buffer->meta_data().findInt32(kKeyIsCodecConfig, &isCodecSpecific)
             && isCodecSpecific)
            || IsOpusHeader((uint8_t*)buffer->data() + buffer->range_offset(),
                         buffer->range_length())) {
            ALOGV("Drop codec specific info buffer");
            buffer->release();
            buffer = nullptr;
            continue;
        }

        int64_t timestampUs;
        CHECK(buffer->meta_data().findInt64(kKeyTime, &timestampUs));
        if (timestampUs > mEstimatedDurationUs) {
Loading