Codec2: Retain compatibility with old HAL

Make the vndk module "libstagefright_bufferpool@2.0" work with existing
Codec2 HALs, and create a new vendor (non-vndk) module
"libstagefright_bufferpool@2.0.1" that new Codec2 HALs can use.

Test: atest CtsMediaTestCases -- \
--module-arg CtsMediaTestCases:size:small

Bug: 138171841
Bug: 140471279
Change-Id: I2886432afef86ef66fbd48ee744e5fd8de2d1e21
gugelfrei
Pawin Vongmasa 5 years ago
parent 87f731b26e
commit 329ac9c93b

@ -1,9 +1,5 @@
cc_library { cc_defaults {
name: "libstagefright_bufferpool@2.0", name: "libstagefright_bufferpool@2.0-default",
vendor_available: true,
vndk: {
enabled: true,
},
srcs: [ srcs: [
"Accessor.cpp", "Accessor.cpp",
"AccessorImpl.cpp", "AccessorImpl.cpp",
@ -31,3 +27,23 @@ cc_library {
"android.hardware.media.bufferpool@2.0", "android.hardware.media.bufferpool@2.0",
], ],
} }
cc_library {
name: "libstagefright_bufferpool@2.0.1",
defaults: ["libstagefright_bufferpool@2.0-default"],
vendor_available: true,
cflags: [
"-DBUFFERPOOL_CLONE_HANDLES",
],
}
// Deprecated. Do not use. Use libstagefright_bufferpool@2.0.1 instead.
cc_library {
name: "libstagefright_bufferpool@2.0",
defaults: ["libstagefright_bufferpool@2.0-default"],
vendor_available: true,
vndk: {
enabled: true,
},
}

@ -351,6 +351,7 @@ ResultStatus ClientManager::Impl::allocate(
} }
client = it->second; client = it->second;
} }
#ifdef BUFFERPOOL_CLONE_HANDLES
native_handle_t *origHandle; native_handle_t *origHandle;
ResultStatus res = client->allocate(params, &origHandle, buffer); ResultStatus res = client->allocate(params, &origHandle, buffer);
if (res != ResultStatus::OK) { if (res != ResultStatus::OK) {
@ -362,6 +363,9 @@ ResultStatus ClientManager::Impl::allocate(
return ResultStatus::NO_MEMORY; return ResultStatus::NO_MEMORY;
} }
return ResultStatus::OK; return ResultStatus::OK;
#else
return client->allocate(params, handle, buffer);
#endif
} }
ResultStatus ClientManager::Impl::receive( ResultStatus ClientManager::Impl::receive(
@ -377,6 +381,7 @@ ResultStatus ClientManager::Impl::receive(
} }
client = it->second; client = it->second;
} }
#ifdef BUFFERPOOL_CLONE_HANDLES
native_handle_t *origHandle; native_handle_t *origHandle;
ResultStatus res = client->receive( ResultStatus res = client->receive(
transactionId, bufferId, timestampUs, &origHandle, buffer); transactionId, bufferId, timestampUs, &origHandle, buffer);
@ -389,6 +394,9 @@ ResultStatus ClientManager::Impl::receive(
return ResultStatus::NO_MEMORY; return ResultStatus::NO_MEMORY;
} }
return ResultStatus::OK; return ResultStatus::OK;
#else
return client->receive(transactionId, bufferId, timestampUs, handle, buffer);
#endif
} }
ResultStatus ClientManager::Impl::postSend( ResultStatus ClientManager::Impl::postSend(

@ -24,7 +24,7 @@ cc_library {
"libgui", "libgui",
"libhidlbase", "libhidlbase",
"liblog", "liblog",
"libstagefright_bufferpool@2.0", "libstagefright_bufferpool@2.0.1",
"libui", "libui",
"libutils", "libutils",
], ],
@ -37,7 +37,7 @@ cc_library {
"android.hardware.media.c2@1.0", "android.hardware.media.c2@1.0",
"libcodec2", "libcodec2",
"libgui", "libgui",
"libstagefright_bufferpool@2.0", "libstagefright_bufferpool@2.0.1",
"libui", "libui",
], ],
} }
@ -83,7 +83,7 @@ cc_library {
"libhidltransport", "libhidltransport",
"libhwbinder", "libhwbinder",
"liblog", "liblog",
"libstagefright_bufferpool@2.0", "libstagefright_bufferpool@2.0.1",
"libstagefright_bufferqueue_helper", "libstagefright_bufferqueue_helper",
"libui", "libui",
"libutils", "libutils",
@ -98,7 +98,7 @@ cc_library {
"libcodec2", "libcodec2",
"libcodec2_vndk", "libcodec2_vndk",
"libhidlbase", "libhidlbase",
"libstagefright_bufferpool@2.0", "libstagefright_bufferpool@2.0.1",
"libui", "libui",
], ],
} }

@ -19,7 +19,7 @@ cc_library {
"libhidlbase", "libhidlbase",
"libhidltransport", "libhidltransport",
"liblog", "liblog",
"libstagefright_bufferpool@2.0", "libstagefright_bufferpool@2.0.1",
"libui", "libui",
"libutils", "libutils",
], ],

@ -66,7 +66,7 @@ cc_library_shared {
"liblog", "liblog",
"libnativewindow", "libnativewindow",
"libstagefright_foundation", "libstagefright_foundation",
"libstagefright_bufferpool@2.0", "libstagefright_bufferpool@2.0.1",
"libui", "libui",
"libutils", "libutils",
], ],

Loading…
Cancel
Save