summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/ACodec.cpp
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2011-08-26 16:02:19 -0700
committerAndreas Huber <andih@google.com>2011-08-26 16:02:19 -0700
commitcb67cd1b51ff9ab221e3124cf7e546515fef3c87 (patch)
tree9bc33d4f184b31279929c4f59544444fe5442984 /media/libstagefright/ACodec.cpp
parent8d9d585ce5b1aa284289a27dda048c6317b104e7 (diff)
downloadframeworks_av-cb67cd1b51ff9ab221e3124cf7e546515fef3c87.zip
frameworks_av-cb67cd1b51ff9ab221e3124cf7e546515fef3c87.tar.gz
frameworks_av-cb67cd1b51ff9ab221e3124cf7e546515fef3c87.tar.bz2
Signal errors to the client instead of asserting in ACodec.
Also make sure NuPlayer can properly shutdown in certain edge cases. Change-Id: Iceb16d600d87ba66c802e60e95bf62f66487a453
Diffstat (limited to 'media/libstagefright/ACodec.cpp')
-rw-r--r--media/libstagefright/ACodec.cpp26
1 files changed, 23 insertions, 3 deletions
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index 5d91f6a..e9dc61c 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -1738,7 +1738,17 @@ ACodec::LoadedToIdleState::LoadedToIdleState(ACodec *codec)
void ACodec::LoadedToIdleState::stateEntered() {
LOGV("[%s] Now Loaded->Idle", mCodec->mComponentName.c_str());
- CHECK_EQ(allocateBuffers(), (status_t)OK);
+ status_t err;
+ if ((err = allocateBuffers()) != OK) {
+ LOGE("Failed to allocate buffers after transitioning to IDLE state "
+ "(error 0x%08x)",
+ err);
+
+ sp<AMessage> notify = mCodec->mNotify->dup();
+ notify->setInt32("what", ACodec::kWhatError);
+ notify->setInt32("omx-error", OMX_ErrorUndefined);
+ notify->post();
+ }
}
status_t ACodec::LoadedToIdleState::allocateBuffers() {
@@ -2046,8 +2056,18 @@ bool ACodec::OutputPortSettingsChangedState::onOMXEvent(
mCodec->mNode, OMX_CommandPortEnable, kPortIndexOutput),
(status_t)OK);
- CHECK_EQ(mCodec->allocateBuffersOnPort(kPortIndexOutput),
- (status_t)OK);
+ status_t err;
+ if ((err = mCodec->allocateBuffersOnPort(
+ kPortIndexOutput)) != OK) {
+ LOGE("Failed to allocate output port buffers after "
+ "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();
+ }
return true;
} else if (data1 == (OMX_U32)OMX_CommandPortEnable) {