diff options
author | Chong Zhang <chz@google.com> | 2015-07-15 01:31:30 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-07-15 01:31:30 +0000 |
commit | 1bc88814f530bf67e425cfb8cea0f2b8dce3c03f (patch) | |
tree | 6c642e16897de47cd787ad56485489f87715d2d3 /media/libstagefright/mpeg2ts | |
parent | 7f4e78fedf1dbcd175a52b17d46a658218ed7453 (diff) | |
parent | fcf044a9c5624395d24eb6181e67163ce169458b (diff) | |
download | frameworks_av-1bc88814f530bf67e425cfb8cea0f2b8dce3c03f.zip frameworks_av-1bc88814f530bf67e425cfb8cea0f2b8dce3c03f.tar.gz frameworks_av-1bc88814f530bf67e425cfb8cea0f2b8dce3c03f.tar.bz2 |
Merge "NuPlayer: pull more video buffers in advance in GenericSource" into mnc-dev
Diffstat (limited to 'media/libstagefright/mpeg2ts')
-rw-r--r-- | media/libstagefright/mpeg2ts/AnotherPacketSource.cpp | 14 | ||||
-rw-r--r-- | media/libstagefright/mpeg2ts/AnotherPacketSource.h | 4 |
2 files changed, 18 insertions, 0 deletions
diff --git a/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp b/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp index 0878a1b..cabde32 100644 --- a/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp +++ b/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp @@ -394,6 +394,20 @@ bool AnotherPacketSource::hasDataBufferAvailable(status_t *finalResult) { return false; } +size_t AnotherPacketSource::getAvailableBufferCount(status_t *finalResult) { + Mutex::Autolock autoLock(mLock); + + *finalResult = OK; + if (!mEnabled) { + return 0; + } + if (!mBuffers.empty()) { + return mBuffers.size(); + } + *finalResult = mEOSResult; + return 0; +} + int64_t AnotherPacketSource::getBufferedDurationUs(status_t *finalResult) { Mutex::Autolock autoLock(mLock); *finalResult = mEOSResult; diff --git a/media/libstagefright/mpeg2ts/AnotherPacketSource.h b/media/libstagefright/mpeg2ts/AnotherPacketSource.h index eb9dc9b..28a0e89 100644 --- a/media/libstagefright/mpeg2ts/AnotherPacketSource.h +++ b/media/libstagefright/mpeg2ts/AnotherPacketSource.h @@ -49,6 +49,10 @@ struct AnotherPacketSource : public MediaSource { // Returns true if we have packets that's not discontinuities bool hasDataBufferAvailable(status_t *finalResult); + // Returns the number of available buffers. finalResult is always OK + // if this method returns non-0, or the final result if it returns 0. + size_t getAvailableBufferCount(status_t *finalResult); + // Returns the difference between the last and the first queued // presentation timestamps since the last discontinuity (if any). int64_t getBufferedDurationUs(status_t *finalResult); |