summaryrefslogtreecommitdiffstats
path: root/media/libstagefright
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2011-01-05 12:17:08 -0800
committerAndreas Huber <andih@google.com>2011-01-05 14:48:31 -0800
commit43c3e6ce02215ca99d506458f596cb1211639f29 (patch)
tree52a143f0a92abc9f5050f5c9f44e2e4c087848f3 /media/libstagefright
parent627baacc748c5e2ed68bdb256aea4d70fcfe9ce4 (diff)
downloadframeworks_av-43c3e6ce02215ca99d506458f596cb1211639f29.zip
frameworks_av-43c3e6ce02215ca99d506458f596cb1211639f29.tar.gz
frameworks_av-43c3e6ce02215ca99d506458f596cb1211639f29.tar.bz2
Seek/Duration support for completed http live streams in NuPlayer.
Change-Id: I55bbe75d87140c07b1927d14ad24130fce803463 related-to-bug: 3321475
Diffstat (limited to 'media/libstagefright')
-rw-r--r--media/libstagefright/httplive/LiveSession.cpp18
-rw-r--r--media/libstagefright/include/LiveSession.h2
-rw-r--r--media/libstagefright/mpeg2ts/ATSParser.cpp12
-rw-r--r--media/libstagefright/mpeg2ts/ATSParser.h2
4 files changed, 30 insertions, 4 deletions
diff --git a/media/libstagefright/httplive/LiveSession.cpp b/media/libstagefright/httplive/LiveSession.cpp
index 5b1f14d..51ab7a1 100644
--- a/media/libstagefright/httplive/LiveSession.cpp
+++ b/media/libstagefright/httplive/LiveSession.cpp
@@ -395,10 +395,17 @@ void LiveSession::onDownloadNext() {
int64_t index = seekTimeSecs / targetDuration;
if (index >= 0 && index < mPlaylist->size()) {
- mSeqNumber = firstSeqNumberInPlaylist + index;
- mDataSource->reset();
+ int32_t newSeqNumber = firstSeqNumberInPlaylist + index;
- explicitDiscontinuity = true;
+ if (newSeqNumber != mSeqNumber) {
+ LOGI("seeking to seq no %d", newSeqNumber);
+
+ mSeqNumber = newSeqNumber;
+
+ mDataSource->reset();
+
+ explicitDiscontinuity = true;
+ }
}
}
@@ -463,6 +470,8 @@ void LiveSession::onDownloadNext() {
return;
}
+ CHECK(buffer != NULL);
+
CHECK_EQ((status_t)OK,
decryptBuffer(mSeqNumber - firstSeqNumberInPlaylist, buffer));
@@ -482,6 +491,9 @@ void LiveSession::onDownloadNext() {
if (explicitDiscontinuity || bandwidthChanged) {
// Signal discontinuity.
+ LOGI("queueing discontinuity (explicit=%d, bandwidthChanged=%d)",
+ explicitDiscontinuity, bandwidthChanged);
+
sp<ABuffer> tmp = new ABuffer(188);
memset(tmp->data(), 0, tmp->size());
tmp->data()[1] = bandwidthChanged;
diff --git a/media/libstagefright/include/LiveSession.h b/media/libstagefright/include/LiveSession.h
index 3873d5d..41f5ad0 100644
--- a/media/libstagefright/include/LiveSession.h
+++ b/media/libstagefright/include/LiveSession.h
@@ -49,7 +49,7 @@ protected:
private:
enum {
- kMaxNumQueuedFragments = 2,
+ kMaxNumQueuedFragments = 3,
kMaxNumRetries = 5,
};
diff --git a/media/libstagefright/mpeg2ts/ATSParser.cpp b/media/libstagefright/mpeg2ts/ATSParser.cpp
index 7c81ffd..84a3860 100644
--- a/media/libstagefright/mpeg2ts/ATSParser.cpp
+++ b/media/libstagefright/mpeg2ts/ATSParser.cpp
@@ -56,6 +56,10 @@ struct ATSParser::Program : public RefBase {
int64_t convertPTSToTimestamp(uint64_t PTS);
+ bool PTSTimeDeltaEstablished() const {
+ return mFirstPTSValid;
+ }
+
private:
ATSParser *mParser;
unsigned mProgramMapPID;
@@ -734,4 +738,12 @@ sp<MediaSource> ATSParser::getSource(SourceType type) {
return NULL;
}
+bool ATSParser::PTSTimeDeltaEstablished() {
+ if (mPrograms.isEmpty()) {
+ return false;
+ }
+
+ return mPrograms.editItemAt(0)->PTSTimeDeltaEstablished();
+}
+
} // namespace android
diff --git a/media/libstagefright/mpeg2ts/ATSParser.h b/media/libstagefright/mpeg2ts/ATSParser.h
index ef78c77..fe31981 100644
--- a/media/libstagefright/mpeg2ts/ATSParser.h
+++ b/media/libstagefright/mpeg2ts/ATSParser.h
@@ -50,6 +50,8 @@ struct ATSParser : public RefBase {
};
sp<MediaSource> getSource(SourceType type);
+ bool PTSTimeDeltaEstablished();
+
protected:
virtual ~ATSParser();