diff options
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); |