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

Commit 958a5432 authored by Leena Winterrowd's avatar Leena Winterrowd Committed by Android Git Automerger
Browse files

am 17460976: stagefright: httplive: Fix deadlock for low duration clips

* commit '17460976':
  stagefright: httplive: Fix deadlock for low duration clips
parents 2899991e 17460976
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -145,10 +145,24 @@ status_t LiveSession::dequeueAccessUnit(
        }
    }

    int32_t targetDuration = 0;
    sp<AMessage> meta = packetSource->getLatestEnqueuedMeta();
    if (meta != NULL) {
        meta->findInt32("targetDuration", &targetDuration);
    }

    int64_t targetDurationUs = targetDuration * 1000000ll;
    if (targetDurationUs == 0 ||
            targetDurationUs > PlaylistFetcher::kMinBufferedDurationUs) {
        // Fetchers limit buffering to
        // min(3 * targetDuration, kMinBufferedDurationUs)
        targetDurationUs = PlaylistFetcher::kMinBufferedDurationUs;
    }

    if (mBuffering[idx]) {
        if (mSwitchInProgress
                || packetSource->isFinished(0)
                || packetSource->getEstimatedDurationUs() > 10000000ll) {
                || packetSource->getEstimatedDurationUs() > targetDurationUs) {
            mBuffering[idx] = false;
        }
    }
+2 −1
Original line number Diff line number Diff line
@@ -34,6 +34,8 @@ struct M3UParser;
struct String8;

struct PlaylistFetcher : public AHandler {
    static const int64_t kMinBufferedDurationUs;

    enum {
        kWhatStarted,
        kWhatPaused,
@@ -92,7 +94,6 @@ private:
        kWhatDownloadNext   = 'dlnx',
    };

    static const int64_t kMinBufferedDurationUs;
    static const int64_t kMaxMonitorDelayUs;
    static const int32_t kDownloadBlockSize;
    static const int32_t kNumSkipFrames;