diff options
| author | Andreas Huber <andih@google.com> | 2011-05-24 15:56:42 -0700 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-05-24 15:56:42 -0700 |
| commit | 1b50fe2952f7deea23a0b75adedd10fa310bb9bf (patch) | |
| tree | 98666752491efac9ad42e2da3981cf58cc5c703d /media | |
| parent | 7eaa5e57d852f0f25f6a8dbdb8537e53f039b3c4 (diff) | |
| parent | 60a3cb81c0123446093810bc8cbef6bc1fe37aa3 (diff) | |
| download | frameworks_base-1b50fe2952f7deea23a0b75adedd10fa310bb9bf.zip frameworks_base-1b50fe2952f7deea23a0b75adedd10fa310bb9bf.tar.gz frameworks_base-1b50fe2952f7deea23a0b75adedd10fa310bb9bf.tar.bz2 | |
Merge "Make sure the software mpeg4 decoder supports multiple input frames per input buffer"
Diffstat (limited to 'media')
| -rw-r--r-- | media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.cpp | 27 | ||||
| -rw-r--r-- | media/libstagefright/omx/SoftOMXPlugin.cpp | 2 |
2 files changed, 21 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, ×tamp, &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; diff --git a/media/libstagefright/omx/SoftOMXPlugin.cpp b/media/libstagefright/omx/SoftOMXPlugin.cpp index 6bd6624..cfbcb96 100644 --- a/media/libstagefright/omx/SoftOMXPlugin.cpp +++ b/media/libstagefright/omx/SoftOMXPlugin.cpp @@ -21,6 +21,7 @@ #include "SoftOMXPlugin.h" #include "include/SoftOMXComponent.h" +#include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/foundation/AString.h> #include <dlfcn.h> @@ -128,6 +129,7 @@ OMX_ERRORTYPE SoftOMXPlugin::destroyComponentInstance( void *libHandle = me->libHandle(); + CHECK_EQ(me->getStrongCount(), 1); me->decStrong(this); me = NULL; |
