summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/codecs
diff options
context:
space:
mode:
authorLajos Molnar <lajos@google.com>2013-06-04 19:35:03 -0700
committerLajos Molnar <lajos@google.com>2013-06-05 16:54:04 +0000
commit269a355679fce6a71523faeefc2ff575abbd1a8e (patch)
tree881fcf5356dc90ea2762249388f3f7a79b4b7d27 /media/libstagefright/codecs
parent53b0a2b1f9cb6b99b3f0d1a639921d1b24bc30b7 (diff)
downloadframeworks_av-269a355679fce6a71523faeefc2ff575abbd1a8e.zip
frameworks_av-269a355679fce6a71523faeefc2ff575abbd1a8e.tar.gz
frameworks_av-269a355679fce6a71523faeefc2ff575abbd1a8e.tar.bz2
Track exact timestamps in SoftMPEG4/H263 decoders
Change-Id: I7772e3afec020f889dea80fd6372afbc36cd68d6 Signed-off-by: Lajos Molnar <lajos@google.com> Bug: 9285553 (cherry picked from commit e113aa1f078cb3d5f8182058e144fd14ce945fca)
Diffstat (limited to 'media/libstagefright/codecs')
-rw-r--r--media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.cpp16
-rw-r--r--media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.h3
2 files changed, 15 insertions, 4 deletions
diff --git a/media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.cpp b/media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.cpp
index 875674b..bb5625f 100644
--- a/media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.cpp
+++ b/media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.cpp
@@ -76,6 +76,7 @@ SoftMPEG4::SoftMPEG4(
mInitialized(false),
mFramesConfigured(false),
mNumSamplesOutput(0),
+ mPvTime(0),
mOutputPortSettingsChange(NONE) {
if (!strcmp(name, "OMX.google.h263.decoder")) {
mMode = MODE_H263;
@@ -415,9 +416,14 @@ void SoftMPEG4::onQueueFilled(OMX_U32 portIndex) {
uint32_t useExtTimestamp = (inHeader->nOffset == 0);
- // decoder deals in ms, OMX in us.
- uint32_t timestamp =
- useExtTimestamp ? (inHeader->nTimeStamp + 500) / 1000 : 0xFFFFFFFF;
+ // decoder deals in ms (int32_t), OMX in us (int64_t)
+ // so use fake timestamp instead
+ uint32_t timestamp = 0xFFFFFFFF;
+ if (useExtTimestamp) {
+ mPvToOmxTimeMap.add(mPvTime, inHeader->nTimeStamp);
+ timestamp = mPvTime;
+ mPvTime++;
+ }
int32_t bufferSize = inHeader->nFilledLen;
int32_t tmp = bufferSize;
@@ -441,7 +447,8 @@ void SoftMPEG4::onQueueFilled(OMX_U32 portIndex) {
}
// decoder deals in ms, OMX in us.
- outHeader->nTimeStamp = timestamp * 1000;
+ outHeader->nTimeStamp = mPvToOmxTimeMap.valueFor(timestamp);
+ mPvToOmxTimeMap.removeItem(timestamp);
inHeader->nOffset += bufferSize;
inHeader->nFilledLen = 0;
@@ -572,6 +579,7 @@ void SoftMPEG4::onPortEnableCompleted(OMX_U32 portIndex, bool enabled) {
}
void SoftMPEG4::onReset() {
+ mPvToOmxTimeMap.clear();
mSignalledError = false;
mOutputPortSettingsChange = NONE;
mFramesConfigured = false;
diff --git a/media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.h b/media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.h
index 6df4c92..f71ccef 100644
--- a/media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.h
+++ b/media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.h
@@ -19,6 +19,7 @@
#define SOFT_MPEG4_H_
#include "SimpleSoftOMXComponent.h"
+#include <utils/KeyedVector.h>
struct tagvideoDecControls;
@@ -70,6 +71,8 @@ private:
bool mFramesConfigured;
int32_t mNumSamplesOutput;
+ int32_t mPvTime;
+ KeyedVector<int32_t, OMX_TICKS> mPvToOmxTimeMap;
enum {
NONE,