Revert "Allow empty IOmxStore implementation"
This reverts commit fcbaadcd32ebee76ade68d8ed865f3a3190527b1, which was
made originally for b/68491141.
Bug: 69110957
(cherry picked from commit 77a5b891eb2c64246c82d695aac40c5312f0ff3e)
Change-Id: Iabba2c1b91a5d627a13b7e3a869d98656c9b2fe1
diff --git a/media/libstagefright/Android.bp b/media/libstagefright/Android.bp
index 0c71487..7ba4b7d 100644
--- a/media/libstagefright/Android.bp
+++ b/media/libstagefright/Android.bp
@@ -100,10 +100,8 @@
"libui",
"libutils",
"libmedia_helper",
- "libstagefright_foundation",
- "libstagefright_omx",
"libstagefright_omx_utils",
- "libstagefright_xmlparser",
+ "libstagefright_foundation",
"libdl",
"libRScpp",
"libhidlbase",
diff --git a/media/libstagefright/OmxInfoBuilder.cpp b/media/libstagefright/OmxInfoBuilder.cpp
index a6ebadd..c174371 100644
--- a/media/libstagefright/OmxInfoBuilder.cpp
+++ b/media/libstagefright/OmxInfoBuilder.cpp
@@ -35,7 +35,6 @@
#include <media/IOMX.h>
#include <media/omx/1.0/WOmx.h>
-#include <media/stagefright/omx/1.0/OmxStore.h>
#include <media/openmax/OMX_Index.h>
#include <media/openmax/OMX_IndexExt.h>
@@ -90,6 +89,8 @@
}
status_t OmxInfoBuilder::buildMediaCodecList(MediaCodecListWriter* writer) {
+ hidl_vec<IOmxStore::RoleInfo> roles;
+
// Obtain IOmxStore
sp<IOmxStore> omxStore = IOmxStore::getService();
if (omxStore == nullptr) {
@@ -99,37 +100,8 @@
// List service attributes (global settings)
Status status;
- hidl_vec<IOmxStore::RoleInfo> roles;
- auto transStatus = omxStore->listRoles(
- [&roles] (
- const hidl_vec<IOmxStore::RoleInfo>& inRoleList) {
- roles = inRoleList;
- });
- if (!transStatus.isOk()) {
- ALOGE("Fail to obtain codec roles from IOmxStore.");
- return NO_INIT;
- } else if (roles.size() == 0) {
- ALOGW("IOmxStore has empty implementation. "
- "Creating a local default instance...");
- omxStore = new implementation::OmxStore();
- if (omxStore == nullptr) {
- ALOGE("Cannot create a local default instance.");
- return NO_INIT;
- }
- ALOGI("IOmxStore local default instance created.");
- transStatus = omxStore->listRoles(
- [&roles] (
- const hidl_vec<IOmxStore::RoleInfo>& inRoleList) {
- roles = inRoleList;
- });
- if (!transStatus.isOk()) {
- ALOGE("Fail to obtain codec roles from local IOmxStore.");
- return NO_INIT;
- }
- }
-
hidl_vec<IOmxStore::ServiceAttribute> serviceAttributes;
- transStatus = omxStore->listServiceAttributes(
+ auto transStatus = omxStore->listServiceAttributes(
[&status, &serviceAttributes] (
Status inStatus,
const hidl_vec<IOmxStore::ServiceAttribute>& inAttributes) {
@@ -149,6 +121,16 @@
p.key.c_str(), p.value.c_str());
}
+ transStatus = omxStore->listRoles(
+ [&roles] (
+ const hidl_vec<IOmxStore::RoleInfo>& inRoleList) {
+ roles = inRoleList;
+ });
+ if (!transStatus.isOk()) {
+ ALOGE("Fail to obtain codec roles from IOmxStore.");
+ return NO_INIT;
+ }
+
// Convert roles to lists of codecs
// codec name -> index into swCodecs/hwCodecs