diff options
author | Andreas Huber <andih@google.com> | 2013-11-08 08:25:32 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-11-08 08:25:32 -0800 |
commit | 2e70b42e2af66f4abb22a95c5d642175c007e256 (patch) | |
tree | a018e3a8464eea0b11736b12b181a9d643c16a9a /media/libstagefright | |
parent | 8c8c9fb742f678ca34f78fff05274690ba6b00a5 (diff) | |
parent | 86f79f2332efad4862a4dd56f9552c93bbb52bcf (diff) | |
download | frameworks_av-2e70b42e2af66f4abb22a95c5d642175c007e256.zip frameworks_av-2e70b42e2af66f4abb22a95c5d642175c007e256.tar.gz frameworks_av-2e70b42e2af66f4abb22a95c5d642175c007e256.tar.bz2 |
am 86f79f23: am 51ac2d64: Merge "Properly handle executing->idle in GraphicBufferSource" into klp-dev
* commit '86f79f2332efad4862a4dd56f9552c93bbb52bcf':
Properly handle executing->idle in GraphicBufferSource
Diffstat (limited to 'media/libstagefright')
-rw-r--r-- | media/libstagefright/omx/GraphicBufferSource.cpp | 12 | ||||
-rw-r--r-- | media/libstagefright/omx/GraphicBufferSource.h | 5 | ||||
-rw-r--r-- | media/libstagefright/omx/OMXNodeInstance.cpp | 19 |
3 files changed, 29 insertions, 7 deletions
diff --git a/media/libstagefright/omx/GraphicBufferSource.cpp b/media/libstagefright/omx/GraphicBufferSource.cpp index 7d45386..a7c5317 100644 --- a/media/libstagefright/omx/GraphicBufferSource.cpp +++ b/media/libstagefright/omx/GraphicBufferSource.cpp @@ -148,6 +148,18 @@ void GraphicBufferSource::omxExecuting() { } } +void GraphicBufferSource::omxIdle() { + ALOGV("omxIdle"); + + Mutex::Autolock autoLock(mMutex); + + if (mExecuting) { + // We are only interested in the transition from executing->idle, + // not loaded->idle. + mEndOfStream = mEndOfStreamSent = true; + } +} + void GraphicBufferSource::omxLoaded(){ Mutex::Autolock autoLock(mMutex); if (!mExecuting) { diff --git a/media/libstagefright/omx/GraphicBufferSource.h b/media/libstagefright/omx/GraphicBufferSource.h index 244a843..9e5eee6 100644 --- a/media/libstagefright/omx/GraphicBufferSource.h +++ b/media/libstagefright/omx/GraphicBufferSource.h @@ -69,6 +69,11 @@ public: // sitting in the BufferQueue, this will send them to the codec. void omxExecuting(); + // This is called when OMX transitions to OMX_StateIdle, indicating that + // the codec is meant to return all buffers back to the client for them + // to be freed. Do NOT submit any more buffers to the component. + void omxIdle(); + // This is called when OMX transitions to OMX_StateLoaded, indicating that // we are shutting down. void omxLoaded(); diff --git a/media/libstagefright/omx/OMXNodeInstance.cpp b/media/libstagefright/omx/OMXNodeInstance.cpp index 46e5d71..5f104fc 100644 --- a/media/libstagefright/omx/OMXNodeInstance.cpp +++ b/media/libstagefright/omx/OMXNodeInstance.cpp @@ -243,13 +243,18 @@ status_t OMXNodeInstance::freeNode(OMXMaster *master) { status_t OMXNodeInstance::sendCommand( OMX_COMMANDTYPE cmd, OMX_S32 param) { const sp<GraphicBufferSource>& bufferSource(getGraphicBufferSource()); - if (bufferSource != NULL - && cmd == OMX_CommandStateSet - && param == OMX_StateLoaded) { - // Initiating transition from Executing -> Loaded - // Buffers are about to be freed. - bufferSource->omxLoaded(); - setGraphicBufferSource(NULL); + if (bufferSource != NULL && cmd == OMX_CommandStateSet) { + if (param == OMX_StateIdle) { + // Initiating transition from Executing -> Idle + // ACodec is waiting for all buffers to be returned, do NOT + // submit any more buffers to the codec. + bufferSource->omxIdle(); + } else if (param == OMX_StateLoaded) { + // Initiating transition from Idle/Executing -> Loaded + // Buffers are about to be freed. + bufferSource->omxLoaded(); + setGraphicBufferSource(NULL); + } // fall through } |