From fef257e3b67ff6add7ffd30bb0e78680b6800184 Mon Sep 17 00:00:00 2001 From: Tony Kim Date: Thu, 29 Jul 2022 06:07:24 +0900 Subject: [PATCH] [MMCEI-9962][AI2-47] AppleTV FF 3X and 1X resume issue - timeout on resolution. Change-Id: Id25be602d14eeca2231111f00bd313427bf84300 --- media/libstagefright/ACodec.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp index 3ee7b3f..c3457e8 100644 --- a/media/libstagefright/ACodec.cpp +++ b/media/libstagefright/ACodec.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -//#define LOG_NDEBUG 0 +#define LOG_NDEBUG 0 #define LOG_TAG "ACodec" #ifdef __LP64__ @@ -1121,6 +1121,8 @@ status_t ACodec::configureOutputBuffersFromNativeWindow( OMX_U32 *bufferCount, OMX_U32 *bufferSize, OMX_U32 *minUndequeuedBuffers, bool preregister) { + ALOGD("[%s] configureOutputBuffersFromNativeWindow Enter\n", mComponentName.c_str()); + OMX_PARAM_PORTDEFINITIONTYPE def; InitOMXParams(&def); def.nPortIndex = kPortIndexOutput; @@ -1160,6 +1162,7 @@ status_t ACodec::configureOutputBuffersFromNativeWindow( mNativeWindow.get(), NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS, (int *)minUndequeuedBuffers); + ALOGD("[%s] minUndequeuedBuffers:%u\n", mComponentName.c_str(), *minUndequeuedBuffers); if (err != 0) { ALOGE("NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS query failed: %s (%d)", strerror(-err), -err); @@ -1209,6 +1212,7 @@ status_t ACodec::configureOutputBuffersFromNativeWindow( *bufferCount = def.nBufferCountActual; *bufferSize = def.nBufferSize; + ALOGD("[%s] configureOutputBuffersFromNativeWindow leave, bufferCount:%u, bufferSize:%u\n", mComponentName.c_str(), *bufferCount, *bufferSize); return err; } @@ -1235,7 +1239,9 @@ status_t ACodec::allocateOutputBuffersFromNativeWindow() { for (OMX_U32 i = 0; i < bufferCount; i++) { ANativeWindowBuffer *buf; int fenceFd; + ALOGV("[%s] [%d] dequeueBuffer begin", mComponentName.c_str(), i); err = mNativeWindow->dequeueBuffer(mNativeWindow.get(), &buf, &fenceFd); + ALOGV("[%s] [%d] dequeueBuffer end", mComponentName.c_str(), i); if (err != 0) { ALOGE("dequeueBuffer failed: %s (%d)", strerror(-err), -err); break; @@ -8074,7 +8080,9 @@ bool ACodec::ExecutingState::onOMXEvent( OMX_CommandPortDisable, kPortIndexOutput), (status_t)OK); + ALOGD("[%s] free ANW buffer begin\n", mCodec->mComponentName.c_str()); mCodec->freeOutputBuffersNotOwnedByComponent(); + ALOGD("[%s] free ANW buffer end\n", mCodec->mComponentName.c_str()); mCodec->changeState(mCodec->mOutputPortSettingsChangedState); } else if (data2 != OMX_IndexConfigCommonOutputCrop @@ -8183,10 +8191,13 @@ void ACodec::OutputPortSettingsChangedState::stateEntered() { ALOGV("[%s] Now handling output port settings change", mCodec->mComponentName.c_str()); - // If we haven't transitioned after 3 seconds, we're probably stuck. + // If we haven't transitioned after 10 seconds, we're probably stuck. sp msg = new AMessage(ACodec::kWhatCheckIfStuck, mCodec); msg->setInt32("generation", mCodec->mStateGeneration); - msg->post(3000000); +// msg->post(10000000); +// msg->post(7000000); +// msg->post(3000000); + msg->post(20000000); } bool ACodec::OutputPortSettingsChangedState::onOMXFrameRendered( @@ -8227,7 +8238,9 @@ bool ACodec::OutputPortSettingsChangedState::onOMXEvent( mCodec->mRenderTracker.clear(systemTime(CLOCK_MONOTONIC)); if (err == OK) { + ALOGD("[%s] allocateBuffersOnPort begin\n", mCodec->mComponentName.c_str()); err = mCodec->allocateBuffersOnPort(kPortIndexOutput); + ALOGD("[%s] allocateBuffersOnPort end\n", mCodec->mComponentName.c_str()); ALOGE_IF(err != OK, "Failed to allocate output port buffers after port " "reconfiguration: (%d)", err); mCodec->mCallback->onOutputBuffersChanged(); -- 2.7.4