summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/ACodec.cpp
diff options
context:
space:
mode:
authorManikanta Kanamarlapudi <kmanikan@codeaurora.org>2015-04-09 11:13:47 +0530
committerGerrit Code Review <gerrit@cyanogenmod.org>2015-12-09 22:52:49 -0800
commit7450c3dafe7413576e30b249834f31785e92cc25 (patch)
treee52af8c91219e9c6e3edefee18f6df1f32a65454 /media/libstagefright/ACodec.cpp
parentc97328535b36bb30a6242f26e161722c1bbbc3d3 (diff)
downloadframeworks_av-7450c3dafe7413576e30b249834f31785e92cc25.zip
frameworks_av-7450c3dafe7413576e30b249834f31785e92cc25.tar.gz
frameworks_av-7450c3dafe7413576e30b249834f31785e92cc25.tar.bz2
libstagefright: Fix for testException
Handled decoder configure call for encoder component and vice-versa in fallback logic CRs-Fixed: 891538 Change-Id: Ibb0d2da829a0e0f907ad8265836bac0466de1b4d
Diffstat (limited to 'media/libstagefright/ACodec.cpp')
-rw-r--r--media/libstagefright/ACodec.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index 9ab53fa..ea91085 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -506,6 +506,8 @@ ACodec::ACodec()
mSentFormat(false),
mIsVideo(false),
mIsEncoder(false),
+ mEncoderComponent(false),
+ mComponentAllocByName(false),
mFatalError(false),
mShutdownInProgress(false),
mExplicitShutdown(false),
@@ -5507,6 +5509,8 @@ void ACodec::UninitializedState::stateEntered() {
mCodec->mOMX.clear();
mCodec->mQuirks = 0;
mCodec->mFlags = 0;
+ mCodec->mEncoderComponent = 0;
+ mCodec->mComponentAllocByName = 0;
mCodec->mInputMetadataType = kMetadataBufferTypeInvalid;
mCodec->mOutputMetadataType = kMetadataBufferTypeInvalid;
mCodec->mComponentName.clear();
@@ -5612,6 +5616,7 @@ bool ACodec::UninitializedState::onAllocateComponent(const sp<AMessage> &msg) {
ssize_t index = matchingCodecs.add();
OMXCodec::CodecNameAndQuirks *entry = &matchingCodecs.editItemAt(index);
entry->mName = String8(componentName.c_str());
+ mCodec->mComponentAllocByName = true;
if (!OMXCodec::findCodecQuirks(
componentName.c_str(), &entry->mQuirks)) {
@@ -5624,6 +5629,10 @@ bool ACodec::UninitializedState::onAllocateComponent(const sp<AMessage> &msg) {
encoder = false;
}
+ if (encoder == true) {
+ mCodec->mEncoderComponent = true;
+ }
+
OMXCodec::findMatchingCodecs(
mime.c_str(),
encoder, // createEncoder
@@ -5826,17 +5835,13 @@ bool ACodec::LoadedState::onConfigureComponent(
ALOGE("[%s] configureCodec returning error %d",
mCodec->mComponentName.c_str(), err);
- int32_t encoder;
- if (!msg->findInt32("encoder", &encoder)) {
- encoder = false;
- }
-
- if (!encoder && !strncmp(mime.c_str(), "video/", strlen("video/"))) {
+ if (!mCodec->mEncoderComponent && !mCodec->mComponentAllocByName &&
+ !strncmp(mime.c_str(), "video/", strlen("video/"))) {
Vector<OMXCodec::CodecNameAndQuirks> matchingCodecs;
OMXCodec::findMatchingCodecs(
mime.c_str(),
- encoder, // createEncoder
+ false, // createEncoder
NULL, // matchComponentName
0, // flags
&matchingCodecs);
@@ -5878,8 +5883,7 @@ bool ACodec::LoadedState::onConfigureComponent(
if (mCodec->mNode == 0) {
if (!mime.empty()) {
- ALOGE("Unable to instantiate a %scoder for type '%s' with err %#x.",
- encoder ? "en" : "de", mime.c_str(), err);
+ ALOGE("Unable to instantiate a decoder for type '%s'", mime.c_str());
} else {
ALOGE("Unable to instantiate codec '%s' with err %#x.", componentName.c_str(), err);
}