summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.cpp
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2011-05-24 14:53:30 -0700
committerAndreas Huber <andih@google.com>2011-05-24 14:53:30 -0700
commitf2af5a2c607e71ff4cd39da28b077c0a68b206fe (patch)
tree8b836eb9a3dad85163dfe000faae8ef07a986fec /media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.cpp
parent9eff287f4f59d6a0c9ca1d5dd8a7bb6e64acf5a4 (diff)
downloadframeworks_av-f2af5a2c607e71ff4cd39da28b077c0a68b206fe.zip
frameworks_av-f2af5a2c607e71ff4cd39da28b077c0a68b206fe.tar.gz
frameworks_av-f2af5a2c607e71ff4cd39da28b077c0a68b206fe.tar.bz2
Make sure the software mpeg4 decoder supports multiple input frames per input buffer
to enable faster throughput in ACodec. Change-Id: I6f6a1c70d9446f9d52c3df257b2d22358b0e71f4
Diffstat (limited to 'media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.cpp')
-rw-r--r--media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.cpp27
1 files changed, 19 insertions, 8 deletions
diff --git a/media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.cpp b/media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.cpp
index 13e1662..cffbfb5 100644
--- a/media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.cpp
+++ b/media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.cpp
@@ -360,10 +360,14 @@ void SoftMPEG4::onQueueFilled(OMX_U32 portIndex) {
mFramesConfigured = true;
}
- uint32_t timestamp = 0xFFFFFFFF;
+ uint32_t useExtTimestamp = (inHeader->nOffset == 0);
+
+ // decoder deals in ms, OMX in us.
+ uint32_t timestamp =
+ useExtTimestamp ? (inHeader->nTimeStamp + 500) / 1000 : 0xFFFFFFFF;
+
int32_t bufferSize = inHeader->nFilledLen;
- uint32_t useExtTimestamp = 0;
if (PVDecodeVideoFrame(
mHandle, &bitstream, &timestamp, &bufferSize,
&useExtTimestamp,
@@ -379,13 +383,20 @@ void SoftMPEG4::onQueueFilled(OMX_U32 portIndex) {
return;
}
- outHeader->nTimeStamp = inHeader->nTimeStamp;
+ // decoder deals in ms, OMX in us.
+ outHeader->nTimeStamp = timestamp * 1000;
- inInfo->mOwnedByUs = false;
- inQueue.erase(inQueue.begin());
- inInfo = NULL;
- notifyEmptyBufferDone(inHeader);
- inHeader = NULL;
+ CHECK_LE(bufferSize, inHeader->nFilledLen);
+ inHeader->nOffset += inHeader->nFilledLen - bufferSize;
+ inHeader->nFilledLen = bufferSize;
+
+ if (inHeader->nFilledLen == 0) {
+ inInfo->mOwnedByUs = false;
+ inQueue.erase(inQueue.begin());
+ inInfo = NULL;
+ notifyEmptyBufferDone(inHeader);
+ inHeader = NULL;
+ }
++mInputBufferCount;