summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/mpeg2ts
diff options
context:
space:
mode:
authorChong Zhang <chz@google.com>2015-07-14 15:58:51 -0700
committerChong Zhang <chz@google.com>2015-07-14 18:28:36 -0700
commitfcf044a9c5624395d24eb6181e67163ce169458b (patch)
tree19a4b1e23b34fbf68b0cf1a861f476607d9113d9 /media/libstagefright/mpeg2ts
parent54c0659b9efa72d11997c590c4d377c44789c7fd (diff)
downloadframeworks_av-fcf044a9c5624395d24eb6181e67163ce169458b.zip
frameworks_av-fcf044a9c5624395d24eb6181e67163ce169458b.tar.gz
frameworks_av-fcf044a9c5624395d24eb6181e67163ce169458b.tar.bz2
NuPlayer: pull more video buffers in advance in GenericSource
pull 4 video buffers at a time, and start pulling when we're down to 1 buffers to avoid starving the decoder. bug: 22320866 Change-Id: I10914dc092f3830ecb6296e2d9ebf9064ff7a5dc
Diffstat (limited to 'media/libstagefright/mpeg2ts')
-rw-r--r--media/libstagefright/mpeg2ts/AnotherPacketSource.cpp14
-rw-r--r--media/libstagefright/mpeg2ts/AnotherPacketSource.h4
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);