summaryrefslogtreecommitdiffstats
path: root/media/libstagefright
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2011-11-29 16:33:04 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2011-11-29 16:33:04 -0800
commit8afbf8e07fd1d75dfa0a517267beb6c1fa818027 (patch)
tree12a598f6c9508bd248943bec6bf227bca25c4a3f /media/libstagefright
parentc089d02cf2bddf1bba6eaa2b2fcce149dc44633e (diff)
parentb96d3c5195b148c0d695a326fa9c315561d787ef (diff)
downloadframeworks_av-8afbf8e07fd1d75dfa0a517267beb6c1fa818027.zip
frameworks_av-8afbf8e07fd1d75dfa0a517267beb6c1fa818027.tar.gz
frameworks_av-8afbf8e07fd1d75dfa0a517267beb6c1fa818027.tar.bz2
am 52607c53: am d12dc284: Merge "If an error occurs that prevents us from reallocating buffers during a format change" into ics-mr1
* commit '52607c5364446df6ac5b2f55cb50e146e6023a4f': If an error occurs that prevents us from reallocating buffers during a format change
Diffstat (limited to 'media/libstagefright')
-rw-r--r--media/libstagefright/ACodec.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index 0e8c874..e0100d8 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -342,6 +342,7 @@ void ACodec::initiateSetup(const sp<AMessage> &msg) {
}
void ACodec::signalFlush() {
+ LOGV("[%s] signalFlush", mComponentName.c_str());
(new AMessage(kWhatFlush, id()))->post();
}
@@ -1092,6 +1093,20 @@ status_t ACodec::initNativeWindow() {
return OK;
}
+size_t ACodec::countBuffersOwnedByComponent(OMX_U32 portIndex) const {
+ size_t n = 0;
+
+ for (size_t i = 0; i < mBuffers[portIndex].size(); ++i) {
+ const BufferInfo &info = mBuffers[portIndex].itemAt(i);
+
+ if (info.mStatus == BufferInfo::OWNED_BY_COMPONENT) {
+ ++n;
+ }
+ }
+
+ return n;
+}
+
bool ACodec::allYourBuffersAreBelongToUs(
OMX_U32 portIndex) {
for (size_t i = 0; i < mBuffers[portIndex].size(); ++i) {
@@ -2041,6 +2056,14 @@ bool ACodec::ExecutingState::onMessageReceived(const sp<AMessage> &msg) {
case kWhatFlush:
{
+ LOGV("[%s] ExecutingState flushing now "
+ "(codec owns %d/%d input, %d/%d output).",
+ mCodec->mComponentName.c_str(),
+ mCodec->countBuffersOwnedByComponent(kPortIndexInput),
+ mCodec->mBuffers[kPortIndexInput].size(),
+ mCodec->countBuffersOwnedByComponent(kPortIndexOutput),
+ mCodec->mBuffers[kPortIndexOutput].size());
+
mActive = false;
CHECK_EQ(mCodec->mOMX->sendCommand(
@@ -2180,6 +2203,12 @@ bool ACodec::OutputPortSettingsChangedState::onOMXEvent(
err);
mCodec->signalError();
+
+ // This is technically not correct, since we were unable
+ // to allocate output buffers and therefore the output port
+ // remains disabled. It is necessary however to allow us
+ // to shutdown the codec properly.
+ mCodec->changeState(mCodec->mExecutingState);
}
return true;
@@ -2408,6 +2437,9 @@ bool ACodec::FlushingState::onMessageReceived(const sp<AMessage> &msg) {
bool ACodec::FlushingState::onOMXEvent(
OMX_EVENTTYPE event, OMX_U32 data1, OMX_U32 data2) {
+ LOGV("[%s] FlushingState onOMXEvent(%d,%ld)",
+ mCodec->mComponentName.c_str(), event, data1);
+
switch (event) {
case OMX_EventCmdComplete:
{