diff options
author | Rachad <rachad@google.com> | 2014-10-07 01:56:59 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-10-07 01:56:59 +0000 |
commit | 584c14c370f141685b7e8963a13ed91584383ca1 (patch) | |
tree | 3fec4de36f0907212c5d7f2375f537bcfb3f9c35 | |
parent | e48b90d634f9e6190a788e6225927d418b11d162 (diff) | |
parent | ab76066c11e988ca3d3a5d6d74dd510ae080322e (diff) | |
download | frameworks_av-584c14c370f141685b7e8963a13ed91584383ca1.zip frameworks_av-584c14c370f141685b7e8963a13ed91584383ca1.tar.gz frameworks_av-584c14c370f141685b7e8963a13ed91584383ca1.tar.bz2 |
Merge "stagefright: do not allocate output buffers for tunneled playback" into lmp-dev
-rw-r--r-- | include/media/stagefright/ACodec.h | 2 | ||||
-rw-r--r-- | media/libstagefright/ACodec.cpp | 29 |
2 files changed, 30 insertions, 1 deletions
diff --git a/include/media/stagefright/ACodec.h b/include/media/stagefright/ACodec.h index 28e5c56..d77ddaf 100644 --- a/include/media/stagefright/ACodec.h +++ b/include/media/stagefright/ACodec.h @@ -217,6 +217,8 @@ private: bool mCreateInputBuffersSuspended; + bool mTunneled; + status_t setCyclicIntraMacroblockRefresh(const sp<AMessage> &msg, int32_t mode); status_t allocateBuffersOnPort(OMX_U32 portIndex); status_t freeBuffersOnPort(OMX_U32 portIndex); diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp index b6ac2a0..b693625 100644 --- a/media/libstagefright/ACodec.cpp +++ b/media/libstagefright/ACodec.cpp @@ -421,7 +421,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); @@ -697,6 +698,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, @@ -904,6 +920,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; @@ -1245,6 +1268,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)) { @@ -1259,6 +1283,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); |