diff options
author | Robert Shih <robertshih@google.com> | 2014-12-22 11:46:50 -0800 |
---|---|---|
committer | Robert Shih <robertshih@google.com> | 2014-12-22 11:50:26 -0800 |
commit | f580806d893c4631f5324ff0af5c2db68a40ef42 (patch) | |
tree | bcb818e65e7702333bfb70103b63cf19ec90455f /media/libstagefright/httplive/PlaylistFetcher.cpp | |
parent | 5886252a7b08fb5c5d8829443e56a63956986148 (diff) | |
download | frameworks_av-f580806d893c4631f5324ff0af5c2db68a40ef42.zip frameworks_av-f580806d893c4631f5324ff0af5c2db68a40ef42.tar.gz frameworks_av-f580806d893c4631f5324ff0af5c2db68a40ef42.tar.bz2 |
HLS: QCom enhancements
This commit consists of:
http://go/pag/c/188753 Add NULL check for empty playlist
http://go/pag/c/188754 Fix deadlock for low duration clips
http://go/pag/c/188757 Create a copy of last enqueued metadata
http://go/pag/c/188755 Propagate target duration to LiveSession
http://go/pag/c/188762 Decouple block size from bandwidth estimate
http://go/pag/c/188756 Reduce memcpy calls for chunked content
http://go/pag/c/188758 Dont resume if we have almost fetched till stop time
Bug: 18821145
Change-Id: I7fd650999c6c50bbadffd65adee9020e669dfe62
Diffstat (limited to 'media/libstagefright/httplive/PlaylistFetcher.cpp')
-rw-r--r-- | media/libstagefright/httplive/PlaylistFetcher.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/media/libstagefright/httplive/PlaylistFetcher.cpp b/media/libstagefright/httplive/PlaylistFetcher.cpp index d8eed5b..4a97803 100644 --- a/media/libstagefright/httplive/PlaylistFetcher.cpp +++ b/media/libstagefright/httplive/PlaylistFetcher.cpp @@ -49,8 +49,9 @@ namespace android { // static const int64_t PlaylistFetcher::kMinBufferedDurationUs = 10000000ll; const int64_t PlaylistFetcher::kMaxMonitorDelayUs = 3000000ll; -const int32_t PlaylistFetcher::kDownloadBlockSize = 2048; -const int32_t PlaylistFetcher::kNumSkipFrames = 10; +// LCM of 188 (size of a TS packet) & 1k works well +const int32_t PlaylistFetcher::kDownloadBlockSize = 47 * 1024; +const int32_t PlaylistFetcher::kNumSkipFrames = 5; PlaylistFetcher::PlaylistFetcher( const sp<AMessage> ¬ify, @@ -561,7 +562,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 @@ -610,7 +611,12 @@ void PlaylistFetcher::onMonitorQueue() { int32_t targetDurationSecs; int64_t targetDurationUs = kMinBufferedDurationUs; if (mPlaylist != NULL) { - CHECK(mPlaylist->meta()->findInt32("target-duration", &targetDurationSecs)); + if (mPlaylist->meta() == NULL || !mPlaylist->meta()->findInt32( + "target-duration", &targetDurationSecs)) { + ALOGE("Playlist is missing required EXT-X-TARGETDURATION tag"); + notifyError(ERROR_MALFORMED); + return; + } targetDurationUs = targetDurationSecs * 1000000ll; } @@ -1159,6 +1165,11 @@ const sp<ABuffer> &PlaylistFetcher::setAccessUnitProperties( accessUnit->meta()->setInt32("discard", discard); } + int32_t targetDurationSecs; + if (mPlaylist->meta()->findInt32("target-duration", &targetDurationSecs)) { + accessUnit->meta()->setInt32("targetDuration", targetDurationSecs); + } + accessUnit->meta()->setInt32("discontinuitySeq", mDiscontinuitySeq); accessUnit->meta()->setInt64("segmentStartTimeUs", getSegmentStartTimeUs(mSeqNumber)); return accessUnit; @@ -1668,7 +1679,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; } |