summaryrefslogtreecommitdiff
path: root/media/libstagefright/ACodec.cpp
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2012-06-26 10:56:14 -0700
committerAndreas Huber <andih@google.com>2012-08-07 13:08:15 -0700
commite671207115fac3914134c61b336d5fa0242c68ca (patch)
tree466cda101e1528b81bf72c228d7060c33788dedf /media/libstagefright/ACodec.cpp
parent28620ee3e9926ef07f0b4cb3e22b156b812e2d7e (diff)
Make sure codec names and corresponding quirks are returned together.
Previously they were returned in separate vectors and only one of them was sorted if software codecs were preferred, leaving the quirks no longer matching the codec name at the same index. Change-Id: Id3f1e6f9f7f8c9cc4b6ebfb86a203b4d59de8604 related-to-bug: 6737884
Diffstat (limited to 'media/libstagefright/ACodec.cpp')
-rw-r--r--media/libstagefright/ACodec.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index f96a429f..c37d2cae 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -2886,20 +2886,21 @@ bool ACodec::UninitializedState::onAllocateComponent(const sp<AMessage> &msg) {
sp<IOMX> omx = client.interface();
- Vector<String8> matchingCodecs;
- Vector<uint32_t> matchingCodecQuirks;
+ Vector<OMXCodec::CodecNameAndQuirks> matchingCodecs;
AString mime;
AString componentName;
uint32_t quirks;
if (msg->findString("componentName", &componentName)) {
- matchingCodecs.push_back(String8(componentName.c_str()));
+ ssize_t index = matchingCodecs.add();
+ OMXCodec::CodecNameAndQuirks *entry = &matchingCodecs.editItemAt(index);
+ entry->mName = String8(componentName.c_str());
- if (!OMXCodec::findCodecQuirks(componentName.c_str(), &quirks)) {
- quirks = 0;
+ if (!OMXCodec::findCodecQuirks(
+ componentName.c_str(), &entry->mQuirks)) {
+ entry->mQuirks = 0;
}
- matchingCodecQuirks.push_back(quirks);
} else {
CHECK(msg->findString("mime", &mime));
@@ -2913,8 +2914,7 @@ bool ACodec::UninitializedState::onAllocateComponent(const sp<AMessage> &msg) {
encoder, // createEncoder
NULL, // matchComponentName
0, // flags
- &matchingCodecs,
- &matchingCodecQuirks);
+ &matchingCodecs);
}
sp<CodecObserver> observer = new CodecObserver;
@@ -2922,8 +2922,8 @@ bool ACodec::UninitializedState::onAllocateComponent(const sp<AMessage> &msg) {
for (size_t matchIndex = 0; matchIndex < matchingCodecs.size();
++matchIndex) {
- componentName = matchingCodecs.itemAt(matchIndex).string();
- quirks = matchingCodecQuirks.itemAt(matchIndex);
+ componentName = matchingCodecs.itemAt(matchIndex).mName.string();
+ quirks = matchingCodecs.itemAt(matchIndex).mQuirks;
pid_t tid = androidGetTid();
int prevPriority = androidGetThreadPriority(tid);