summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/mpeg2ts/AnotherPacketSource.h
diff options
context:
space:
mode:
authorRobert Shih <robertshih@google.com>2015-03-06 16:45:59 -0800
committerRobert Shih <robertshih@google.com>2015-04-21 17:41:47 -0700
commit0dd229bb306df68b88e7419b3cc11fc6175be1da (patch)
tree93b54ff367c32f6c8256ef646c06ce8f73b8aef7 /media/libstagefright/mpeg2ts/AnotherPacketSource.h
parentc9c3804a2caf3c0f96e7a8985f82db7ceef490df (diff)
downloadframeworks_av-0dd229bb306df68b88e7419b3cc11fc6175be1da.zip
frameworks_av-0dd229bb306df68b88e7419b3cc11fc6175be1da.tar.gz
frameworks_av-0dd229bb306df68b88e7419b3cc11fc6175be1da.tar.bz2
AnotherPacketSource: make getBufferedDurationUs more discontinuity-aware
The new getBufferedDurationUs implementation obsoletes the purpose of getEstimatedDurationUs; remove getEstimatedDurationUs and its associated member variables. Finally replace calls to getEstimatedDurationUs with getBufferedDurationUs. Change-Id: I38f20df8e177ffbfe299b203d99076fc98dcd274
Diffstat (limited to 'media/libstagefright/mpeg2ts/AnotherPacketSource.h')
-rw-r--r--media/libstagefright/mpeg2ts/AnotherPacketSource.h24
1 files changed, 19 insertions, 5 deletions
diff --git a/media/libstagefright/mpeg2ts/AnotherPacketSource.h b/media/libstagefright/mpeg2ts/AnotherPacketSource.h
index 08cd92e..eb9dc9b 100644
--- a/media/libstagefright/mpeg2ts/AnotherPacketSource.h
+++ b/media/libstagefright/mpeg2ts/AnotherPacketSource.h
@@ -53,8 +53,6 @@ struct AnotherPacketSource : public MediaSource {
// presentation timestamps since the last discontinuity (if any).
int64_t getBufferedDurationUs(status_t *finalResult);
- int64_t getEstimatedDurationUs();
-
status_t nextBufferTime(int64_t *timeUs);
void queueAccessUnit(const sp<ABuffer> &buffer);
@@ -84,6 +82,25 @@ protected:
virtual ~AnotherPacketSource();
private:
+
+ struct DiscontinuitySegment {
+ int64_t mMaxDequeTimeUs, mMaxEnqueTimeUs;
+ DiscontinuitySegment()
+ : mMaxDequeTimeUs(-1),
+ mMaxEnqueTimeUs(-1) {
+ };
+
+ void clear() {
+ mMaxDequeTimeUs = mMaxEnqueTimeUs = -1;
+ }
+ };
+
+ // Discontinuity segments are consecutive access units between
+ // discontinuity markers. There should always be at least _ONE_
+ // discontinuity segment, hence the various CHECKs in
+ // AnotherPacketSource.cpp for non-empty()-ness.
+ List<DiscontinuitySegment> mDiscontinuitySegments;
+
Mutex mLock;
Condition mCondition;
@@ -97,10 +114,7 @@ private:
sp<AMessage> mLatestEnqueuedMeta;
sp<AMessage> mLatestDequeuedMeta;
- size_t mQueuedDiscontinuityCount;
-
bool wasFormatChange(int32_t discontinuityType) const;
- int64_t getBufferedDurationUs_l(status_t *finalResult);
DISALLOW_EVIL_CONSTRUCTORS(AnotherPacketSource);
};