From 3fb9f68dea5d991288f0ea8037742b50c7df5767 Mon Sep 17 00:00:00 2001 From: Wei Jia Date: Wed, 20 Aug 2014 14:30:09 -0700 Subject: ACodec: handle errors related to native window. Bug: 17068327 Bug: 13133027 Change-Id: I9875e524222a10d1be26be5a84b9633b4aaeb210 --- media/libstagefright/ACodec.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'media/libstagefright') diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp index b44d5cc..e4e463a 100644 --- a/media/libstagefright/ACodec.cpp +++ b/media/libstagefright/ACodec.cpp @@ -813,7 +813,10 @@ status_t ACodec::allocateOutputBuffersFromNativeWindow() { for (OMX_U32 i = cancelStart; i < cancelEnd; i++) { BufferInfo *info = &mBuffers[kPortIndexOutput].editItemAt(i); - cancelBufferToNativeWindow(info); + status_t error = cancelBufferToNativeWindow(info); + if (err == 0) { + err = error; + } } return err; @@ -888,11 +891,12 @@ status_t ACodec::cancelBufferToNativeWindow(BufferInfo *info) { int err = mNativeWindow->cancelBuffer( mNativeWindow.get(), info->mGraphicBuffer.get(), -1); - CHECK_EQ(err, 0); + ALOGW_IF(err != 0, "[%s] can not return buffer %u to native window", + mComponentName.c_str(), info->mBufferID); info->mStatus = BufferInfo::OWNED_BY_NATIVE_WINDOW; - return OK; + return err; } ACodec::BufferInfo *ACodec::dequeueBufferFromNativeWindow() { @@ -992,7 +996,7 @@ status_t ACodec::freeBuffer(OMX_U32 portIndex, size_t i) { if (portIndex == kPortIndexOutput && mNativeWindow != NULL && info->mStatus == BufferInfo::OWNED_BY_US) { - CHECK_EQ((status_t)OK, cancelBufferToNativeWindow(info)); + cancelBufferToNativeWindow(info); } CHECK_EQ(mOMX->freeBuffer( -- cgit v1.1