summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/httplive/PlaylistFetcher.h
diff options
context:
space:
mode:
authorChong Zhang <chz@google.com>2015-03-17 16:27:56 -0700
committerChong Zhang <chz@google.com>2015-03-27 15:36:39 -0700
commit7c8708046117e03c0d38006bdd9685139df3ac6b (patch)
treee921d42722d2c627e3c002560dadd5ea501e3919 /media/libstagefright/httplive/PlaylistFetcher.h
parent514d7af22c5d6526309e71fadcff42b072c30241 (diff)
downloadframeworks_av-7c8708046117e03c0d38006bdd9685139df3ac6b.zip
frameworks_av-7c8708046117e03c0d38006bdd9685139df3ac6b.tar.gz
frameworks_av-7c8708046117e03c0d38006bdd9685139df3ac6b.tar.bz2
HLS: faster switching and pause/resume on low buffer
- when upswitching, discard excessive buffering on low bandwidth variant, switch to new variant earlier - when downswitching, report newly found IDR positions continuously, and switch as soon as new fetcher passes playback position. This allows us to skip time-consuming resumeUntil() of old fetcher most of the time - implement pause/resume on low buffering, and notify buffering percentage - buffering parameter tuning, separate pause/resume/ready buffer level and up/down switch buffer level, boost up fetcher buffering significantly bug: 19567254 Change-Id: I750dfcc6f861d78d16a71f501beb86d8129cb048
Diffstat (limited to 'media/libstagefright/httplive/PlaylistFetcher.h')
-rw-r--r--media/libstagefright/httplive/PlaylistFetcher.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/media/libstagefright/httplive/PlaylistFetcher.h b/media/libstagefright/httplive/PlaylistFetcher.h
index 8d34cbc..dab56df 100644
--- a/media/libstagefright/httplive/PlaylistFetcher.h
+++ b/media/libstagefright/httplive/PlaylistFetcher.h
@@ -44,9 +44,11 @@ struct PlaylistFetcher : public AHandler {
kWhatStopped,
kWhatError,
kWhatDurationUpdate,
+ kWhatTargetDurationUpdate,
kWhatPrepared,
kWhatPreparationFailed,
kWhatStartedAt,
+ kWhatStopReached,
};
PlaylistFetcher(
@@ -64,7 +66,7 @@ struct PlaylistFetcher : public AHandler {
int64_t startTimeUs = -1ll, // starting timestamps
int64_t segmentStartTimeUs = -1ll, // starting position within playlist
// startTimeUs!=segmentStartTimeUs only when playlist is live
- int32_t startDiscontinuitySeq = 0,
+ int32_t startDiscontinuitySeq = -1,
LiveSession::SeekMode seekMode = LiveSession::kSeekModeExactPosition);
void pauseAsync(float thresholdRatio);
@@ -135,7 +137,6 @@ private:
bool mStartup;
bool mIDRFound;
int32_t mSeekMode;
- bool mPrepared;
bool mTimeChangeSignaled;
int64_t mNextPTSTimeUs;
@@ -187,7 +188,7 @@ private:
void postMonitorQueue(int64_t delayUs = 0, int64_t minDelayUs = 0);
void cancelMonitorQueue();
void setStoppingThreshold(float thresholdRatio);
- bool shouldPauseDownload(bool startFound);
+ bool shouldPauseDownload();
int64_t delayUsToRefreshPlaylist() const;
status_t refreshPlaylist();
@@ -195,6 +196,8 @@ private:
// Returns the media time in us of the segment specified by seqNumber.
// This is computed by summing the durations of all segments before it.
int64_t getSegmentStartTimeUs(int32_t seqNumber) const;
+ // Returns the duration time in us of the segment specified.
+ int64_t getSegmentDurationUs(int32_t seqNumber) const;
status_t onStart(const sp<AMessage> &msg);
void onPause();
@@ -219,6 +222,7 @@ private:
status_t extractAndQueueAccessUnits(
const sp<ABuffer> &buffer, const sp<AMessage> &itemMeta);
+ void notifyStopReached();
void notifyError(status_t err);
void queueDiscontinuity(
@@ -230,6 +234,7 @@ private:
int32_t getSeqNumberForTime(int64_t timeUs) const;
void updateDuration();
+ void updateTargetDuration();
DISALLOW_EVIL_CONSTRUCTORS(PlaylistFetcher);
};