diff options
author | Rachad <rachad@google.com> | 2014-09-22 19:34:31 -0700 |
---|---|---|
committer | Rachad <rachad@google.com> | 2014-09-28 15:33:34 -0700 |
commit | ab76066c11e988ca3d3a5d6d74dd510ae080322e (patch) | |
tree | deb4cccdb021f1e7aa0dd147f187a96b51b43d4c /media/libstagefright/ACodec.cpp | |
parent | 9f8551ffa967bd8a4d0a52487a183dcf8b22d91f (diff) | |
download | frameworks_av-ab76066c11e988ca3d3a5d6d74dd510ae080322e.zip frameworks_av-ab76066c11e988ca3d3a5d6d74dd510ae080322e.tar.gz frameworks_av-ab76066c11e988ca3d3a5d6d74dd510ae080322e.tar.bz2 |
stagefright: do not allocate output buffers for tunneled playback
Do not allocate native window buffers for tunneled video playback codecs.
Bug: 17112525
Change-Id: I262d8030a9df6188938fde5d62ebce8faf7dba1f
Diffstat (limited to 'media/libstagefright/ACodec.cpp')
-rw-r--r-- | media/libstagefright/ACodec.cpp | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp index 9b03b71..e812ad0 100644 --- a/media/libstagefright/ACodec.cpp +++ b/media/libstagefright/ACodec.cpp @@ -420,7 +420,8 @@ ACodec::ACodec() mMaxPtsGapUs(-1ll), mTimePerFrameUs(-1ll), mTimePerCaptureUs(-1ll), - mCreateInputBuffersSuspended(false) { + mCreateInputBuffersSuspended(false), + mTunneled(false) { mUninitializedState = new UninitializedState(this); mLoadedState = new LoadedState(this); mLoadedToIdleState = new LoadedToIdleState(this); @@ -696,6 +697,21 @@ status_t ACodec::configureOutputBuffersFromNativeWindow( return err; } + // Exits here for tunneled video playback codecs -- i.e. skips native window + // buffer allocation step as this is managed by the tunneled OMX omponent + // itself and explicitly sets def.nBufferCountActual to 0. + if (mTunneled) { + ALOGV("Tunneled Playback: skipping native window buffer allocation."); + def.nBufferCountActual = 0; + err = mOMX->setParameter( + mNode, OMX_IndexParamPortDefinition, &def, sizeof(def)); + + *minUndequeuedBuffers = 0; + *bufferCount = 0; + *bufferSize = 0; + return err; + } + *minUndequeuedBuffers = 0; err = mNativeWindow->query( mNativeWindow.get(), NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS, @@ -903,6 +919,13 @@ ACodec::BufferInfo *ACodec::dequeueBufferFromNativeWindow() { ANativeWindowBuffer *buf; int fenceFd = -1; CHECK(mNativeWindow.get() != NULL); + + if (mTunneled) { + ALOGW("dequeueBufferFromNativeWindow() should not be called in tunnel" + " video playback mode mode!"); + return NULL; + } + if (native_window_dequeue_buffer_and_wait(mNativeWindow.get(), &buf) != 0) { ALOGE("dequeueBuffer failed."); return NULL; @@ -1244,6 +1267,7 @@ status_t ACodec::configureCodec( if (msg->findInt32("feature-tunneled-playback", &tunneled) && tunneled != 0) { ALOGI("Configuring TUNNELED video playback."); + mTunneled = true; int32_t audioHwSync = 0; if (!msg->findInt32("audio-hw-sync", &audioHwSync)) { @@ -1258,6 +1282,9 @@ status_t ACodec::configureCodec( inputFormat->setInt32("adaptive-playback", true); } else { + ALOGV("Configuring CPU controlled video playback."); + mTunneled = false; + // Always try to enable dynamic output buffers on native surface err = mOMX->storeMetaDataInBuffers( mNode, kPortIndexOutput, OMX_TRUE); |