diff options
author | Robert Shih <robertshih@google.com> | 2014-07-29 18:34:36 -0700 |
---|---|---|
committer | Robert Shih <robertshih@google.com> | 2014-08-05 20:46:56 -0700 |
commit | 309aa8bf5e4cd66fe988adf2654cac3fadc2a1c3 (patch) | |
tree | 7958aa68f244c1f1d0d8b98efe934d1c3d60ce2d /media/libstagefright/mpeg2ts | |
parent | 3423bbdb05f843a64356fa24e8657f03ecbb7d65 (diff) | |
download | frameworks_av-309aa8bf5e4cd66fe988adf2654cac3fadc2a1c3.zip frameworks_av-309aa8bf5e4cd66fe988adf2654cac3fadc2a1c3.tar.gz frameworks_av-309aa8bf5e4cd66fe988adf2654cac3fadc2a1c3.tar.bz2 |
httplive: timestamp reporting, track selection
Bug: 15153976
Bug: 15763638
Bug: 16351654
Change-Id: I4462276d4b7342647286a0ca4be11692ce52ff6d
Diffstat (limited to 'media/libstagefright/mpeg2ts')
-rw-r--r-- | media/libstagefright/mpeg2ts/ATSParser.cpp | 6 | ||||
-rw-r--r-- | media/libstagefright/mpeg2ts/AnotherPacketSource.cpp | 21 | ||||
-rw-r--r-- | media/libstagefright/mpeg2ts/AnotherPacketSource.h | 4 |
3 files changed, 26 insertions, 5 deletions
diff --git a/media/libstagefright/mpeg2ts/ATSParser.cpp b/media/libstagefright/mpeg2ts/ATSParser.cpp index eda6387..6d8866a 100644 --- a/media/libstagefright/mpeg2ts/ATSParser.cpp +++ b/media/libstagefright/mpeg2ts/ATSParser.cpp @@ -894,6 +894,12 @@ void ATSParser::Stream::onPayloadData( ALOGV("Stream PID 0x%08x of type 0x%02x now has data.", mElementaryPID, mStreamType); + const char *mime; + if (meta->findCString(kKeyMIMEType, &mime) + && !strcasecmp(mime, MEDIA_MIMETYPE_VIDEO_AVC) + && !IsIDR(accessUnit)) { + continue; + } mSource = new AnotherPacketSource(meta); mSource->queueAccessUnit(accessUnit); } diff --git a/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp b/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp index 72c9dae..010063f 100644 --- a/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp +++ b/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp @@ -14,6 +14,9 @@ * limitations under the License. */ +//#define LOG_NDEBUG 0 +#define LOG_TAG "AnotherPacketSource" + #include "AnotherPacketSource.h" #include <media/stagefright/foundation/ABuffer.h> @@ -38,7 +41,8 @@ AnotherPacketSource::AnotherPacketSource(const sp<MetaData> &meta) mFormat(NULL), mLastQueuedTimeUs(0), mEOSResult(OK), - mLatestEnqueuedMeta(NULL) { + mLatestEnqueuedMeta(NULL), + mLatestDequeuedMeta(NULL) { setFormat(meta); } @@ -92,7 +96,7 @@ sp<MetaData> AnotherPacketSource::getFormat() { sp<RefBase> object; if (buffer->meta()->findObject("format", &object)) { - return static_cast<MetaData*>(object.get()); + return mFormat = static_cast<MetaData*>(object.get()); } ++it; @@ -121,6 +125,8 @@ status_t AnotherPacketSource::dequeueAccessUnit(sp<ABuffer> *buffer) { return INFO_DISCONTINUITY; } + mLatestDequeuedMeta = (*buffer)->meta()->dup(); + sp<RefBase> object; if ((*buffer)->meta()->findObject("format", &object)) { mFormat = static_cast<MetaData*>(object.get()); @@ -142,8 +148,10 @@ status_t AnotherPacketSource::read( } if (!mBuffers.empty()) { + const sp<ABuffer> buffer = *mBuffers.begin(); mBuffers.erase(mBuffers.begin()); + mLatestDequeuedMeta = buffer->meta()->dup(); int32_t discontinuity; if (buffer->meta()->findInt32("discontinuity", &discontinuity)) { @@ -202,7 +210,7 @@ void AnotherPacketSource::queueAccessUnit(const sp<ABuffer> &buffer) { mBuffers.push_back(buffer); mCondition.signal(); - if (!mLatestEnqueuedMeta.get()) { + if (mLatestEnqueuedMeta == NULL) { mLatestEnqueuedMeta = buffer->meta(); } else { int64_t latestTimeUs = 0; @@ -341,9 +349,14 @@ bool AnotherPacketSource::isFinished(int64_t duration) const { return (mEOSResult != OK); } -sp<AMessage> AnotherPacketSource::getLatestMeta() { +sp<AMessage> AnotherPacketSource::getLatestEnqueuedMeta() { Mutex::Autolock autoLock(mLock); return mLatestEnqueuedMeta; } +sp<AMessage> AnotherPacketSource::getLatestDequeuedMeta() { + Mutex::Autolock autoLock(mLock); + return mLatestDequeuedMeta; +} + } // namespace android diff --git a/media/libstagefright/mpeg2ts/AnotherPacketSource.h b/media/libstagefright/mpeg2ts/AnotherPacketSource.h index f38f9dc..0c717d7 100644 --- a/media/libstagefright/mpeg2ts/AnotherPacketSource.h +++ b/media/libstagefright/mpeg2ts/AnotherPacketSource.h @@ -64,7 +64,8 @@ struct AnotherPacketSource : public MediaSource { bool isFinished(int64_t duration) const; - sp<AMessage> getLatestMeta(); + sp<AMessage> getLatestEnqueuedMeta(); + sp<AMessage> getLatestDequeuedMeta(); protected: virtual ~AnotherPacketSource(); @@ -80,6 +81,7 @@ private: List<sp<ABuffer> > mBuffers; status_t mEOSResult; sp<AMessage> mLatestEnqueuedMeta; + sp<AMessage> mLatestDequeuedMeta; bool wasFormatChange(int32_t discontinuityType) const; |