Loading include/media/IStreamSource.h +7 −0 Original line number Diff line number Diff line Loading @@ -81,6 +81,13 @@ struct IStreamListener : public IInterface { // with the next PTS occuring in the stream. The value is of type int64_t. static const char *const kKeyMediaTimeUs; // Optionally signalled as part of a discontinuity that includes // DISCONTINUITY_TIME. It indicates the media time (in us) of a recent // sample from the same content, and is used as a hint for the parser to // handle PTS wraparound. This is required when a new parser is created // to continue parsing content from the same timeline. static const char *const kKeyRecentMediaTimeUs; virtual void issueCommand( Command cmd, bool synchronous, const sp<AMessage> &msg = NULL) = 0; }; Loading include/media/stagefright/Utils.h +11 −0 Original line number Diff line number Diff line Loading @@ -65,6 +65,17 @@ bool canOffloadStream(const sp<MetaData>& meta, bool hasVideo, AString uriDebugString(const AString &uri, bool incognito = false); struct HLSTime { int32_t mSeq; int64_t mTimeUs; sp<AMessage> mMeta; HLSTime(const sp<AMessage> &meta = NULL); int64_t getSegmentTimeUs(bool midpoint = false) const; }; bool operator <(const HLSTime &t0, const HLSTime &t1); } // namespace android #endif // UTILS_H_ media/libmedia/IStreamSource.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,9 @@ const char *const IStreamListener::kKeyDiscontinuityMask = "discontinuity-mask"; // static const char *const IStreamListener::kKeyMediaTimeUs = "media-time-us"; // static const char *const IStreamListener::kKeyRecentMediaTimeUs = "recent-media-time-us"; enum { // IStreamSource SET_LISTENER = IBinder::FIRST_CALL_TRANSACTION, Loading media/libstagefright/Utils.cpp +31 −0 Original line number Diff line number Diff line Loading @@ -822,5 +822,36 @@ AString uriDebugString(const AString &uri, bool incognito) { return AString("<no-scheme URI suppressed>"); } HLSTime::HLSTime(const sp<AMessage>& meta) : mSeq(-1), mTimeUs(-1ll), mMeta(meta) { if (meta != NULL) { CHECK(meta->findInt32("discontinuitySeq", &mSeq)); CHECK(meta->findInt64("timeUs", &mTimeUs)); } } int64_t HLSTime::getSegmentTimeUs(bool midpoint) const { int64_t segmentStartTimeUs = -1ll; if (mMeta != NULL) { CHECK(mMeta->findInt64("segmentStartTimeUs", &segmentStartTimeUs)); if (midpoint) { int64_t durationUs; CHECK(mMeta->findInt64("segmentDurationUs", &durationUs)); segmentStartTimeUs += durationUs / 2; } } return segmentStartTimeUs; } bool operator <(const HLSTime &t0, const HLSTime &t1) { // we can only compare discontinuity sequence and timestamp. // (mSegmentTimeUs is not reliable in live streaming case, it's the // time starting from beginning of playlist but playlist could change.) return t0.mSeq < t1.mSeq || (t0.mSeq == t1.mSeq && t0.mTimeUs < t1.mTimeUs); } } // namespace android media/libstagefright/httplive/LiveSession.cpp +121 −154 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
include/media/IStreamSource.h +7 −0 Original line number Diff line number Diff line Loading @@ -81,6 +81,13 @@ struct IStreamListener : public IInterface { // with the next PTS occuring in the stream. The value is of type int64_t. static const char *const kKeyMediaTimeUs; // Optionally signalled as part of a discontinuity that includes // DISCONTINUITY_TIME. It indicates the media time (in us) of a recent // sample from the same content, and is used as a hint for the parser to // handle PTS wraparound. This is required when a new parser is created // to continue parsing content from the same timeline. static const char *const kKeyRecentMediaTimeUs; virtual void issueCommand( Command cmd, bool synchronous, const sp<AMessage> &msg = NULL) = 0; }; Loading
include/media/stagefright/Utils.h +11 −0 Original line number Diff line number Diff line Loading @@ -65,6 +65,17 @@ bool canOffloadStream(const sp<MetaData>& meta, bool hasVideo, AString uriDebugString(const AString &uri, bool incognito = false); struct HLSTime { int32_t mSeq; int64_t mTimeUs; sp<AMessage> mMeta; HLSTime(const sp<AMessage> &meta = NULL); int64_t getSegmentTimeUs(bool midpoint = false) const; }; bool operator <(const HLSTime &t0, const HLSTime &t1); } // namespace android #endif // UTILS_H_
media/libmedia/IStreamSource.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,9 @@ const char *const IStreamListener::kKeyDiscontinuityMask = "discontinuity-mask"; // static const char *const IStreamListener::kKeyMediaTimeUs = "media-time-us"; // static const char *const IStreamListener::kKeyRecentMediaTimeUs = "recent-media-time-us"; enum { // IStreamSource SET_LISTENER = IBinder::FIRST_CALL_TRANSACTION, Loading
media/libstagefright/Utils.cpp +31 −0 Original line number Diff line number Diff line Loading @@ -822,5 +822,36 @@ AString uriDebugString(const AString &uri, bool incognito) { return AString("<no-scheme URI suppressed>"); } HLSTime::HLSTime(const sp<AMessage>& meta) : mSeq(-1), mTimeUs(-1ll), mMeta(meta) { if (meta != NULL) { CHECK(meta->findInt32("discontinuitySeq", &mSeq)); CHECK(meta->findInt64("timeUs", &mTimeUs)); } } int64_t HLSTime::getSegmentTimeUs(bool midpoint) const { int64_t segmentStartTimeUs = -1ll; if (mMeta != NULL) { CHECK(mMeta->findInt64("segmentStartTimeUs", &segmentStartTimeUs)); if (midpoint) { int64_t durationUs; CHECK(mMeta->findInt64("segmentDurationUs", &durationUs)); segmentStartTimeUs += durationUs / 2; } } return segmentStartTimeUs; } bool operator <(const HLSTime &t0, const HLSTime &t1) { // we can only compare discontinuity sequence and timestamp. // (mSegmentTimeUs is not reliable in live streaming case, it's the // time starting from beginning of playlist but playlist could change.) return t0.mSeq < t1.mSeq || (t0.mSeq == t1.mSeq && t0.mTimeUs < t1.mTimeUs); } } // namespace android
media/libstagefright/httplive/LiveSession.cpp +121 −154 File changed.Preview size limit exceeded, changes collapsed. Show changes