summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
Diffstat (limited to 'media')
-rw-r--r--media/libstagefright/OMXCodec.cpp28
-rw-r--r--media/libstagefright/codecs/on2/dec/VPXDecoder.cpp4
2 files changed, 31 insertions, 1 deletions
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index 247ace7..fccd68c 100644
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -1434,6 +1434,7 @@ OMXCodec::OMXCodec(
mSeekTimeUs(-1),
mSeekMode(ReadOptions::SEEK_CLOSEST_SYNC),
mTargetTimeUs(-1),
+ mOutputPortSettingsChangedPending(false),
mLeftOverBuffer(NULL),
mPaused(false),
mNativeWindow(nativeWindow) {
@@ -2344,6 +2345,14 @@ void OMXCodec::onCmdComplete(OMX_COMMANDTYPE cmd, OMX_U32 data) {
drainInputBuffers();
fillOutputBuffers();
}
+
+ if (mOutputPortSettingsChangedPending) {
+ CODEC_LOGV(
+ "Honoring deferred output port settings change.");
+
+ mOutputPortSettingsChangedPending = false;
+ onPortSettingsChanged(kPortIndexOutput);
+ }
}
break;
@@ -2407,6 +2416,8 @@ void OMXCodec::onStateChange(OMX_STATETYPE newState) {
CODEC_LOGV("Now Executing.");
+ mOutputPortSettingsChangedPending = false;
+
setState(EXECUTING);
// Buffers will be submitted to the component in the first
@@ -2520,6 +2531,14 @@ void OMXCodec::onPortSettingsChanged(OMX_U32 portIndex) {
CHECK_EQ((int)mState, (int)EXECUTING);
CHECK_EQ(portIndex, (OMX_U32)kPortIndexOutput);
+ CHECK(!mOutputPortSettingsChangedPending);
+
+ if (mPortStatus[kPortIndexOutput] != ENABLED) {
+ CODEC_LOGV("Deferring output port settings change.");
+ mOutputPortSettingsChangedPending = true;
+ return;
+ }
+
setState(RECONFIGURING);
if (mQuirks & kNeedsFlushBeforeDisable) {
@@ -2712,6 +2731,7 @@ bool OMXCodec::drainInputBuffer(BufferInfo *info) {
if (srcBuffer->meta_data()->findInt64(
kKeyTargetTime, &targetTimeUs)
&& targetTimeUs >= 0) {
+ CODEC_LOGV("targetTimeUs = %lld us", targetTimeUs);
mTargetTimeUs = targetTimeUs;
} else {
mTargetTimeUs = -1;
@@ -3385,6 +3405,14 @@ status_t OMXCodec::read(
}
if (seeking) {
+ while (mState == RECONFIGURING) {
+ mBufferFilled.wait(mLock);
+ }
+
+ if (mState != EXECUTING) {
+ return UNKNOWN_ERROR;
+ }
+
CODEC_LOGV("seeking to %lld us (%.2f secs)", seekTimeUs, seekTimeUs / 1E6);
mSignalledEOS = false;
diff --git a/media/libstagefright/codecs/on2/dec/VPXDecoder.cpp b/media/libstagefright/codecs/on2/dec/VPXDecoder.cpp
index 9433178..489e5ad 100644
--- a/media/libstagefright/codecs/on2/dec/VPXDecoder.cpp
+++ b/media/libstagefright/codecs/on2/dec/VPXDecoder.cpp
@@ -205,7 +205,9 @@ status_t VPXDecoder::read(
vpx_image_t *img = vpx_codec_get_frame((vpx_codec_ctx_t *)mCtx, &iter);
if (img == NULL) {
- LOGI("on2 decoder did not return a frame.");
+ // The VPX format supports "internal-only" frames that are
+ // referenced by future content but never actually displayed, so
+ // this is a perfectly valid scenario.
*out = new MediaBuffer(0);
return OK;