summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/httplive
diff options
context:
space:
mode:
authorRobert Shih <robertshih@google.com>2015-02-04 21:31:32 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-02-04 21:31:32 +0000
commit7dbbc7ec95c3040668388162a0ffbc45b68af6f1 (patch)
tree540ab0a703ebac5d8384c05dc17996177dd35de8 /media/libstagefright/httplive
parent3b5d119522bdf9c23be622be395d7a95d465616e (diff)
parenta291dabcab10cafc1749d1d9493d269049502256 (diff)
downloadframeworks_av-7dbbc7ec95c3040668388162a0ffbc45b68af6f1.zip
frameworks_av-7dbbc7ec95c3040668388162a0ffbc45b68af6f1.tar.gz
frameworks_av-7dbbc7ec95c3040668388162a0ffbc45b68af6f1.tar.bz2
am a291dabc: am 6fbcf633: Merge "httplive: Set start time and segment start time in conjunction." into lmp-mr1-dev
* commit 'a291dabcab10cafc1749d1d9493d269049502256': httplive: Set start time and segment start time in conjunction.
Diffstat (limited to 'media/libstagefright/httplive')
-rw-r--r--media/libstagefright/httplive/LiveSession.cpp13
-rw-r--r--media/libstagefright/httplive/PlaylistFetcher.cpp7
2 files changed, 14 insertions, 6 deletions
diff --git a/media/libstagefright/httplive/LiveSession.cpp b/media/libstagefright/httplive/LiveSession.cpp
index c25f3d4..d0f3bc2 100644
--- a/media/libstagefright/httplive/LiveSession.cpp
+++ b/media/libstagefright/httplive/LiveSession.cpp
@@ -1508,14 +1508,15 @@ void LiveSession::onChangeConfiguration3(const sp<AMessage> &msg) {
if (meta != NULL && !meta->findInt32("discontinuity", &type)) {
int64_t tmpUs;
+ int64_t tmpSegmentUs;
+
CHECK(meta->findInt64("timeUs", &tmpUs));
- if (startTimeUs < 0 || tmpUs < startTimeUs) {
+ CHECK(meta->findInt64("segmentStartTimeUs", &tmpSegmentUs));
+ if (startTimeUs < 0 || tmpSegmentUs < segmentStartTimeUs) {
+ startTimeUs = tmpUs;
+ segmentStartTimeUs = tmpSegmentUs;
+ } else if (tmpSegmentUs == segmentStartTimeUs && tmpUs < startTimeUs) {
startTimeUs = tmpUs;
- }
-
- CHECK(meta->findInt64("segmentStartTimeUs", &tmpUs));
- if (segmentStartTimeUs < 0 || tmpUs < segmentStartTimeUs) {
- segmentStartTimeUs = tmpUs;
}
int32_t seq;
diff --git a/media/libstagefright/httplive/PlaylistFetcher.cpp b/media/libstagefright/httplive/PlaylistFetcher.cpp
index 0630a5b..1227600 100644
--- a/media/libstagefright/httplive/PlaylistFetcher.cpp
+++ b/media/libstagefright/httplive/PlaylistFetcher.cpp
@@ -757,6 +757,9 @@ void PlaylistFetcher::onDownloadNext() {
mSeqNumber = firstSeqNumberInPlaylist;
}
} else {
+ // When seeking mSegmentStartTimeUs is unavailable (< 0), we
+ // use mStartTimeUs (client supplied timestamp) to determine both start segment
+ // and relative position inside a segment
mSeqNumber = getSeqNumberForTime(mStartTimeUs);
mStartTimeUs -= getSegmentStartTimeUs(mSeqNumber);
}
@@ -765,6 +768,10 @@ void PlaylistFetcher::onDownloadNext() {
mStartTimeUs, mSeqNumber, firstSeqNumberInPlaylist,
lastSeqNumberInPlaylist);
} else {
+ // When adapting or track switching, mSegmentStartTimeUs (relative
+ // to media time 0) is used to determine the start segment; mStartTimeUs (absolute
+ // timestamps coming from the media container) is used to determine the position
+ // inside a segments.
mSeqNumber = getSeqNumberForTime(mSegmentStartTimeUs);
if (mAdaptive) {
// avoid double fetch/decode