diff options
author | Andy McFadden <fadden@android.com> | 2013-03-05 14:31:02 -0800 |
---|---|---|
committer | Andy McFadden <fadden@android.com> | 2013-03-05 16:29:55 -0800 |
commit | ba6218eae3dbcf3f962b3561b26374a214dbf5e2 (patch) | |
tree | 4b7922c6822c116b67123022fa48489a23724fe7 /media/libstagefright/omx/OMXNodeInstance.cpp | |
parent | a7a5917a064710edea9cfacc8eda44532150e852 (diff) | |
download | frameworks_av-ba6218eae3dbcf3f962b3561b26374a214dbf5e2.zip frameworks_av-ba6218eae3dbcf3f962b3561b26374a214dbf5e2.tar.gz frameworks_av-ba6218eae3dbcf3f962b3561b26374a214dbf5e2.tar.bz2 |
Correct MediaCodec + Surface behavior
Assorted tweaks:
- Allow signalEndOfInputStream() before ACodec is in Executing
state (added message to two more states).
- Return an error if signalEndOfInputStream() is called a second
time on the same stream.
- Require AndroidOpaque color format in createInputSurface().
- Disallow dequeueInputBuffer() after an input surface has been
created (boolean flag in MediaCodec tracks it).
- Discard input surface when encoder is re-configure()ed (drop
OMXNodeInstance's ref when we go back to Loaded).
Bug 7991062
Change-Id: Iff30f3036e14eb5a2f6536910dcf11aba33031ee
Diffstat (limited to 'media/libstagefright/omx/OMXNodeInstance.cpp')
-rw-r--r-- | media/libstagefright/omx/OMXNodeInstance.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/media/libstagefright/omx/OMXNodeInstance.cpp b/media/libstagefright/omx/OMXNodeInstance.cpp index 6c2c33b..f3d8d14 100644 --- a/media/libstagefright/omx/OMXNodeInstance.cpp +++ b/media/libstagefright/omx/OMXNodeInstance.cpp @@ -584,6 +584,11 @@ status_t OMXNodeInstance::createInputSurface( mHandle, OMX_IndexParamPortDefinition, &def); CHECK(oerr == OMX_ErrorNone); + if (def.format.video.eColorFormat != OMX_COLOR_FormatAndroidOpaque) { + ALOGE("createInputSurface requires AndroidOpaque color format"); + return INVALID_OPERATION; + } + GraphicBufferSource* bufferSource = new GraphicBufferSource( this, def.format.video.nFrameWidth, def.format.video.nFrameHeight); if ((err = bufferSource->initCheck()) != OK) { @@ -602,11 +607,10 @@ status_t OMXNodeInstance::signalEndOfInputStream() { // flag set). Seems easier than doing the equivalent from here. sp<GraphicBufferSource> bufferSource(getGraphicBufferSource()); if (bufferSource == NULL) { - ALOGW("signalEndOfInputStream should only be used with Surface input"); + ALOGW("signalEndOfInputStream can only be used with Surface input"); return INVALID_OPERATION; }; - bufferSource->signalEndOfInputStream(); - return OK; + return bufferSource->signalEndOfInputStream(); } status_t OMXNodeInstance::allocateBuffer( @@ -801,8 +805,11 @@ void OMXNodeInstance::onEvent( arg1 == OMX_CommandStateSet) { if (arg2 == OMX_StateExecuting) { bufferSource->omxExecuting(); - } else if (arg2 == OMX_StateIdle) { - bufferSource->omxIdling(); + } else if (arg2 == OMX_StateLoaded) { + // Must be shutting down -- won't have a GraphicBufferSource + // on the way up. + bufferSource->omxLoaded(); + setGraphicBufferSource(NULL); } } } |