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

Commit 59d1d010 authored by Apurupa Pattapu's avatar Apurupa Pattapu Committed by Android Git Automerger
Browse files

am 79971c74: httplive: Dont resume if we have almost fetched till stop time

* commit '79971c74':
  httplive: Dont resume if we have almost fetched till stop time
parents 3606efd1 79971c74
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@ namespace android {
const int64_t PlaylistFetcher::kMinBufferedDurationUs = 10000000ll;
const int64_t PlaylistFetcher::kMaxMonitorDelayUs = 3000000ll;
const int32_t PlaylistFetcher::kDownloadBlockSize = 2048;
const int32_t PlaylistFetcher::kNumSkipFrames = 10;
const int32_t PlaylistFetcher::kNumSkipFrames = 5;

PlaylistFetcher::PlaylistFetcher(
        const sp<AMessage> &notify,
@@ -561,7 +561,7 @@ status_t PlaylistFetcher::onResumeUntil(const sp<AMessage> &msg) {
        // Don't resume if we would stop within a resume threshold.
        int32_t discontinuitySeq;
        int64_t latestTimeUs = 0, stopTimeUs = 0;
        sp<AMessage> latestMeta = packetSource->getLatestDequeuedMeta();
        sp<AMessage> latestMeta = packetSource->getLatestEnqueuedMeta();
        if (latestMeta != NULL
                && latestMeta->findInt32("discontinuitySeq", &discontinuitySeq)
                && discontinuitySeq == mDiscontinuitySeq
@@ -1678,7 +1678,7 @@ void PlaylistFetcher::updateDuration() {

int64_t PlaylistFetcher::resumeThreshold(const sp<AMessage> &msg) {
    int64_t durationUs, threshold;
    if (msg->findInt64("durationUs", &durationUs)) {
    if (msg->findInt64("durationUs", &durationUs) && durationUs > 0) {
        return kNumSkipFrames * durationUs;
    }

+7 −0
Original line number Diff line number Diff line
@@ -221,9 +221,16 @@ void AnotherPacketSource::queueAccessUnit(const sp<ABuffer> &buffer) {
        mLatestEnqueuedMeta = buffer->meta()->dup();
    } else {
        int64_t latestTimeUs = 0;
        int64_t frameDeltaUs = 0;
        CHECK(mLatestEnqueuedMeta->findInt64("timeUs", &latestTimeUs));
        if (lastQueuedTimeUs > latestTimeUs) {
            mLatestEnqueuedMeta = buffer->meta()->dup();
            frameDeltaUs = lastQueuedTimeUs - latestTimeUs;
            mLatestEnqueuedMeta->setInt64("durationUs", frameDeltaUs);
        } else if (!mLatestEnqueuedMeta->findInt64("durationUs", &frameDeltaUs)) {
            // For B frames
            frameDeltaUs = latestTimeUs - lastQueuedTimeUs;
            mLatestEnqueuedMeta->setInt64("durationUs", frameDeltaUs);
        }
    }
}