summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2011-09-12 14:14:08 -0700
committerAndreas Huber <andih@google.com>2011-09-12 14:14:08 -0700
commitd41108c91fcf2f7a47b733c61ee5983cf22bd6a8 (patch)
treedd9c47c44c3fbabd34dd29f5711f3ba1e7b2e49c /media
parent92bda84b11ba2aec98036313784444d9f5aebc9a (diff)
downloadframeworks_base-d41108c91fcf2f7a47b733c61ee5983cf22bd6a8.zip
frameworks_base-d41108c91fcf2f7a47b733c61ee5983cf22bd6a8.tar.gz
frameworks_base-d41108c91fcf2f7a47b733c61ee5983cf22bd6a8.tar.bz2
Turn an another assertion into a runtime error in ACodec's implementation
Change-Id: I6779b29f200b90d088273ab3204724ef3d8d59bd related-to-bug: 5284760
Diffstat (limited to 'media')
-rw-r--r--media/libstagefright/ACodec.cpp40
1 files changed, 18 insertions, 22 deletions
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index e9dc61c..2ba2273 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -1131,6 +1131,13 @@ void ACodec::sendFormatChange() {
mSentFormat = true;
}
+void ACodec::signalError(OMX_ERRORTYPE error) {
+ sp<AMessage> notify = mNotify->dup();
+ notify->setInt32("what", ACodec::kWhatError);
+ notify->setInt32("omx-error", error);
+ notify->post();
+}
+
////////////////////////////////////////////////////////////////////////////////
ACodec::BaseState::BaseState(ACodec *codec, const sp<AState> &parentState)
@@ -1252,10 +1259,7 @@ bool ACodec::BaseState::onOMXEvent(
LOGE("[%s] ERROR(0x%08lx)", mCodec->mComponentName.c_str(), data1);
- sp<AMessage> notify = mCodec->mNotify->dup();
- notify->setInt32("what", ACodec::kWhatError);
- notify->setInt32("omx-error", data1);
- notify->post();
+ mCodec->signalError((OMX_ERRORTYPE)data1);
return true;
}
@@ -1548,12 +1552,14 @@ void ACodec::BaseState::onOutputBufferDrained(const sp<AMessage> &msg) {
&& msg->findInt32("render", &render) && render != 0) {
// The client wants this buffer to be rendered.
- CHECK_EQ(mCodec->mNativeWindow->queueBuffer(
+ if (mCodec->mNativeWindow->queueBuffer(
mCodec->mNativeWindow.get(),
- info->mGraphicBuffer.get()),
- 0);
-
- info->mStatus = BufferInfo::OWNED_BY_NATIVE_WINDOW;
+ info->mGraphicBuffer.get()) == OK) {
+ info->mStatus = BufferInfo::OWNED_BY_NATIVE_WINDOW;
+ } else {
+ mCodec->signalError();
+ info->mStatus = BufferInfo::OWNED_BY_US;
+ }
} else {
info->mStatus = BufferInfo::OWNED_BY_US;
}
@@ -1692,11 +1698,7 @@ void ACodec::UninitializedState::onSetup(
if (node == NULL) {
LOGE("Unable to instantiate a decoder for type '%s'.", mime.c_str());
- sp<AMessage> notify = mCodec->mNotify->dup();
- notify->setInt32("what", ACodec::kWhatError);
- notify->setInt32("omx-error", OMX_ErrorComponentNotFound);
- notify->post();
-
+ mCodec->signalError(OMX_ErrorComponentNotFound);
return;
}
@@ -1744,10 +1746,7 @@ void ACodec::LoadedToIdleState::stateEntered() {
"(error 0x%08x)",
err);
- sp<AMessage> notify = mCodec->mNotify->dup();
- notify->setInt32("what", ACodec::kWhatError);
- notify->setInt32("omx-error", OMX_ErrorUndefined);
- notify->post();
+ mCodec->signalError();
}
}
@@ -2063,10 +2062,7 @@ bool ACodec::OutputPortSettingsChangedState::onOMXEvent(
"port reconfiguration (error 0x%08x)",
err);
- sp<AMessage> notify = mCodec->mNotify->dup();
- notify->setInt32("what", ACodec::kWhatError);
- notify->setInt32("omx-error", OMX_ErrorUndefined);
- notify->post();
+ mCodec->signalError();
}
return true;