Merge "AIDL effect: Replace offload check with HardwareAccelerator mode" into main
diff --git a/camera/Camera.cpp b/camera/Camera.cpp
index 35b8e21..6b040ab 100644
--- a/camera/Camera.cpp
+++ b/camera/Camera.cpp
@@ -245,7 +245,7 @@
ALOGV("getParameters");
String8 params;
sp <::android::hardware::ICamera> c = mCamera;
- if (c != 0) params = mCamera->getParameters();
+ if (c != 0) params = c->getParameters();
return params;
}
@@ -269,7 +269,7 @@
ALOGV("setPreviewCallbackFlags");
sp <::android::hardware::ICamera> c = mCamera;
if (c == 0) return;
- mCamera->setPreviewCallbackFlag(flag);
+ c->setPreviewCallbackFlag(flag);
}
status_t Camera::setPreviewCallbackTarget(
diff --git a/drm/mediadrm/plugins/clearkey/aidl/Android.bp b/drm/mediadrm/plugins/clearkey/aidl/Android.bp
index eaf5051..0b0d46a 100644
--- a/drm/mediadrm/plugins/clearkey/aidl/Android.bp
+++ b/drm/mediadrm/plugins/clearkey/aidl/Android.bp
@@ -8,21 +8,7 @@
}
cc_defaults {
- name: "aidl_clearkey_service_defaults",
- vendor: true,
-
- srcs: [
- "CreatePluginFactories.cpp",
- "CryptoPlugin.cpp",
- "DrmFactory.cpp",
- "DrmPlugin.cpp",
- ],
-
- relative_install_path: "hw",
-
- cflags: ["-Wall", "-Werror", "-Wthread-safety"],
-
- include_dirs: ["frameworks/av/include"],
+ name: "aidl_clearkey_service_defaults-use-shared-deps",
shared_libs: [
"libbase",
@@ -39,6 +25,46 @@
"libclearkeybase",
"libjsoncpp",
],
+}
+
+cc_defaults {
+ name: "aidl_clearkey_service_defaults-use-static-deps",
+
+ stl: "c++_static",
+
+ shared_libs: [
+ "libbinder_ndk",
+ "libcrypto",
+ "liblog",
+ ],
+
+ static_libs: [
+ "android.hardware.common-V2-ndk",
+ "android.hardware.drm-V1-ndk",
+ "libbase",
+ "libclearkeybase",
+ "libjsoncpp",
+ "libprotobuf-cpp-lite",
+ "libutils",
+ ],
+}
+
+cc_defaults {
+ name: "aidl_clearkey_service_defaults",
+ vendor: true,
+
+ srcs: [
+ "CreatePluginFactories.cpp",
+ "CryptoPlugin.cpp",
+ "DrmFactory.cpp",
+ "DrmPlugin.cpp",
+ ],
+
+ relative_install_path: "hw",
+
+ cflags: ["-Wall", "-Werror", "-Wthread-safety"],
+
+ include_dirs: ["frameworks/av/include"],
local_include_dirs: ["include"],
@@ -49,7 +75,10 @@
cc_binary {
name: "android.hardware.drm-service.clearkey",
- defaults: ["aidl_clearkey_service_defaults"],
+ defaults: [
+ "aidl_clearkey_service_defaults",
+ "aidl_clearkey_service_defaults-use-shared-deps",
+ ],
srcs: ["Service.cpp"],
init_rc: ["android.hardware.drm-service.clearkey.rc"],
vintf_fragments: ["android.hardware.drm-service.clearkey.xml"],
@@ -57,17 +86,31 @@
cc_binary {
name: "android.hardware.drm-service-lazy.clearkey",
- defaults: ["aidl_clearkey_service_defaults"],
+ defaults: [
+ "aidl_clearkey_service_defaults",
+ "aidl_clearkey_service_defaults-use-shared-deps",
+ ],
overrides: ["android.hardware.drm-service.clearkey"],
srcs: ["ServiceLazy.cpp"],
init_rc: ["android.hardware.drm-service-lazy.clearkey.rc"],
vintf_fragments: ["android.hardware.drm-service.clearkey.xml"],
}
+cc_binary {
+ name: "android.hardware.drm-service.clearkey.apex",
+ stem: "android.hardware.drm-service.clearkey",
+ defaults: [
+ "aidl_clearkey_service_defaults",
+ "aidl_clearkey_service_defaults-use-static-deps",
+ ],
+ srcs: ["Service.cpp"],
+ installable: false, // installed in APEX
+}
+
phony {
name: "android.hardware.drm@latest-service.clearkey",
required: [
- "android.hardware.drm-service.clearkey",
+ "com.android.hardware.drm.clearkey",
],
}
@@ -123,3 +166,34 @@
],
},
}
+
+apex {
+ name: "com.android.hardware.drm.clearkey",
+ manifest: "manifest.json",
+ file_contexts: "file_contexts",
+ key: "com.android.hardware.key",
+ certificate: ":com.android.hardware.certificate",
+ vendor: true,
+ updatable: false,
+
+ binaries: [
+ "android.hardware.drm-service.clearkey.apex",
+ ],
+ prebuilts: [
+ "android.hardware.drm-service.clearkey.apex.rc",
+ "android.hardware.drm-service.clearkey.xml"
+ ],
+}
+
+prebuilt_etc {
+ name: "android.hardware.drm-service.clearkey.apex.rc",
+ src: "android.hardware.drm-service.clearkey.apex.rc",
+ installable: false,
+}
+
+prebuilt_etc {
+ name: "android.hardware.drm-service.clearkey.xml",
+ src: "android.hardware.drm-service.clearkey.xml",
+ sub_dir: "vintf",
+ installable: false,
+}
diff --git a/drm/mediadrm/plugins/clearkey/aidl/android.hardware.drm-service.clearkey.apex.rc b/drm/mediadrm/plugins/clearkey/aidl/android.hardware.drm-service.clearkey.apex.rc
new file mode 100644
index 0000000..f4645b3
--- /dev/null
+++ b/drm/mediadrm/plugins/clearkey/aidl/android.hardware.drm-service.clearkey.apex.rc
@@ -0,0 +1,7 @@
+service vendor.drm-clearkey-service /apex/com.android.hardware.drm.clearkey/bin/hw/android.hardware.drm-service.clearkey
+ class hal
+ user media
+ group mediadrm drmrpc
+ ioprio rt 4
+ task_profiles ProcessCapacityHigh
+ interface aidl android.hardware.drm.IDrmFactory/clearkey
diff --git a/drm/mediadrm/plugins/clearkey/aidl/file_contexts b/drm/mediadrm/plugins/clearkey/aidl/file_contexts
new file mode 100644
index 0000000..e9e6ca2
--- /dev/null
+++ b/drm/mediadrm/plugins/clearkey/aidl/file_contexts
@@ -0,0 +1,3 @@
+(/.*)? u:object_r:vendor_file:s0
+/etc(/.*)? u:object_r:vendor_configs_file:s0
+/bin/hw/android\.hardware\.drm-service(-lazy)?\.clearkey u:object_r:hal_drm_clearkey_aidl_exec:s0
diff --git a/drm/mediadrm/plugins/clearkey/aidl/manifest.json b/drm/mediadrm/plugins/clearkey/aidl/manifest.json
new file mode 100644
index 0000000..369dc21
--- /dev/null
+++ b/drm/mediadrm/plugins/clearkey/aidl/manifest.json
@@ -0,0 +1,4 @@
+{
+ "name": "com.android.hardware.drm.clearkey",
+ "version": 1
+}
diff --git a/media/codec2/hal/aidl/Android.bp b/media/codec2/hal/aidl/Android.bp
index b19f78c..b968c39 100644
--- a/media/codec2/hal/aidl/Android.bp
+++ b/media/codec2/hal/aidl/Android.bp
@@ -50,100 +50,95 @@
}
// DO NOT DEPEND ON THIS DIRECTLY
-// use libcodec2-hidl-defaults instead
-//cc_library {
-// name: "libcodec2_hidl@1.0",
-// vendor_available: true,
-// min_sdk_version: "29",
-// apex_available: [
-// "//apex_available:platform",
-// "com.android.media.swcodec",
-// ],
-//
-// defaults: ["hidl_defaults"],
-//
-// srcs: [
-// "Component.cpp",
-// "ComponentInterface.cpp",
-// "ComponentStore.cpp",
-// "Configurable.cpp",
-// "InputBufferManager.cpp",
-// "InputSurface.cpp",
-// "InputSurfaceConnection.cpp",
-// "types.cpp",
-// ],
-//
-// header_libs: [
-// "libbinder_headers",
-// "libcodec2_hal_common",
-// "libcodec2_internal", // private
-// "libsystem_headers",
-// ],
-//
-// shared_libs: [
-// "android.hardware.graphics.bufferqueue@1.0",
-// "android.hardware.graphics.bufferqueue@2.0",
-// "android.hardware.graphics.common@1.0",
-// "android.hardware.media@1.0",
-// "android.hardware.media.bufferpool@2.0",
-// "android.hardware.media.c2@1.0",
-// "android.hardware.media.omx@1.0",
-// "libbase",
-// "libcodec2",
-// "libcodec2_vndk",
-// "libcodec2_hidl_plugin_stub",
-// "libcutils",
-// "libhidlbase",
-// "liblog",
-// "libstagefright_bufferpool@2.0.1",
-// "libstagefright_bufferqueue_helper_novndk",
-// "libui",
-// "libutils",
-// ],
-//
-// target: {
-// vendor: {
-// exclude_shared_libs: [
-// "libstagefright_bufferqueue_helper_novndk",
-// "libcodec2_hidl_plugin_stub",
-// ],
-// shared_libs: [
-// "libstagefright_bufferqueue_helper",
-// "libcodec2_hidl_plugin",
-// ],
-// },
-// apex: {
-// exclude_shared_libs: [
-// "libcodec2_hidl_plugin",
-// "libcodec2_hidl_plugin_stub",
-// ],
-// },
-// },
-//
-// export_include_dirs: [
-// "include",
-// ],
-//
-// export_shared_lib_headers: [
-// "android.hardware.media.c2@1.0",
-// "libcodec2",
-// "libcodec2_vndk",
-// "libhidlbase",
-// "libstagefright_bufferpool@2.0.1",
-// "libui",
-// ],
-//}
-//
-//// public dependency for Codec 2.0 HAL service implementations
-//cc_defaults {
-// name: "libcodec2-hidl-defaults@1.0",
-// defaults: ["libcodec2-impl-defaults"],
-//
-// shared_libs: [
-// "android.hardware.media.c2@1.0",
-// "libcodec2_hidl@1.0",
-// ],
-//}
+// use libcodec2-aidl-defaults instead
+cc_library {
+ name: "libcodec2_aidl",
+ vendor_available: true,
+ min_sdk_version: "34",
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.media.swcodec",
+ "test_com.android.media.swcodec",
+ ],
+
+ srcs: [
+ "BufferTypes.cpp",
+ "Component.cpp",
+ "ComponentInterface.cpp",
+ "ComponentStore.cpp",
+ "Configurable.cpp",
+ "InputBufferManager.cpp",
+ "ParamTypes.cpp",
+ ],
+
+ header_libs: [
+ "libcodec2_internal", // private
+ ],
+
+ shared_libs: [
+ "android.hardware.common-V2-ndk",
+ "android.hardware.media.bufferpool2-V1-ndk",
+ "android.hardware.media.c2-V1-ndk",
+ "libbase",
+ "libbinder_ndk",
+ "libcodec2",
+ "libcodec2_hal_common",
+ "libcodec2_hidl_plugin_stub",
+ "libcodec2_vndk",
+ "libcutils",
+ "libhidlbase",
+ "liblog",
+ "libnativewindow",
+ "libstagefright_aidl_bufferpool2",
+ "libstagefright_bufferpool@2.0.1",
+ "libui",
+ "libutils",
+ ],
+
+ static_libs: [
+ "libaidlcommonsupport",
+ ],
+
+ target: {
+ vendor: {
+ exclude_shared_libs: [
+ "libcodec2_hidl_plugin_stub",
+ ],
+ shared_libs: [
+ "libcodec2_hidl_plugin",
+ ],
+ },
+ apex: {
+ exclude_shared_libs: [
+ "libcodec2_hidl_plugin_stub",
+ "libcodec2_hidl_plugin",
+ ],
+ },
+ },
+
+ export_include_dirs: [
+ "include",
+ ],
+
+ export_shared_lib_headers: [
+ "android.hardware.media.c2-V1-ndk",
+ "libcodec2",
+ "libstagefright_bufferpool@2.0.1",
+ "libui",
+ ],
+}
+
+// public dependency for Codec 2.0 HAL service implementations
+cc_defaults {
+ name: "libcodec2-aidl-defaults",
+ min_sdk_version: "34",
+ defaults: ["libcodec2-impl-defaults"],
+
+ shared_libs: [
+ "android.hardware.media.c2-V1-ndk",
+ "libcodec2_aidl",
+ ],
+}
// public dependency for Codec 2.0 HAL client
cc_defaults {
@@ -156,3 +151,28 @@
"libcodec2_aidl_client",
],
}
+
+cc_fuzz {
+ name: "libcodec2-aidl-fuzzer",
+ vendor: true,
+ srcs: [
+ "fuzzer.cpp",
+ ],
+ defaults: [
+ "libcodec2-aidl-defaults",
+ "service_fuzzer_defaults",
+ ],
+ shared_libs: [
+ "libcodec2_vndk",
+
+ "libcodec2_soft_avcdec",
+ "libcodec2_soft_avcenc",
+ "libcodec2_soft_aacdec",
+ "libcodec2_soft_aacenc",
+ ],
+ fuzz_config: {
+ cc: [
+ "wonsik@google.com",
+ ],
+ },
+}
diff --git a/media/codec2/hal/aidl/Component.cpp b/media/codec2/hal/aidl/Component.cpp
index 7994d32..fa18c3e 100644
--- a/media/codec2/hal/aidl/Component.cpp
+++ b/media/codec2/hal/aidl/Component.cpp
@@ -15,40 +15,42 @@
*/
//#define LOG_NDEBUG 0
-#define LOG_TAG "Codec2-Component@1.2"
+#define LOG_TAG "Codec2-Component-Aidl"
#include <android-base/logging.h>
-#include <codec2/hidl/1.2/Component.h>
-#include <codec2/hidl/1.2/ComponentStore.h>
-#include <codec2/hidl/1.2/InputBufferManager.h>
+#include <codec2/aidl/Component.h>
+#include <codec2/aidl/ComponentStore.h>
+#include <codec2/aidl/InputBufferManager.h>
#ifndef __ANDROID_APEX__
#include <FilterWrapper.h>
#endif
-#include <hidl/HidlBinderSupport.h>
+#include <android/binder_auto_utils.h>
+#include <android/binder_interface_utils.h>
#include <utils/Timers.h>
-#include <C2BqBufferPriv.h>
#include <C2Debug.h>
#include <C2PlatformSupport.h>
#include <chrono>
#include <thread>
+namespace aidl {
namespace android {
namespace hardware {
namespace media {
namespace c2 {
-namespace V1_2 {
namespace utils {
-using namespace ::android;
+using ::aidl::android::hardware::common::NativeHandle;
+using ::aidl::android::hardware::media::bufferpool2::IClientManager;
+using ::ndk::ScopedAStatus;
// ComponentListener wrapper
struct Component::Listener : public C2Component::Listener {
- Listener(const sp<Component>& component) :
+ Listener(const std::shared_ptr<Component>& component) :
mComponent(component),
mListener(component->mListener) {
}
@@ -56,9 +58,9 @@
virtual void onError_nb(
std::weak_ptr<C2Component> /* c2component */,
uint32_t errorCode) override {
- sp<IComponentListener> listener = mListener.promote();
+ std::shared_ptr<IComponentListener> listener = mListener.lock();
if (listener) {
- Return<void> transStatus = listener->onError(Status::OK, errorCode);
+ ScopedAStatus transStatus = listener->onError(Status{Status::OK}, errorCode);
if (!transStatus.isOk()) {
LOG(ERROR) << "Component::Listener::onError_nb -- "
<< "transaction failed.";
@@ -70,20 +72,20 @@
std::weak_ptr<C2Component> /* c2component */,
std::vector<std::shared_ptr<C2SettingResult>> c2settingResult
) override {
- sp<IComponentListener> listener = mListener.promote();
+ std::shared_ptr<IComponentListener> listener = mListener.lock();
if (listener) {
- hidl_vec<SettingResult> settingResults(c2settingResult.size());
+ std::vector<SettingResult> settingResults(c2settingResult.size());
size_t ix = 0;
for (const std::shared_ptr<C2SettingResult> &c2result :
c2settingResult) {
if (c2result) {
- if (!objcpy(&settingResults[ix++], *c2result)) {
+ if (!ToAidl(&settingResults[ix++], *c2result)) {
break;
}
}
}
settingResults.resize(ix);
- Return<void> transStatus = listener->onTripped(settingResults);
+ ScopedAStatus transStatus = listener->onTripped(settingResults);
if (!transStatus.isOk()) {
LOG(ERROR) << "Component::Listener::onTripped_nb -- "
<< "transaction failed.";
@@ -106,113 +108,57 @@
}
}
- sp<IComponentListener> listener = mListener.promote();
+ std::shared_ptr<IComponentListener> listener = mListener.lock();
if (listener) {
WorkBundle workBundle;
- sp<Component> strongComponent = mComponent.promote();
- beginTransferBufferQueueBlocks(c2workItems, true);
- if (!objcpy(&workBundle, c2workItems, strongComponent ?
+ std::shared_ptr<Component> strongComponent = mComponent.lock();
+ // TODO
+ // beginTransferBufferQueueBlocks(c2workItems, true);
+ if (!ToAidl(&workBundle, c2workItems, strongComponent ?
&strongComponent->mBufferPoolSender : nullptr)) {
LOG(ERROR) << "Component::Listener::onWorkDone_nb -- "
<< "received corrupted work items.";
- endTransferBufferQueueBlocks(c2workItems, false, true);
+ // TODO
+ // endTransferBufferQueueBlocks(c2workItems, false, true);
return;
}
- Return<void> transStatus = listener->onWorkDone(workBundle);
+ ScopedAStatus transStatus = listener->onWorkDone(workBundle);
if (!transStatus.isOk()) {
LOG(ERROR) << "Component::Listener::onWorkDone_nb -- "
<< "transaction failed.";
- endTransferBufferQueueBlocks(c2workItems, false, true);
+ // TODO
+ // endTransferBufferQueueBlocks(c2workItems, false, true);
return;
}
- endTransferBufferQueueBlocks(c2workItems, true, true);
+ // TODO
+ // endTransferBufferQueueBlocks(c2workItems, true, true);
}
}
protected:
- wp<Component> mComponent;
- wp<IComponentListener> mListener;
+ std::weak_ptr<Component> mComponent;
+ std::weak_ptr<IComponentListener> mListener;
};
-// Component::Sink
-struct Component::Sink : public IInputSink {
- std::shared_ptr<Component> mComponent;
- sp<IConfigurable> mConfigurable;
-
- virtual Return<Status> queue(const WorkBundle& workBundle) override {
- return mComponent->queue(workBundle);
- }
-
- virtual Return<sp<IConfigurable>> getConfigurable() override {
- return mConfigurable;
- }
-
- Sink(const std::shared_ptr<Component>& component);
- virtual ~Sink() override;
-
- // Process-wide map: Component::Sink -> C2Component.
- static std::mutex sSink2ComponentMutex;
- static std::map<IInputSink*, std::weak_ptr<C2Component>> sSink2Component;
-
- static std::shared_ptr<C2Component> findLocalComponent(
- const sp<IInputSink>& sink);
+// Component::DeathContext
+struct Component::DeathContext {
+ std::weak_ptr<Component> mWeakComp;
};
-std::mutex
- Component::Sink::sSink2ComponentMutex{};
-std::map<IInputSink*, std::weak_ptr<C2Component>>
- Component::Sink::sSink2Component{};
-
-Component::Sink::Sink(const std::shared_ptr<Component>& component)
- : mComponent{component},
- mConfigurable{[&component]() -> sp<IConfigurable> {
- Return<sp<IComponentInterface>> ret1 = component->getInterface();
- if (!ret1.isOk()) {
- LOG(ERROR) << "Sink::Sink -- component's transaction failed.";
- return nullptr;
- }
- Return<sp<IConfigurable>> ret2 =
- static_cast<sp<IComponentInterface>>(ret1)->
- getConfigurable();
- if (!ret2.isOk()) {
- LOG(ERROR) << "Sink::Sink -- interface's transaction failed.";
- return nullptr;
- }
- return static_cast<sp<IConfigurable>>(ret2);
- }()} {
- std::lock_guard<std::mutex> lock(sSink2ComponentMutex);
- sSink2Component.emplace(this, component->mComponent);
-}
-
-Component::Sink::~Sink() {
- std::lock_guard<std::mutex> lock(sSink2ComponentMutex);
- sSink2Component.erase(this);
-}
-
-std::shared_ptr<C2Component> Component::Sink::findLocalComponent(
- const sp<IInputSink>& sink) {
- std::lock_guard<std::mutex> lock(sSink2ComponentMutex);
- auto i = sSink2Component.find(sink.get());
- if (i == sSink2Component.end()) {
- return nullptr;
- }
- return i->second.lock();
-}
-
// Component
Component::Component(
const std::shared_ptr<C2Component>& component,
- const sp<IComponentListener>& listener,
- const sp<ComponentStore>& store,
- const sp<::android::hardware::media::bufferpool::V2_0::
- IClientManager>& clientPoolManager)
+ const std::shared_ptr<IComponentListener>& listener,
+ const std::shared_ptr<ComponentStore>& store,
+ const std::shared_ptr<IClientManager>& clientPoolManager)
: mComponent{component},
- mInterface{new ComponentInterface(component->intf(),
- store->getParameterCache())},
+ mInterface{SharedRefBase::make<ComponentInterface>(
+ component->intf(), store->getParameterCache())},
mListener{listener},
mStore{store},
- mBufferPoolSender{clientPoolManager} {
+ mBufferPoolSender{clientPoolManager},
+ mDeathContext(nullptr) {
// Retrieve supported parameters from store
// TODO: We could cache this per component/interface type
mInit = mInterface->status();
@@ -223,11 +169,11 @@
}
// Methods from ::android::hardware::media::c2::V1_1::IComponent
-Return<Status> Component::queue(const WorkBundle& workBundle) {
+ScopedAStatus Component::queue(const WorkBundle& workBundle) {
std::list<std::unique_ptr<C2Work>> c2works;
- if (!objcpy(&c2works, workBundle)) {
- return Status::CORRUPTED;
+ if (!FromAidl(&c2works, workBundle)) {
+ return ScopedAStatus::fromServiceSpecificError(Status::CORRUPTED);
}
// Register input buffers.
@@ -238,10 +184,14 @@
}
}
- return static_cast<Status>(mComponent->queue_nb(&c2works));
+ c2_status_t err = mComponent->queue_nb(&c2works);
+ if (err == C2_OK) {
+ return ScopedAStatus::ok();
+ }
+ return ScopedAStatus::fromServiceSpecificError(err);
}
-Return<void> Component::flush(flush_cb _hidl_cb) {
+ScopedAStatus Component::flush(WorkBundle *flushedWorkBundle) {
std::list<std::unique_ptr<C2Work>> c2flushedWorks;
c2_status_t c2res = mComponent->flush_sm(
C2Component::FLUSH_COMPONENT,
@@ -260,80 +210,29 @@
}
}
- WorkBundle flushedWorkBundle;
- Status res = static_cast<Status>(c2res);
- beginTransferBufferQueueBlocks(c2flushedWorks, true);
+ // TODO
+ // beginTransferBufferQueueBlocks(c2flushedWorks, true);
if (c2res == C2_OK) {
- if (!objcpy(&flushedWorkBundle, c2flushedWorks, &mBufferPoolSender)) {
- res = Status::CORRUPTED;
+ if (!ToAidl(flushedWorkBundle, c2flushedWorks, &mBufferPoolSender)) {
+ c2res = C2_CORRUPTED;
}
}
- _hidl_cb(res, flushedWorkBundle);
- endTransferBufferQueueBlocks(c2flushedWorks, true, true);
- return Void();
+ // TODO
+ // endTransferBufferQueueBlocks(c2flushedWorks, true, true);
+ if (c2res == C2_OK) {
+ return ScopedAStatus::ok();
+ }
+ return ScopedAStatus::fromServiceSpecificError(c2res);
}
-Return<Status> Component::drain(bool withEos) {
- return static_cast<Status>(mComponent->drain_nb(withEos ?
+ScopedAStatus Component::drain(bool withEos) {
+ c2_status_t res = mComponent->drain_nb(withEos ?
C2Component::DRAIN_COMPONENT_WITH_EOS :
- C2Component::DRAIN_COMPONENT_NO_EOS));
-}
-
-Return<Status> Component::setOutputSurface(
- uint64_t blockPoolId,
- const sp<HGraphicBufferProducer2>& surface) {
- std::shared_ptr<C2BlockPool> pool;
- GetCodec2BlockPool(blockPoolId, mComponent, &pool);
- if (pool && pool->getAllocatorId() == C2PlatformAllocatorStore::BUFFERQUEUE) {
- std::shared_ptr<C2BufferQueueBlockPool> bqPool =
- std::static_pointer_cast<C2BufferQueueBlockPool>(pool);
- C2BufferQueueBlockPool::OnRenderCallback cb =
- [this](uint64_t producer, int32_t slot, int64_t nsecs) {
- // TODO: batch this
- hidl_vec<IComponentListener::RenderedFrame> rendered;
- rendered.resize(1);
- rendered[0] = { producer, slot, nsecs };
- (void)mListener->onFramesRendered(rendered).isOk();
- };
- if (bqPool) {
- bqPool->setRenderCallback(cb);
- bqPool->configureProducer(surface);
- }
+ C2Component::DRAIN_COMPONENT_NO_EOS);
+ if (res == C2_OK) {
+ return ScopedAStatus::ok();
}
- return Status::OK;
-}
-
-Return<void> Component::connectToInputSurface(
- const sp<IInputSurface>& inputSurface,
- connectToInputSurface_cb _hidl_cb) {
- Status status;
- sp<IInputSurfaceConnection> connection;
- auto transStatus = inputSurface->connect(
- asInputSink(),
- [&status, &connection](
- Status s, const sp<IInputSurfaceConnection>& c) {
- status = s;
- connection = c;
- }
- );
- _hidl_cb(status, connection);
- return Void();
-}
-
-Return<void> Component::connectToOmxInputSurface(
- const sp<HGraphicBufferProducer1>& producer,
- const sp<::android::hardware::media::omx::V1_0::
- IGraphicBufferSource>& source,
- connectToOmxInputSurface_cb _hidl_cb) {
- (void)producer;
- (void)source;
- (void)_hidl_cb;
- return Void();
-}
-
-Return<Status> Component::disconnectFromInputSurface() {
- // TODO implement
- return Status::OK;
+ return ScopedAStatus::fromServiceSpecificError(res);
}
namespace /* unnamed */ {
@@ -390,130 +289,122 @@
} // unnamed namespace
-Return<void> Component::createBlockPool(
- uint32_t allocatorId,
- createBlockPool_cb _hidl_cb) {
- std::shared_ptr<C2BlockPool> blockPool;
+ScopedAStatus Component::createBlockPool(
+ const IComponent::BlockPoolAllocator &allocator,
+ IComponent::BlockPool *blockPool) {
+ std::shared_ptr<C2BlockPool> c2BlockPool;
+ static constexpr IComponent::BlockPoolAllocator::Tag ALLOCATOR_ID =
+ IComponent::BlockPoolAllocator::allocatorId;
+ static constexpr IComponent::BlockPoolAllocator::Tag IGBA =
+ IComponent::BlockPoolAllocator::igba;
+ c2_status_t status = C2_OK;
+ switch (allocator.getTag()) {
+ case ALLOCATOR_ID:
#ifdef __ANDROID_APEX__
- c2_status_t status = CreateCodec2BlockPool(
- static_cast<C2PlatformAllocatorStore::id_t>(allocatorId),
- mComponent,
- &blockPool);
+ status = CreateCodec2BlockPool(
+ static_cast<::android::C2PlatformAllocatorStore::id_t>(
+ allocator.get<ALLOCATOR_ID>()),
+ mComponent,
+ &c2BlockPool);
#else
- c2_status_t status = ComponentStore::GetFilterWrapper()->createBlockPool(
- static_cast<C2PlatformAllocatorStore::id_t>(allocatorId),
- mComponent,
- &blockPool);
+ status = ComponentStore::GetFilterWrapper()->createBlockPool(
+ static_cast<::android::C2PlatformAllocatorStore::id_t>(
+ allocator.get<ALLOCATOR_ID>()),
+ mComponent,
+ &c2BlockPool);
#endif
- if (status != C2_OK) {
- blockPool = nullptr;
+ if (status != C2_OK) {
+ blockPool = nullptr;
+ }
+ break;
+ case IGBA:
+ // FIXME
+ break;
+ default:
+ break;
}
if (blockPool) {
mBlockPoolsMutex.lock();
- mBlockPools.emplace(blockPool->getLocalId(), blockPool);
+ mBlockPools.emplace(c2BlockPool->getLocalId(), c2BlockPool);
mBlockPoolsMutex.unlock();
} else if (status == C2_OK) {
status = C2_CORRUPTED;
}
- _hidl_cb(static_cast<Status>(status),
- blockPool ? blockPool->getLocalId() : 0,
- new CachedConfigurable(
- std::make_unique<BlockPoolIntf>(blockPool)));
- return Void();
+ blockPool->blockPoolId = c2BlockPool ? c2BlockPool->getLocalId() : 0;
+ blockPool->configurable = SharedRefBase::make<CachedConfigurable>(
+ std::make_unique<BlockPoolIntf>(c2BlockPool));
+ if (status == C2_OK) {
+ return ScopedAStatus::ok();
+ }
+ return ScopedAStatus::fromServiceSpecificError(status);
}
-Return<Status> Component::destroyBlockPool(uint64_t blockPoolId) {
+ScopedAStatus Component::destroyBlockPool(int64_t blockPoolId) {
std::lock_guard<std::mutex> lock(mBlockPoolsMutex);
- return mBlockPools.erase(blockPoolId) == 1 ?
- Status::OK : Status::CORRUPTED;
+ if (mBlockPools.erase(blockPoolId) == 1) {
+ return ScopedAStatus::ok();
+ }
+ return ScopedAStatus::fromServiceSpecificError(Status::CORRUPTED);
}
-Return<Status> Component::start() {
- return static_cast<Status>(mComponent->start());
+ScopedAStatus Component::start() {
+ c2_status_t status = mComponent->start();
+ if (status == C2_OK) {
+ return ScopedAStatus::ok();
+ }
+ return ScopedAStatus::fromServiceSpecificError(status);
}
-Return<Status> Component::stop() {
+ScopedAStatus Component::stop() {
InputBufferManager::unregisterFrameData(mListener);
- return static_cast<Status>(mComponent->stop());
+ c2_status_t status = mComponent->stop();
+ if (status == C2_OK) {
+ return ScopedAStatus::ok();
+ }
+ return ScopedAStatus::fromServiceSpecificError(status);
}
-Return<Status> Component::reset() {
- Status status = static_cast<Status>(mComponent->reset());
+ScopedAStatus Component::reset() {
+ c2_status_t status = mComponent->reset();
{
std::lock_guard<std::mutex> lock(mBlockPoolsMutex);
mBlockPools.clear();
}
InputBufferManager::unregisterFrameData(mListener);
- return status;
+ if (status == C2_OK) {
+ return ScopedAStatus::ok();
+ }
+ return ScopedAStatus::fromServiceSpecificError(status);
}
-Return<Status> Component::release() {
- Status status = static_cast<Status>(mComponent->release());
+ScopedAStatus Component::release() {
+ c2_status_t status = mComponent->release();
{
std::lock_guard<std::mutex> lock(mBlockPoolsMutex);
mBlockPools.clear();
}
InputBufferManager::unregisterFrameData(mListener);
- return status;
-}
-
-Return<sp<IComponentInterface>> Component::getInterface() {
- return sp<IComponentInterface>(mInterface);
-}
-
-Return<sp<IInputSink>> Component::asInputSink() {
- std::lock_guard<std::mutex> lock(mSinkMutex);
- if (!mSink) {
- mSink = new Sink(shared_from_this());
+ if (status == C2_OK) {
+ return ScopedAStatus::ok();
}
- return {mSink};
+ return ScopedAStatus::fromServiceSpecificError(status);
}
-Return<void> Component::configureVideoTunnel(
- uint32_t avSyncHwId, configureVideoTunnel_cb _hidl_cb) {
+ScopedAStatus Component::getInterface(
+ std::shared_ptr<IComponentInterface> *intf) {
+ *intf = mInterface;
+ return ScopedAStatus::ok();
+}
+
+ScopedAStatus Component::configureVideoTunnel(
+ int32_t avSyncHwId, NativeHandle *handle) {
(void)avSyncHwId;
- _hidl_cb(Status::OMITTED, hidl_handle{});
- return Void();
+ (void)handle;
+ return ScopedAStatus::fromServiceSpecificError(Status::OMITTED);
}
-Return<Status> Component::setOutputSurfaceWithSyncObj(
- uint64_t blockPoolId, const sp<HGraphicBufferProducer2>& surface,
- const SurfaceSyncObj& syncObject) {
- std::shared_ptr<C2BlockPool> pool;
- GetCodec2BlockPool(blockPoolId, mComponent, &pool);
- if (pool && pool->getAllocatorId() == C2PlatformAllocatorStore::BUFFERQUEUE) {
- std::shared_ptr<C2BufferQueueBlockPool> bqPool =
- std::static_pointer_cast<C2BufferQueueBlockPool>(pool);
- C2BufferQueueBlockPool::OnRenderCallback cb =
- [this](uint64_t producer, int32_t slot, int64_t nsecs) {
- // TODO: batch this
- hidl_vec<IComponentListener::RenderedFrame> rendered;
- rendered.resize(1);
- rendered[0] = { producer, slot, nsecs };
- (void)mListener->onFramesRendered(rendered).isOk();
- };
- if (bqPool) {
- const native_handle_t *h = syncObject.syncMemory;
- native_handle_t *syncMemory = h ? native_handle_clone(h) : nullptr;
- uint64_t bqId = syncObject.bqId;
- uint32_t generationId = syncObject.generationId;
- uint64_t consumerUsage = syncObject.consumerUsage;
-
- bqPool->setRenderCallback(cb);
- bqPool->configureProducer(surface, syncMemory, bqId,
- generationId, consumerUsage);
- }
- }
- return Status::OK;
-}
-
-std::shared_ptr<C2Component> Component::findLocalComponent(
- const sp<IInputSink>& sink) {
- return Component::Sink::findLocalComponent(sink);
-}
-
-void Component::initListener(const sp<Component>& self) {
+void Component::initListener(const std::shared_ptr<Component>& self) {
std::shared_ptr<C2Component::Listener> c2listener =
std::make_shared<Listener>(self);
c2_status_t res = mComponent->setListener_vb(c2listener, C2_DONT_BLOCK);
@@ -521,46 +412,38 @@
mInit = res;
}
- struct ListenerDeathRecipient : public HwDeathRecipient {
- ListenerDeathRecipient(const wp<Component>& comp)
- : component{comp} {
- }
+ mDeathRecipient = ::ndk::ScopedAIBinder_DeathRecipient(
+ AIBinder_DeathRecipient_new(OnBinderDied));
+ mDeathContext = new DeathContext{weak_from_this()};
+ AIBinder_DeathRecipient_setOnUnlinked(mDeathRecipient.get(), OnBinderUnlinked);
+ AIBinder_linkToDeath(mListener->asBinder().get(), mDeathRecipient.get(), mDeathContext);
+}
- virtual void serviceDied(
- uint64_t /* cookie */,
- const wp<::android::hidl::base::V1_0::IBase>& /* who */
- ) override {
- auto strongComponent = component.promote();
- if (strongComponent) {
- LOG(INFO) << "Client died ! release the component !!";
- strongComponent->release();
- } else {
- LOG(ERROR) << "Client died ! no component to release !!";
- }
- }
-
- wp<Component> component;
- };
-
- mDeathRecipient = new ListenerDeathRecipient(self);
- Return<bool> transStatus = mListener->linkToDeath(
- mDeathRecipient, 0);
- if (!transStatus.isOk()) {
- LOG(ERROR) << "Listener linkToDeath() transaction failed.";
+// static
+void Component::OnBinderDied(void *cookie) {
+ DeathContext *context = (DeathContext *)cookie;
+ std::shared_ptr<Component> comp = context->mWeakComp.lock();
+ if (comp) {
+ comp->release();
}
- if (!static_cast<bool>(transStatus)) {
- LOG(DEBUG) << "Listener linkToDeath() call failed.";
- }
+}
+
+// static
+void Component::OnBinderUnlinked(void *cookie) {
+ delete (DeathContext *)cookie;
}
Component::~Component() {
InputBufferManager::unregisterFrameData(mListener);
mStore->reportComponentDeath(this);
+ if (mDeathRecipient.get()) {
+ AIBinder_unlinkToDeath(mListener->asBinder().get(), mDeathRecipient.get(), mDeathContext);
+ }
}
} // namespace utils
-} // namespace V1_2
} // namespace c2
} // namespace media
} // namespace hardware
} // namespace android
+} // namespace aidl
diff --git a/media/codec2/hal/aidl/ComponentInterface.cpp b/media/codec2/hal/aidl/ComponentInterface.cpp
index 12078e0..2d812c9 100644
--- a/media/codec2/hal/aidl/ComponentInterface.cpp
+++ b/media/codec2/hal/aidl/ComponentInterface.cpp
@@ -18,28 +18,26 @@
#define LOG_TAG "Codec2-ComponentInterface"
#include <android-base/logging.h>
-#include <codec2/hidl/1.0/Component.h>
-#include <codec2/hidl/1.0/ComponentInterface.h>
-#include <codec2/hidl/1.0/ComponentStore.h>
+#include <android/binder_auto_utils.h>
+#include <codec2/aidl/ComponentInterface.h>
+#include <codec2/aidl/Configurable.h>
-#include <hidl/HidlBinderSupport.h>
#include <utils/Timers.h>
-#include <C2BqBufferPriv.h>
#include <C2Debug.h>
#include <C2PlatformSupport.h>
#include <chrono>
#include <thread>
+namespace aidl {
namespace android {
namespace hardware {
namespace media {
namespace c2 {
-namespace V1_0 {
namespace utils {
-using namespace ::android;
+using ::ndk::ScopedAStatus;
namespace /* unnamed */ {
@@ -89,7 +87,8 @@
const std::shared_ptr<C2ComponentInterface>& intf,
const std::shared_ptr<ParameterCache>& cache)
: mInterface{intf},
- mConfigurable{new CachedConfigurable(std::make_unique<CompIntf>(intf))} {
+ mConfigurable{SharedRefBase::make<CachedConfigurable>(
+ std::make_unique<CompIntf>(intf))} {
mInit = mConfigurable->init(cache);
}
@@ -97,14 +96,16 @@
return mInit;
}
-Return<sp<IConfigurable>> ComponentInterface::getConfigurable() {
- return mConfigurable;
+ScopedAStatus ComponentInterface::getConfigurable(
+ std::shared_ptr<IConfigurable> *configurable) {
+ *configurable = mConfigurable;
+ return ScopedAStatus::ok();
}
} // namespace utils
-} // namespace V1_0
} // namespace c2
} // namespace media
} // namespace hardware
} // namespace android
+} // namespace aidl
diff --git a/media/codec2/hal/aidl/ComponentStore.cpp b/media/codec2/hal/aidl/ComponentStore.cpp
index 9fac5d5..19734c0 100644
--- a/media/codec2/hal/aidl/ComponentStore.cpp
+++ b/media/codec2/hal/aidl/ComponentStore.cpp
@@ -15,15 +15,16 @@
*/
//#define LOG_NDEBUG 0
-#define LOG_TAG "Codec2-ComponentStore@1.2"
+#define LOG_TAG "Codec2-ComponentStore-Aidl"
#include <android-base/logging.h>
-#include <codec2/hidl/1.2/ComponentStore.h>
-#include <codec2/hidl/1.2/InputSurface.h>
-#include <codec2/hidl/1.2/types.h>
+#include <bufferpool2/ClientManager.h>
+#include <codec2/aidl/Component.h>
+#include <codec2/aidl/ComponentInterface.h>
+#include <codec2/aidl/ComponentStore.h>
+#include <codec2/aidl/ParamTypes.h>
#include <android-base/file.h>
-#include <media/stagefright/bqhelper/GraphicBufferSource.h>
#include <utils/Errors.h>
#include <C2PlatformSupport.h>
@@ -43,16 +44,16 @@
#include <FilterWrapper.h>
#endif
+namespace aidl {
namespace android {
namespace hardware {
namespace media {
namespace c2 {
-namespace V1_2 {
namespace utils {
-using namespace ::android;
-using ::android::GraphicBufferSource;
-using namespace ::android::hardware::media::bufferpool::V2_0::implementation;
+using ::android::DefaultFilterPlugin;
+using ::android::FilterWrapper;
+using ::ndk::ScopedAStatus;
namespace /* unnamed */ {
@@ -131,12 +132,13 @@
};
ComponentStore::ComponentStore(const std::shared_ptr<C2ComponentStore>& store)
- : mConfigurable{new CachedConfigurable(std::make_unique<StoreIntf>(store))},
+ : mConfigurable{SharedRefBase::make<CachedConfigurable>(std::make_unique<StoreIntf>(store))},
mParameterCache{std::make_shared<StoreParameterCache>(this)},
mStore{store} {
- std::shared_ptr<C2ComponentStore> platformStore = android::GetCodec2PlatformComponentStore();
- SetPreferredCodec2ComponentStore(store);
+ std::shared_ptr<C2ComponentStore> platformStore =
+ ::android::GetCodec2PlatformComponentStore();
+ ::android::SetPreferredCodec2ComponentStore(store);
// Retrieve struct descriptors
mParamReflector = mStore->getParamReflector();
@@ -194,93 +196,78 @@
}
#endif
-// Methods from ::android::hardware::media::c2::V1_0::IComponentStore
-Return<void> ComponentStore::createComponent(
- const hidl_string& name,
- const sp<IComponentListener>& listener,
- const sp<IClientManager>& pool,
- createComponent_cb _hidl_cb) {
+// Methods from ::aidl::android::hardware::media::c2::IComponentStore
+ScopedAStatus ComponentStore::createComponent(
+ const std::string& name,
+ const std::shared_ptr<IComponentListener>& listener,
+ const std::shared_ptr<IClientManager>& pool,
+ std::shared_ptr<IComponent> *component) {
- sp<Component> component;
std::shared_ptr<C2Component> c2component;
- Status status = static_cast<Status>(
- mStore->createComponent(name, &c2component));
+ c2_status_t status =
+ mStore->createComponent(name, &c2component);
- if (status == Status::OK) {
+ if (status == C2_OK) {
#ifndef __ANDROID_APEX__
c2component = GetFilterWrapper()->maybeWrapComponent(c2component);
#endif
onInterfaceLoaded(c2component->intf());
- component = new Component(c2component, listener, this, pool);
+ std::shared_ptr<Component> comp =
+ SharedRefBase::make<Component>(c2component, listener, shared_from_this(), pool);
+ *component = comp;
if (!component) {
- status = Status::CORRUPTED;
+ status = C2_CORRUPTED;
} else {
- reportComponentBirth(component.get());
- if (component->status() != C2_OK) {
- status = static_cast<Status>(component->status());
+ reportComponentBirth(comp.get());
+ if (comp->status() != C2_OK) {
+ status = comp->status();
} else {
- component->initListener(component);
- if (component->status() != C2_OK) {
- status = static_cast<Status>(component->status());
+ comp->initListener(comp);
+ if (comp->status() != C2_OK) {
+ status = comp->status();
}
}
}
}
- _hidl_cb(status, component);
- return Void();
+ if (status == C2_OK) {
+ return ScopedAStatus::ok();
+ }
+ return ScopedAStatus::fromServiceSpecificError(status);
}
-Return<void> ComponentStore::createInterface(
- const hidl_string& name,
- createInterface_cb _hidl_cb) {
+ScopedAStatus ComponentStore::createInterface(
+ const std::string& name,
+ std::shared_ptr<IComponentInterface> *intf) {
std::shared_ptr<C2ComponentInterface> c2interface;
c2_status_t res = mStore->createInterface(name, &c2interface);
- sp<IComponentInterface> interface;
if (res == C2_OK) {
#ifndef __ANDROID_APEX__
c2interface = GetFilterWrapper()->maybeWrapInterface(c2interface);
#endif
onInterfaceLoaded(c2interface);
- interface = new ComponentInterface(c2interface, mParameterCache);
+ *intf = SharedRefBase::make<ComponentInterface>(c2interface, mParameterCache);
+ return ScopedAStatus::ok();
}
- _hidl_cb(static_cast<Status>(res), interface);
- return Void();
+ return ScopedAStatus::fromServiceSpecificError(res);
}
-Return<void> ComponentStore::listComponents(listComponents_cb _hidl_cb) {
+ScopedAStatus ComponentStore::listComponents(
+ std::vector<IComponentStore::ComponentTraits> *traits) {
std::vector<std::shared_ptr<const C2Component::Traits>> c2traits =
mStore->listComponents();
- hidl_vec<IComponentStore::ComponentTraits> traits(c2traits.size());
+ traits->resize(c2traits.size());
size_t ix = 0;
for (const std::shared_ptr<const C2Component::Traits> &c2trait : c2traits) {
if (c2trait) {
- if (objcpy(&traits[ix], *c2trait)) {
+ if (ToAidl(&traits->at(ix), *c2trait)) {
++ix;
} else {
break;
}
}
}
- traits.resize(ix);
- _hidl_cb(Status::OK, traits);
- return Void();
-}
-
-Return<void> ComponentStore::createInputSurface(createInputSurface_cb _hidl_cb) {
- sp<GraphicBufferSource> source = new GraphicBufferSource();
- if (source->initCheck() != OK) {
- _hidl_cb(Status::CORRUPTED, nullptr);
- return Void();
- }
- using namespace std::placeholders;
- sp<InputSurface> inputSurface = new InputSurface(
- mParameterCache,
- std::make_shared<C2ReflectorHelper>(),
- source->getHGraphicBufferProducer(),
- source);
- _hidl_cb(inputSurface ? Status::OK : Status::NO_MEMORY,
- inputSurface);
- return Void();
+ traits->resize(ix);
+ return ScopedAStatus::ok();
}
void ComponentStore::onInterfaceLoaded(const std::shared_ptr<C2ComponentInterface> &intf) {
@@ -293,15 +280,16 @@
}
}
-Return<void> ComponentStore::getStructDescriptors(
- const hidl_vec<uint32_t>& indices,
- getStructDescriptors_cb _hidl_cb) {
- hidl_vec<StructDescriptor> descriptors(indices.size());
+ScopedAStatus ComponentStore::getStructDescriptors(
+ const std::vector<int32_t>& indices,
+ std::vector<StructDescriptor> *descriptors) {
+ descriptors->resize(indices.size());
size_t dstIx = 0;
- Status res = Status::OK;
+ int32_t res = Status::OK;
for (size_t srcIx = 0; srcIx < indices.size(); ++srcIx) {
std::lock_guard<std::mutex> lock(mStructDescriptorsMutex);
- const C2Param::CoreIndex coreIndex = C2Param::CoreIndex(indices[srcIx]).coreIndex();
+ const C2Param::CoreIndex coreIndex =
+ C2Param::CoreIndex(uint32_t(indices[srcIx])).coreIndex();
const auto item = mStructDescriptors.find(coreIndex);
if (item == mStructDescriptors.end()) {
// not in the cache, and not known to be unsupported, query local reflector
@@ -312,7 +300,7 @@
mUnsupportedStructDescriptors.emplace(coreIndex);
} else {
mStructDescriptors.insert({ coreIndex, structDesc });
- if (objcpy(&descriptors[dstIx], *structDesc)) {
+ if (ToAidl(&descriptors->at(dstIx), *structDesc)) {
++dstIx;
continue;
}
@@ -322,7 +310,7 @@
}
res = Status::NOT_FOUND;
} else if (item->second) {
- if (objcpy(&descriptors[dstIx], *item->second)) {
+ if (ToAidl(&descriptors->at(dstIx), *item->second)) {
++dstIx;
continue;
}
@@ -333,96 +321,31 @@
break;
}
}
- descriptors.resize(dstIx);
- _hidl_cb(res, descriptors);
- return Void();
+ descriptors->resize(dstIx);
+ if (res == Status::OK) {
+ return ScopedAStatus::ok();
+ }
+ return ScopedAStatus::fromServiceSpecificError(res);
}
-Return<sp<IClientManager>> ComponentStore::getPoolClientManager() {
- return ClientManager::getInstance();
+ScopedAStatus ComponentStore::getPoolClientManager(
+ std::shared_ptr<IClientManager> *manager) {
+ using ::aidl::android::hardware::media::bufferpool2::implementation::ClientManager;
+ *manager = ClientManager::getInstance();
+ return ScopedAStatus::ok();
}
-Return<Status> ComponentStore::copyBuffer(const Buffer& src, const Buffer& dst) {
+ScopedAStatus ComponentStore::copyBuffer(const Buffer& src, const Buffer& dst) {
// TODO implement
(void)src;
(void)dst;
- return Status::OMITTED;
+ return ScopedAStatus::fromServiceSpecificError(Status::OMITTED);
}
-Return<sp<IConfigurable>> ComponentStore::getConfigurable() {
- return mConfigurable;
-}
-
-// Methods from ::android::hardware::media::c2::V1_1::IComponentStore
-Return<void> ComponentStore::createComponent_1_1(
- const hidl_string& name,
- const sp<IComponentListener>& listener,
- const sp<IClientManager>& pool,
- createComponent_1_1_cb _hidl_cb) {
-
- sp<Component> component;
- std::shared_ptr<C2Component> c2component;
- Status status = static_cast<Status>(
- mStore->createComponent(name, &c2component));
-
- if (status == Status::OK) {
-#ifndef __ANDROID_APEX__
- c2component = GetFilterWrapper()->maybeWrapComponent(c2component);
-#endif
- onInterfaceLoaded(c2component->intf());
- component = new Component(c2component, listener, this, pool);
- if (!component) {
- status = Status::CORRUPTED;
- } else {
- reportComponentBirth(component.get());
- if (component->status() != C2_OK) {
- status = static_cast<Status>(component->status());
- } else {
- component->initListener(component);
- if (component->status() != C2_OK) {
- status = static_cast<Status>(component->status());
- }
- }
- }
- }
- _hidl_cb(status, component);
- return Void();
-}
-
-// Methods from ::android::hardware::media::c2::V1_2::IComponentStore
-Return<void> ComponentStore::createComponent_1_2(
- const hidl_string& name,
- const sp<IComponentListener>& listener,
- const sp<IClientManager>& pool,
- createComponent_1_2_cb _hidl_cb) {
-
- sp<Component> component;
- std::shared_ptr<C2Component> c2component;
- Status status = static_cast<Status>(
- mStore->createComponent(name, &c2component));
-
- if (status == Status::OK) {
-#ifndef __ANDROID_APEX__
- c2component = GetFilterWrapper()->maybeWrapComponent(c2component);
-#endif
- onInterfaceLoaded(c2component->intf());
- component = new Component(c2component, listener, this, pool);
- if (!component) {
- status = Status::CORRUPTED;
- } else {
- reportComponentBirth(component.get());
- if (component->status() != C2_OK) {
- status = static_cast<Status>(component->status());
- } else {
- component->initListener(component);
- if (component->status() != C2_OK) {
- status = static_cast<Status>(component->status());
- }
- }
- }
- }
- _hidl_cb(status, component);
- return Void();
+ScopedAStatus ComponentStore::getConfigurable(
+ std::shared_ptr<IConfigurable> *configurable) {
+ *configurable = mConfigurable;
+ return ScopedAStatus::ok();
}
// Called from createComponent() after a successful creation of `component`.
@@ -495,16 +418,9 @@
}
// Dumps information when lshal is called.
-Return<void> ComponentStore::debug(
- const hidl_handle& handle,
- const hidl_vec<hidl_string>& /* args */) {
+binder_status_t ComponentStore::dump(
+ int fd, [[maybe_unused]] const char** args, [[maybe_unused]] uint32_t numArgs) {
LOG(INFO) << "debug -- dumping...";
- const native_handle_t *h = handle.getNativeHandle();
- if (!h || h->numFds != 1) {
- LOG(ERROR) << "debug -- dumping failed -- "
- "invalid file descriptor to dump to";
- return Void();
- }
std::ostringstream out;
{ // Populate "out".
@@ -546,17 +462,17 @@
<< mStore->getName() << std::endl;
}
- if (!android::base::WriteStringToFd(out.str(), h->data[0])) {
+ if (!::android::base::WriteStringToFd(out.str(), fd)) {
PLOG(WARNING) << "debug -- dumping failed -- write()";
} else {
LOG(INFO) << "debug -- dumping succeeded";
}
- return Void();
+ return STATUS_OK;
}
} // namespace utils
-} // namespace V1_2
} // namespace c2
} // namespace media
} // namespace hardware
} // namespace android
+} // namespace aidl
diff --git a/media/codec2/hal/aidl/Configurable.cpp b/media/codec2/hal/aidl/Configurable.cpp
index 530576d..0326263 100644
--- a/media/codec2/hal/aidl/Configurable.cpp
+++ b/media/codec2/hal/aidl/Configurable.cpp
@@ -15,23 +15,23 @@
*/
//#define LOG_NDEBUG 0
-#define LOG_TAG "Codec2-Configurable"
+#define LOG_TAG "Codec2-Configurable-Aidl"
#include <android-base/logging.h>
-#include <codec2/hidl/1.0/Configurable.h>
-#include <codec2/hidl/1.0/ComponentStore.h>
-#include <codec2/hidl/1.0/types.h>
+#include <android/binder_auto_utils.h>
+#include <codec2/aidl/Configurable.h>
+#include <codec2/aidl/ParamTypes.h>
#include <C2ParamInternal.h>
+namespace aidl {
namespace android {
namespace hardware {
namespace media {
namespace c2 {
-namespace V1_0 {
namespace utils {
-using namespace ::android;
+using ::ndk::ScopedAStatus;
CachedConfigurable::CachedConfigurable(
std::unique_ptr<ConfigurableC2Intf>&& intf)
@@ -47,19 +47,21 @@
}
// Methods from ::android::hardware::media::c2::V1_0::IConfigurable follow.
-Return<uint32_t> CachedConfigurable::getId() {
- return mIntf->getId();
+
+ScopedAStatus CachedConfigurable::getId(int32_t* id) {
+ *id = mIntf->getId();
+ return ScopedAStatus::ok();
}
-Return<void> CachedConfigurable::getName(getName_cb _hidl_cb) {
- _hidl_cb(mIntf->getName());
- return Void();
+ScopedAStatus CachedConfigurable::getName(std::string* name) {
+ *name = mIntf->getName();
+ return ScopedAStatus::ok();
}
-Return<void> CachedConfigurable::query(
- const hidl_vec<uint32_t>& indices,
+ScopedAStatus CachedConfigurable::query(
+ const std::vector<int32_t>& indices,
bool mayBlock,
- query_cb _hidl_cb) {
+ Params* params) {
typedef C2Param::Index Index;
std::vector<Index> c2heapParamIndices(
(Index*)indices.data(),
@@ -70,27 +72,24 @@
mayBlock ? C2_MAY_BLOCK : C2_DONT_BLOCK,
&c2heapParams);
- hidl_vec<uint8_t> params;
- if (!createParamsBlob(¶ms, c2heapParams)) {
+ if (!CreateParamsBlob(params, c2heapParams)) {
LOG(WARNING) << "query -- invalid output params.";
}
- _hidl_cb(static_cast<Status>(c2res), params);
- return Void();
+ if (c2res == C2_OK) {
+ return ScopedAStatus::ok();
+ }
+ return ScopedAStatus::fromServiceSpecificError(c2res);
}
-Return<void> CachedConfigurable::config(
- const hidl_vec<uint8_t>& inParams,
+ScopedAStatus CachedConfigurable::config(
+ const Params& params,
bool mayBlock,
- config_cb _hidl_cb) {
+ ConfigResult* result) {
// inParams is not writable, so create a copy as config modifies the parameters
- hidl_vec<uint8_t> inParamsCopy = inParams;
std::vector<C2Param*> c2params;
- if (!parseParamsBlob(&c2params, inParamsCopy)) {
+ if (!ParseParamsBlob(&c2params, params)) {
LOG(WARNING) << "config -- invalid input params.";
- _hidl_cb(Status::CORRUPTED,
- hidl_vec<SettingResult>(),
- hidl_vec<uint8_t>());
- return Void();
+ return ScopedAStatus::fromServiceSpecificError(C2_CORRUPTED);
}
// TODO: check if blob was invalid
std::vector<std::unique_ptr<C2SettingResult>> c2failures;
@@ -98,12 +97,12 @@
c2params,
mayBlock ? C2_MAY_BLOCK : C2_DONT_BLOCK,
&c2failures);
- hidl_vec<SettingResult> failures(c2failures.size());
+ result->failures.resize(c2failures.size());
{
size_t ix = 0;
for (const std::unique_ptr<C2SettingResult>& c2result : c2failures) {
if (c2result) {
- if (objcpy(&failures[ix], *c2result)) {
+ if (ToAidl(&result->failures[ix], *c2result)) {
++ix;
} else {
LOG(DEBUG) << "config -- invalid setting results.";
@@ -111,28 +110,29 @@
}
}
}
- failures.resize(ix);
+ result->failures.resize(ix);
}
- hidl_vec<uint8_t> outParams;
- if (!createParamsBlob(&outParams, c2params)) {
+ if (!CreateParamsBlob(&result->params, c2params)) {
LOG(DEBUG) << "config -- invalid output params.";
}
- _hidl_cb((Status)c2res, failures, outParams);
- return Void();
+ if (c2res == C2_OK) {
+ return ScopedAStatus::ok();
+ }
+ return ScopedAStatus::fromServiceSpecificError(c2res);
}
-Return<void> CachedConfigurable::querySupportedParams(
- uint32_t start,
- uint32_t count,
- querySupportedParams_cb _hidl_cb) {
+ScopedAStatus CachedConfigurable::querySupportedParams(
+ int32_t start,
+ int32_t count,
+ std::vector<ParamDescriptor>* paramDesc) {
C2LinearRange request = C2LinearCapacity(mSupportedParams.size()).range(
start, count);
- hidl_vec<ParamDescriptor> params(request.size());
- Status res = Status::OK;
+ paramDesc->resize(request.size());
+ int32_t res = Status::OK;
size_t dstIx = 0;
for (size_t srcIx = request.offset(); srcIx < request.endOffset(); ++srcIx) {
if (mSupportedParams[srcIx]) {
- if (objcpy(¶ms[dstIx], *mSupportedParams[srcIx])) {
+ if (ToAidl(&(*paramDesc)[dstIx], *mSupportedParams[srcIx])) {
++dstIx;
} else {
res = Status::CORRUPTED;
@@ -143,26 +143,28 @@
res = Status::BAD_INDEX;
}
}
- params.resize(dstIx);
- _hidl_cb(res, params);
- return Void();
+ paramDesc->resize(dstIx);
+ if (res == Status::OK) {
+ return ScopedAStatus::ok();
+ }
+ return ScopedAStatus::fromServiceSpecificError(res);
}
-Return<void> CachedConfigurable::querySupportedValues(
- const hidl_vec<FieldSupportedValuesQuery>& inFields,
+ScopedAStatus CachedConfigurable::querySupportedValues(
+ const std::vector<FieldSupportedValuesQuery>& fields,
bool mayBlock,
- querySupportedValues_cb _hidl_cb) {
+ std::vector<FieldSupportedValuesQueryResult>* result) {
std::vector<C2FieldSupportedValuesQuery> c2fields;
{
// C2FieldSupportedValuesQuery objects are restricted in that some
// members are const.
// C2ParamField - required for its constructor - has no constructors
// from fields. Use C2ParamInspector.
- for (const FieldSupportedValuesQuery &query : inFields) {
+ for (const FieldSupportedValuesQuery &query : fields) {
c2fields.emplace_back(_C2ParamInspector::CreateParamField(
- query.field.index,
+ (uint32_t)query.field.index,
query.field.fieldId.offset,
- query.field.fieldId.size),
+ query.field.fieldId.sizeBytes),
query.type == FieldSupportedValuesQuery::Type::POSSIBLE ?
C2FieldSupportedValuesQuery::POSSIBLE :
C2FieldSupportedValuesQuery::CURRENT);
@@ -171,26 +173,28 @@
c2_status_t c2res = mIntf->querySupportedValues(
c2fields,
mayBlock ? C2_MAY_BLOCK : C2_DONT_BLOCK);
- hidl_vec<FieldSupportedValuesQueryResult> outFields(inFields.size());
+ result->resize(fields.size());
size_t dstIx = 0;
- for (const C2FieldSupportedValuesQuery &result : c2fields) {
- if (objcpy(&outFields[dstIx], result)) {
+ for (const C2FieldSupportedValuesQuery &res : c2fields) {
+ if (ToAidl(&(*result)[dstIx], res)) {
++dstIx;
} else {
- outFields.resize(dstIx);
+ result->resize(dstIx);
c2res = C2_CORRUPTED;
LOG(WARNING) << "querySupportedValues -- invalid output params.";
break;
}
}
- _hidl_cb((Status)c2res, outFields);
- return Void();
+ if (c2res == C2_OK) {
+ return ScopedAStatus::ok();
+ }
+ return ScopedAStatus::fromServiceSpecificError(c2res);
}
} // namespace utils
-} // namespace V1_0
} // namespace c2
} // namespace media
} // namespace hardware
} // namespace android
+} // namespace aidl
diff --git a/media/codec2/hal/aidl/InputBufferManager.cpp b/media/codec2/hal/aidl/InputBufferManager.cpp
index 8c0d0a4..5c58155 100644
--- a/media/codec2/hal/aidl/InputBufferManager.cpp
+++ b/media/codec2/hal/aidl/InputBufferManager.cpp
@@ -15,13 +15,12 @@
*/
//#define LOG_NDEBUG 0
-#define LOG_TAG "Codec2-InputBufferManager"
+#define LOG_TAG "Codec2-InputBufferManager-Aidl"
#include <android-base/logging.h>
-#include <codec2/hidl/1.0/InputBufferManager.h>
-#include <codec2/hidl/1.0/types.h>
+#include <codec2/aidl/InputBufferManager.h>
-#include <android/hardware/media/c2/1.0/IComponentListener.h>
+#include <aidl/android/hardware/media/c2/IComponentListener.h>
#include <android-base/logging.h>
#include <C2Buffer.h>
@@ -29,29 +28,29 @@
#include <chrono>
+namespace aidl {
namespace android {
namespace hardware {
namespace media {
namespace c2 {
-namespace V1_0 {
namespace utils {
using namespace ::android;
void InputBufferManager::registerFrameData(
- const sp<IComponentListener>& listener,
+ const std::shared_ptr<IComponentListener>& listener,
const C2FrameData& input) {
getInstance()._registerFrameData(listener, input);
}
void InputBufferManager::unregisterFrameData(
- const wp<IComponentListener>& listener,
+ const std::weak_ptr<IComponentListener>& listener,
const C2FrameData& input) {
getInstance()._unregisterFrameData(listener, input);
}
void InputBufferManager::unregisterFrameData(
- const wp<IComponentListener>& listener) {
+ const std::weak_ptr<IComponentListener>& listener) {
getInstance()._unregisterFrameData(listener);
}
@@ -61,7 +60,7 @@
}
void InputBufferManager::_registerFrameData(
- const sp<IComponentListener>& listener,
+ const std::shared_ptr<IComponentListener>& listener,
const C2FrameData& input) {
uint64_t frameIndex = input.ordinal.frameIndex.peeku();
LOG(VERBOSE) << "InputBufferManager::_registerFrameData -- called with "
@@ -109,13 +108,11 @@
//
// This is called from onWorkDone() and flush().
void InputBufferManager::_unregisterFrameData(
- const wp<IComponentListener>& listener,
+ const std::weak_ptr<IComponentListener>& listener,
const C2FrameData& input) {
uint64_t frameIndex = input.ordinal.frameIndex.peeku();
LOG(VERBOSE) << "InputBufferManager::_unregisterFrameData -- called with "
- << "listener @ 0x" << std::hex << listener.unsafe_get()
- << ", frameIndex = " << std::dec << frameIndex
- << ".";
+ << "frameIndex = " << frameIndex << ".";
std::lock_guard<std::mutex> lock(mMutex);
auto findListener = mTrackedBuffersMap.find(listener);
@@ -134,11 +131,7 @@
if (status != C2_OK) {
LOG(DEBUG) << "InputBufferManager::_unregisterFrameData "
<< "-- unregisterOnDestroyNotify() failed "
- << "(listener @ 0x"
- << std::hex
- << bufferId->listener.unsafe_get()
- << ", frameIndex = "
- << std::dec << bufferId->frameIndex
+ << "(frameIndex = " << bufferId->frameIndex
<< ", bufferIndex = " << bufferId->bufferIndex
<< ") => status = " << status
<< ".";
@@ -173,10 +166,8 @@
// This is called when the component cleans up all input buffers, i.e., when
// reset(), release(), stop() or ~Component() is called.
void InputBufferManager::_unregisterFrameData(
- const wp<IComponentListener>& listener) {
- LOG(VERBOSE) << "InputBufferManager::_unregisterFrameData -- called with "
- << "listener @ 0x" << std::hex << listener.unsafe_get()
- << std::dec << ".";
+ const std::weak_ptr<IComponentListener>& listener) {
+ LOG(VERBOSE) << "InputBufferManager::_unregisterFrameData.";
std::lock_guard<std::mutex> lock(mMutex);
auto findListener = mTrackedBuffersMap.find(listener);
@@ -196,11 +187,7 @@
if (status != C2_OK) {
LOG(DEBUG) << "InputBufferManager::_unregisterFrameData "
<< "-- unregisterOnDestroyNotify() failed "
- << "(listener @ 0x"
- << std::hex
- << bufferId->listener.unsafe_get()
- << ", frameIndex = "
- << std::dec << bufferId->frameIndex
+ << "(frameIndex = " << bufferId->frameIndex
<< ", bufferIndex = " << bufferId->bufferIndex
<< ") => status = " << status
<< ".";
@@ -256,16 +243,14 @@
<< "buf @ 0x" << std::hex << buf
<< ", arg @ 0x" << std::hex << arg
<< std::dec << " -- "
- << "listener @ 0x" << std::hex << bufferId->listener.unsafe_get()
- << ", frameIndex = " << std::dec << bufferId->frameIndex
+ << ", frameIndex = " << bufferId->frameIndex
<< ", bufferIndex = " << bufferId->bufferIndex
<< ".";
auto findListener = mTrackedBuffersMap.find(bufferId->listener);
if (findListener == mTrackedBuffersMap.end()) {
LOG(VERBOSE) << "InputBufferManager::_onBufferDestroyed -- "
<< "received invalid listener: "
- << "listener @ 0x" << std::hex << bufferId->listener.unsafe_get()
- << " (frameIndex = " << std::dec << bufferId->frameIndex
+ << " (frameIndex = " << bufferId->frameIndex
<< ", bufferIndex = " << bufferId->bufferIndex
<< ").";
return;
@@ -278,8 +263,7 @@
LOG(DEBUG) << "InputBufferManager::_onBufferDestroyed -- "
<< "received invalid frame index: "
<< "frameIndex = " << bufferId->frameIndex
- << " (listener @ 0x" << std::hex << bufferId->listener.unsafe_get()
- << ", bufferIndex = " << std::dec << bufferId->bufferIndex
+ << ", bufferIndex = " << bufferId->bufferIndex
<< ").";
return;
}
@@ -291,8 +275,7 @@
<< "received invalid buffer index: "
<< "bufferIndex = " << bufferId->bufferIndex
<< " (frameIndex = " << bufferId->frameIndex
- << ", listener @ 0x" << std::hex << bufferId->listener.unsafe_get()
- << std::dec << ").";
+ << ").";
return;
}
@@ -320,9 +303,9 @@
bool InputBufferManager::processNotifications(nsecs_t* timeToRetryNs) {
struct Notification {
- sp<IComponentListener> listener;
- hidl_vec<IComponentListener::InputBuffer> inputBuffers;
- Notification(const sp<IComponentListener>& l, size_t s)
+ std::shared_ptr<IComponentListener> listener;
+ std::vector<IComponentListener::InputBuffer> inputBuffers;
+ Notification(const std::shared_ptr<IComponentListener>& l, size_t s)
: listener(l), inputBuffers(s) {}
};
std::list<Notification> notifications;
@@ -336,7 +319,7 @@
nsecs_t timeNowNs = systemTime();
for (auto it = mDeathNotifications.begin();
it != mDeathNotifications.end(); ) {
- sp<IComponentListener> listener = it->first.promote();
+ std::shared_ptr<IComponentListener> listener = it->first.lock();
if (!listener) {
++it;
continue;
@@ -371,7 +354,7 @@
// Create the argument for the callback.
notifications.emplace_back(listener, deathNotifications.count);
- hidl_vec<IComponentListener::InputBuffer> &inputBuffers =
+ std::vector<IComponentListener::InputBuffer> &inputBuffers =
notifications.back().inputBuffers;
size_t i = 0;
for (std::pair<const uint64_t, std::vector<size_t>>& p :
@@ -466,11 +449,9 @@
}
} // namespace utils
-} // namespace V1_0
} // namespace c2
} // namespace media
} // namespace hardware
} // namespace android
-
-
+} // namespace aidl
diff --git a/media/codec2/hal/aidl/InputSurface.cpp b/media/codec2/hal/aidl/InputSurface.cpp
deleted file mode 100644
index c3c32e9..0000000
--- a/media/codec2/hal/aidl/InputSurface.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Copyright 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-//#define LOG_NDEBUG 0
-#define LOG_TAG "Codec2-InputSurface"
-#include <android-base/logging.h>
-
-#include <codec2/hidl/1.0/InputSurface.h>
-#include <codec2/hidl/1.0/InputSurfaceConnection.h>
-
-#include <C2Component.h>
-#include <C2Config.h>
-
-#include <memory>
-
-namespace android {
-namespace hardware {
-namespace media {
-namespace c2 {
-namespace V1_0 {
-namespace utils {
-
-using namespace ::android;
-
-// Derived class of C2InterfaceHelper
-class InputSurface::Interface : public C2InterfaceHelper {
-public:
- explicit Interface(
- const std::shared_ptr<C2ReflectorHelper> &helper)
- : C2InterfaceHelper(helper) {
-
- setDerivedInstance(this);
-
- addParameter(
- DefineParam(mEos, C2_PARAMKEY_INPUT_SURFACE_EOS)
- .withDefault(new C2InputSurfaceEosTuning(false))
- .withFields({C2F(mEos, value).oneOf({true, false})})
- .withSetter(EosSetter)
- .build());
- }
-
- static C2R EosSetter(bool mayBlock, C2P<C2InputSurfaceEosTuning> &me) {
- (void)mayBlock;
- return me.F(me.v.value).validatePossible(me.v.value);
- }
-
- bool eos() const { return mEos->value; }
-
-private:
- std::shared_ptr<C2InputSurfaceEosTuning> mEos;
-};
-
-// Derived class of ConfigurableC2Intf
-class InputSurface::ConfigurableIntf : public ConfigurableC2Intf {
-public:
- ConfigurableIntf(
- const std::shared_ptr<InputSurface::Interface> &intf,
- const sp<GraphicBufferSource> &source)
- : ConfigurableC2Intf("input-surface", 0),
- mIntf(intf),
- mSource(source) {
- }
-
- virtual ~ConfigurableIntf() override = default;
-
- virtual c2_status_t query(
- const std::vector<C2Param::Index> &indices,
- c2_blocking_t mayBlock,
- std::vector<std::unique_ptr<C2Param>>* const params
- ) const override {
- return mIntf->query({}, indices, mayBlock, params);
- }
-
- virtual c2_status_t config(
- const std::vector<C2Param*> ¶ms,
- c2_blocking_t mayBlock,
- std::vector<std::unique_ptr<C2SettingResult>>* const failures
- ) override {
- c2_status_t err = mIntf->config(params, mayBlock, failures);
- if (mIntf->eos()) {
- sp<GraphicBufferSource> source = mSource.promote();
- if (source == nullptr || source->signalEndOfInputStream() != OK) {
- // TODO: put something in |failures|
- err = C2_BAD_VALUE;
- }
- // TODO: reset eos?
- }
- return err;
- }
-
- virtual c2_status_t querySupportedParams(
- std::vector<std::shared_ptr<C2ParamDescriptor>>* const params
- ) const override {
- return mIntf->querySupportedParams(params);
- }
-
- virtual c2_status_t querySupportedValues(
- std::vector<C2FieldSupportedValuesQuery>& fields,
- c2_blocking_t mayBlock) const override {
- return mIntf->querySupportedValues(fields, mayBlock);
- }
-
-private:
- const std::shared_ptr<InputSurface::Interface> mIntf;
- wp<GraphicBufferSource> mSource;
-};
-
-Return<sp<InputSurface::HGraphicBufferProducer>> InputSurface::getGraphicBufferProducer() {
- return mProducer;
-}
-
-Return<sp<IConfigurable>> InputSurface::getConfigurable() {
- return mConfigurable;
-}
-
-Return<void> InputSurface::connect(
- const sp<IInputSink>& sink,
- connect_cb _hidl_cb) {
- Status status;
- sp<InputSurfaceConnection> connection;
- if (!sink) {
- _hidl_cb(Status::BAD_VALUE, nullptr);
- return Void();
- }
- std::shared_ptr<C2Component> comp = Component::findLocalComponent(sink);
- if (comp) {
- connection = new InputSurfaceConnection(mSource, comp, mParameterCache);
- } else {
- connection = new InputSurfaceConnection(mSource, sink, mParameterCache);
- }
- if (!connection->init()) {
- connection = nullptr;
- status = Status::BAD_VALUE;
- } else {
- status = Status::OK;
- }
- _hidl_cb(status, connection);
- return Void();
-}
-
-// Constructor is exclusive to ComponentStore.
-InputSurface::InputSurface(
- const std::shared_ptr<ParameterCache>& cache,
- const std::shared_ptr<C2ReflectorHelper>& reflector,
- const sp<HGraphicBufferProducer>& producer,
- const sp<GraphicBufferSource>& source)
- : mParameterCache{cache},
- mProducer{producer},
- mSource{source},
- mIntf{std::make_shared<Interface>(reflector)},
- mConfigurable{new CachedConfigurable(
- std::make_unique<ConfigurableIntf>(
- mIntf, source))} {
-
- mConfigurable->init(mParameterCache);
-}
-
-} // namespace utils
-} // namespace V1_0
-} // namespace c2
-} // namespace media
-} // namespace hardware
-} // namespace android
-
diff --git a/media/codec2/hal/aidl/InputSurfaceConnection.cpp b/media/codec2/hal/aidl/InputSurfaceConnection.cpp
deleted file mode 100644
index 7c2e014..0000000
--- a/media/codec2/hal/aidl/InputSurfaceConnection.cpp
+++ /dev/null
@@ -1,531 +0,0 @@
-/*
- * Copyright 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-//#define LOG_NDEBUG 0
-#define LOG_TAG "Codec2-InputSurfaceConnection"
-#include <android-base/logging.h>
-
-#include <codec2/hidl/1.0/InputSurfaceConnection.h>
-#include <codec2/hidl/1.0/InputSurfaceConnection.h>
-
-#include <memory>
-#include <list>
-#include <mutex>
-#include <atomic>
-
-#include <hidl/HidlSupport.h>
-#include <media/stagefright/bqhelper/ComponentWrapper.h>
-#include <system/graphics.h>
-#include <ui/GraphicBuffer.h>
-#include <utils/Errors.h>
-
-#include <C2.h>
-#include <C2AllocatorGralloc.h>
-#include <C2BlockInternal.h>
-#include <C2Buffer.h>
-#include <C2Component.h>
-#include <C2Config.h>
-#include <C2Debug.h>
-#include <C2PlatformSupport.h>
-#include <C2Work.h>
-
-namespace android {
-namespace hardware {
-namespace media {
-namespace c2 {
-namespace V1_0 {
-namespace utils {
-
-constexpr int32_t kBufferCount = 16;
-
-using namespace ::android;
-using ::android::hardware::hidl_string;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::Return;
-
-namespace /* unnamed */ {
-
-class Buffer2D : public C2Buffer {
-public:
- explicit Buffer2D(C2ConstGraphicBlock block) : C2Buffer({ block }) {
- }
-};
-
-} // unnamed namespace
-
-// Derived class of ComponentWrapper for use with
-// GraphicBufferSource::configure().
-//
-struct InputSurfaceConnection::Impl : public ComponentWrapper {
-
- Impl(const sp<GraphicBufferSource>& source,
- const std::shared_ptr<C2Component>& localComp)
- : mSource{source}, mLocalComp{localComp}, mSink{}, mFrameIndex{0} {
- std::shared_ptr<C2ComponentInterface> intf = localComp->intf();
- mSinkName = intf ? intf->getName() : "";
- }
-
- Impl(const sp<GraphicBufferSource>& source,
- const sp<IInputSink>& sink)
- : mSource{source}, mLocalComp{}, mSink{sink}, mFrameIndex{0} {
- Return<sp<IConfigurable>> transResult = sink->getConfigurable();
- if (!transResult.isOk()) {
- LOG(ERROR) << "Remote sink is dead.";
- return;
- }
- mSinkConfigurable =
- static_cast<sp<IConfigurable>>(transResult);
- if (!mSinkConfigurable) {
- LOG(ERROR) << "Remote sink is not configurable.";
- mSinkName = "";
- return;
- }
-
- hidl_string name;
- Return<void> transStatus = mSinkConfigurable->getName(
- [&name](const hidl_string& n) {
- name = n;
- });
- if (!transStatus.isOk()) {
- LOG(ERROR) << "Remote sink's configurable is dead.";
- mSinkName = "";
- return;
- }
- mSinkName = name.c_str();
- }
-
- virtual ~Impl() {
- mSource->stop();
- mSource->release();
- }
-
- bool init() {
- if (mSource == nullptr) {
- return false;
- }
- status_t err = mSource->initCheck();
- if (err != OK) {
- LOG(WARNING) << "Impl::init -- GraphicBufferSource init failed: "
- << "status = " << err << ".";
- return false;
- }
-
- // TODO: read settings properly from the interface
- C2StreamPictureSizeInfo::input inputSize;
- C2StreamUsageTuning::input usage;
- c2_status_t c2Status = queryFromSink({ &inputSize, &usage },
- {},
- C2_MAY_BLOCK,
- nullptr);
- if (c2Status != C2_OK) {
- LOG(WARNING) << "Impl::init -- cannot query information from "
- "the component interface: "
- << "status = " << asString(c2Status) << ".";
- return false;
- }
-
- // TODO: proper color aspect & dataspace
- android_dataspace dataSpace = HAL_DATASPACE_BT709;
-
- // TODO: use the usage read from intf
- // uint32_t grallocUsage =
- // C2AndroidMemoryUsage(C2MemoryUsage(usage.value)).
- // asGrallocUsage();
-
- uint32_t grallocUsage =
- mSinkName.compare(0, 11, "c2.android.") == 0 ?
- GRALLOC_USAGE_SW_READ_OFTEN :
- GRALLOC_USAGE_HW_VIDEO_ENCODER;
-
- err = mSource->configure(
- this, dataSpace, kBufferCount,
- inputSize.width, inputSize.height,
- grallocUsage);
- if (err != OK) {
- LOG(WARNING) << "Impl::init -- GBS configure failed: "
- << "status = " << err << ".";
- return false;
- }
- for (int32_t i = 0; i < kBufferCount; ++i) {
- if (mSource->onInputBufferAdded(i) != OK) {
- LOG(WARNING) << "Impl::init: failed to populate GBS slots.";
- return false;
- }
- }
- if (mSource->start() != OK) {
- LOG(WARNING) << "Impl::init -- GBS failed to start.";
- return false;
- }
- mAllocatorMutex.lock();
- c2_status_t c2err = GetCodec2PlatformAllocatorStore()->fetchAllocator(
- C2AllocatorStore::PLATFORM_START + 1, // GRALLOC
- &mAllocator);
- mAllocatorMutex.unlock();
- if (c2err != OK) {
- LOG(WARNING) << "Impl::init -- failed to fetch gralloc allocator: "
- << "status = " << asString(c2err) << ".";
- return false;
- }
- return true;
- }
-
- // From ComponentWrapper
- virtual status_t submitBuffer(
- int32_t bufferId,
- const sp<GraphicBuffer>& buffer,
- int64_t timestamp,
- int fenceFd) override {
- LOG(VERBOSE) << "Impl::submitBuffer -- bufferId = " << bufferId << ".";
- // TODO: Use fd to construct fence
- (void)fenceFd;
-
- std::shared_ptr<C2GraphicAllocation> alloc;
- C2Handle* handle = WrapNativeCodec2GrallocHandle(
- buffer->handle,
- buffer->width, buffer->height,
- buffer->format, buffer->usage, buffer->stride);
- mAllocatorMutex.lock();
- c2_status_t err = mAllocator->priorGraphicAllocation(handle, &alloc);
- mAllocatorMutex.unlock();
- if (err != OK) {
- native_handle_close(handle);
- native_handle_delete(handle);
- return UNKNOWN_ERROR;
- }
- std::shared_ptr<C2GraphicBlock> block =
- _C2BlockFactory::CreateGraphicBlock(alloc);
-
- std::unique_ptr<C2Work> work(new C2Work);
- work->input.flags = (C2FrameData::flags_t)0;
- work->input.ordinal.timestamp = timestamp;
- work->input.ordinal.frameIndex = mFrameIndex.fetch_add(
- 1, std::memory_order_relaxed);
- work->input.buffers.clear();
- std::shared_ptr<C2Buffer> c2Buffer(
- // TODO: fence
- new Buffer2D(block->share(
- C2Rect(block->width(), block->height()), ::C2Fence())),
- [bufferId, source = mSource](C2Buffer* ptr) {
- delete ptr;
- if (source != nullptr) {
- // TODO: fence
- (void)source->onInputBufferEmptied(bufferId, -1);
- }
- });
- work->input.buffers.push_back(c2Buffer);
- work->worklets.clear();
- work->worklets.emplace_back(new C2Worklet);
- std::list<std::unique_ptr<C2Work>> items;
- items.push_back(std::move(work));
-
- err = queueToSink(&items);
- return (err == C2_OK) ? OK : UNKNOWN_ERROR;
- }
-
- virtual status_t submitEos(int32_t bufferId) override {
- LOG(VERBOSE) << "Impl::submitEos -- bufferId = " << bufferId << ".";
- (void)bufferId;
-
- std::unique_ptr<C2Work> work(new C2Work);
- work->input.flags = (C2FrameData::flags_t)0;
- work->input.ordinal.frameIndex = mFrameIndex.fetch_add(
- 1, std::memory_order_relaxed);
- work->input.buffers.clear();
- work->worklets.clear();
- work->worklets.emplace_back(new C2Worklet);
- std::list<std::unique_ptr<C2Work>> items;
- items.push_back(std::move(work));
-
- c2_status_t err = queueToSink(&items);
- return (err == C2_OK) ? OK : UNKNOWN_ERROR;
- }
-
- virtual void dispatchDataSpaceChanged(
- int32_t dataSpace, int32_t aspects, int32_t pixelFormat) override {
- // TODO
- (void)dataSpace;
- (void)aspects;
- (void)pixelFormat;
- }
-
- // Configurable interface for InputSurfaceConnection::Impl.
- //
- // This class is declared as an inner class so that it will have access to
- // all Impl's members.
- struct ConfigurableIntf : public ConfigurableC2Intf {
- sp<Impl> mConnection;
- ConfigurableIntf(const sp<Impl>& connection)
- : ConfigurableC2Intf{"input-surface-connection", 0},
- mConnection{connection} {}
- virtual c2_status_t config(
- const std::vector<C2Param*> ¶ms,
- c2_blocking_t mayBlock,
- std::vector<std::unique_ptr<C2SettingResult>> *const failures
- ) override;
- virtual c2_status_t query(
- const std::vector<C2Param::Index> &indices,
- c2_blocking_t mayBlock,
- std::vector<std::unique_ptr<C2Param>> *const params) const override;
- virtual c2_status_t querySupportedParams(
- std::vector<std::shared_ptr<C2ParamDescriptor>> *const params
- ) const override;
- virtual c2_status_t querySupportedValues(
- std::vector<C2FieldSupportedValuesQuery> &fields,
- c2_blocking_t mayBlock) const override;
- };
-
-private:
- c2_status_t queryFromSink(
- const std::vector<C2Param*> &stackParams,
- const std::vector<C2Param::Index> &heapParamIndices,
- c2_blocking_t mayBlock,
- std::vector<std::unique_ptr<C2Param>>* const heapParams) {
- if (mLocalComp) {
- std::shared_ptr<C2ComponentInterface> intf = mLocalComp->intf();
- if (intf) {
- return intf->query_vb(stackParams,
- heapParamIndices,
- mayBlock,
- heapParams);
- } else {
- LOG(ERROR) << "queryFromSink -- "
- << "component does not have an interface.";
- return C2_BAD_STATE;
- }
- }
-
- CHECK(mSink) << "-- queryFromSink "
- << "-- connection has no sink.";
- CHECK(mSinkConfigurable) << "-- queryFromSink "
- << "-- sink has no configurable.";
-
- hidl_vec<ParamIndex> indices(
- stackParams.size() + heapParamIndices.size());
- size_t numIndices = 0;
- for (C2Param* const& stackParam : stackParams) {
- if (!stackParam) {
- LOG(DEBUG) << "queryFromSink -- null stack param encountered.";
- continue;
- }
- indices[numIndices++] = static_cast<ParamIndex>(stackParam->index());
- }
- size_t numStackIndices = numIndices;
- for (const C2Param::Index& index : heapParamIndices) {
- indices[numIndices++] =
- static_cast<ParamIndex>(static_cast<uint32_t>(index));
- }
- indices.resize(numIndices);
- if (heapParams) {
- heapParams->reserve(heapParams->size() + numIndices);
- }
- c2_status_t status;
- Return<void> transStatus = mSinkConfigurable->query(
- indices,
- mayBlock == C2_MAY_BLOCK,
- [&status, &numStackIndices, &stackParams, heapParams](
- Status s, const Params& p) {
- status = static_cast<c2_status_t>(s);
- if (status != C2_OK && status != C2_BAD_INDEX) {
- LOG(DEBUG) << "queryFromSink -- call failed: "
- << "status = " << asString(status) << ".";
- return;
- }
- std::vector<C2Param*> paramPointers;
- if (!parseParamsBlob(¶mPointers, p)) {
- LOG(DEBUG) << "queryFromSink -- error while "
- << "parsing params.";
- status = C2_CORRUPTED;
- return;
- }
- size_t i = 0;
- for (auto it = paramPointers.begin();
- it != paramPointers.end(); ) {
- C2Param* paramPointer = *it;
- if (numStackIndices > 0) {
- --numStackIndices;
- if (!paramPointer) {
- LOG(DEBUG) << "queryFromSink -- "
- "null stack param.";
- ++it;
- continue;
- }
- for (; i < stackParams.size() &&
- !stackParams[i]; ) {
- ++i;
- }
- CHECK(i < stackParams.size());
- if (stackParams[i]->index() !=
- paramPointer->index()) {
- LOG(DEBUG) << "queryFromSink -- "
- "param skipped (index = "
- << stackParams[i]->index() << ").";
- stackParams[i++]->invalidate();
- continue;
- }
- if (!stackParams[i++]->updateFrom(*paramPointer)) {
- LOG(DEBUG) << "queryFromSink -- "
- "param update failed (index = "
- << paramPointer->index() << ").";
- }
- } else {
- if (!paramPointer) {
- LOG(DEBUG) << "queryFromSink -- "
- "null heap param.";
- ++it;
- continue;
- }
- if (!heapParams) {
- LOG(WARNING) << "queryFromSink -- "
- "too many stack params.";
- break;
- }
- heapParams->emplace_back(C2Param::Copy(*paramPointer));
- }
- ++it;
- }
- });
- if (!transStatus.isOk()) {
- LOG(ERROR) << "queryFromSink -- transaction failed.";
- return C2_CORRUPTED;
- }
- return status;
- }
-
- c2_status_t queueToSink(std::list<std::unique_ptr<C2Work>>* const items) {
- if (mLocalComp) {
- return mLocalComp->queue_nb(items);
- }
-
- CHECK(mSink) << "-- queueToSink "
- << "-- connection has no sink.";
-
- WorkBundle workBundle;
- if (!objcpy(&workBundle, *items, nullptr)) {
- LOG(ERROR) << "queueToSink -- bad input.";
- return C2_CORRUPTED;
- }
- Return<Status> transStatus = mSink->queue(workBundle);
- if (!transStatus.isOk()) {
- LOG(ERROR) << "queueToSink -- transaction failed.";
- return C2_CORRUPTED;
- }
- c2_status_t status =
- static_cast<c2_status_t>(static_cast<Status>(transStatus));
- if (status != C2_OK) {
- LOG(DEBUG) << "queueToSink -- call failed: "
- << asString(status);
- }
- return status;
- }
-
- sp<GraphicBufferSource> mSource;
- std::shared_ptr<C2Component> mLocalComp;
- sp<IInputSink> mSink;
- sp<IConfigurable> mSinkConfigurable;
- std::string mSinkName;
-
- // Needed for ComponentWrapper implementation
- std::mutex mAllocatorMutex;
- std::shared_ptr<C2Allocator> mAllocator;
- std::atomic_uint64_t mFrameIndex;
-
-};
-
-InputSurfaceConnection::InputSurfaceConnection(
- const sp<GraphicBufferSource>& source,
- const std::shared_ptr<C2Component>& comp,
- const std::shared_ptr<ParameterCache>& cache)
- : mImpl{new Impl(source, comp)},
- mConfigurable{new CachedConfigurable(
- std::make_unique<Impl::ConfigurableIntf>(mImpl))} {
- mConfigurable->init(cache);
-}
-
-InputSurfaceConnection::InputSurfaceConnection(
- const sp<GraphicBufferSource>& source,
- const sp<IInputSink>& sink,
- const std::shared_ptr<ParameterCache>& cache)
- : mImpl{new Impl(source, sink)},
- mConfigurable{new CachedConfigurable(
- std::make_unique<Impl::ConfigurableIntf>(mImpl))} {
- mConfigurable->init(cache);
-}
-
-Return<Status> InputSurfaceConnection::disconnect() {
- std::lock_guard<std::mutex> lock(mImplMutex);
- mImpl = nullptr;
- return Status::OK;
-}
-
-InputSurfaceConnection::~InputSurfaceConnection() {
- mImpl = nullptr;
-}
-
-bool InputSurfaceConnection::init() {
- std::lock_guard<std::mutex> lock(mImplMutex);
- return mImpl->init();
-}
-
-Return<sp<IConfigurable>> InputSurfaceConnection::getConfigurable() {
- return mConfigurable;
-}
-
-// Configurable interface for InputSurfaceConnection::Impl
-c2_status_t InputSurfaceConnection::Impl::ConfigurableIntf::config(
- const std::vector<C2Param*> ¶ms,
- c2_blocking_t mayBlock,
- std::vector<std::unique_ptr<C2SettingResult>> *const failures) {
- // TODO: implement
- (void)params;
- (void)mayBlock;
- (void)failures;
- return C2_OK;
-}
-
-c2_status_t InputSurfaceConnection::Impl::ConfigurableIntf::query(
- const std::vector<C2Param::Index> &indices,
- c2_blocking_t mayBlock,
- std::vector<std::unique_ptr<C2Param>> *const params) const {
- // TODO: implement
- (void)indices;
- (void)mayBlock;
- (void)params;
- return C2_OK;
-}
-
-c2_status_t InputSurfaceConnection::Impl::ConfigurableIntf::querySupportedParams(
- std::vector<std::shared_ptr<C2ParamDescriptor>> *const params) const {
- // TODO: implement
- (void)params;
- return C2_OK;
-}
-
-c2_status_t InputSurfaceConnection::Impl::ConfigurableIntf::querySupportedValues(
- std::vector<C2FieldSupportedValuesQuery> &fields,
- c2_blocking_t mayBlock) const {
- // TODO: implement
- (void)fields;
- (void)mayBlock;
- return C2_OK;
-}
-
-} // namespace utils
-} // namespace V1_0
-} // namespace c2
-} // namespace media
-} // namespace hardware
-} // namespace android
-
diff --git a/media/codec2/hal/aidl/fuzzer.cpp b/media/codec2/hal/aidl/fuzzer.cpp
new file mode 100644
index 0000000..c1a2762
--- /dev/null
+++ b/media/codec2/hal/aidl/fuzzer.cpp
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <fuzzbinder/libbinder_ndk_driver.h>
+#include <fuzzer/FuzzedDataProvider.h>
+
+#include <C2PlatformSupport.h>
+
+#include <android/binder_interface_utils.h>
+#include <codec2/aidl/ComponentStore.h>
+
+using aidl::android::hardware::media::c2::utils::ComponentStore;
+using android::fuzzService;
+using ndk::SharedRefBase;
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+ std::shared_ptr<C2ComponentStore> store = ::android::GetCodec2PlatformComponentStore();
+ std::shared_ptr<ComponentStore> binder = SharedRefBase::make<ComponentStore>(store);
+
+ fuzzService(binder->asBinder().get(), FuzzedDataProvider(data, size));
+
+ return 0;
+}
diff --git a/media/codec2/hal/aidl/include/codec2/aidl/Component.h b/media/codec2/hal/aidl/include/codec2/aidl/Component.h
index e343655..d5ea92b 100644
--- a/media/codec2/hal/aidl/include/codec2/aidl/Component.h
+++ b/media/codec2/hal/aidl/include/codec2/aidl/Component.h
@@ -14,21 +14,19 @@
* limitations under the License.
*/
-#ifndef CODEC2_HIDL_V1_0_UTILS_COMPONENT_H
-#define CODEC2_HIDL_V1_0_UTILS_COMPONENT_H
+#ifndef CODEC2_AIDL_UTILS_COMPONENT_H
+#define CODEC2_AIDL_UTILS_COMPONENT_H
-#include <codec2/hidl/1.0/ComponentInterface.h>
-#include <codec2/hidl/1.0/Configurable.h>
-#include <codec2/hidl/1.0/types.h>
+#include <codec2/aidl/ComponentInterface.h>
+#include <codec2/aidl/Configurable.h>
+#include <codec2/aidl/BufferTypes.h>
+#include <codec2/aidl/ParamTypes.h>
-#include <android/hardware/media/bufferpool/2.0/IClientManager.h>
-#include <android/hardware/media/c2/1.0/IComponent.h>
-#include <android/hardware/media/c2/1.0/IComponentInterface.h>
-#include <android/hardware/media/c2/1.0/IComponentListener.h>
-#include <android/hardware/media/c2/1.0/IComponentStore.h>
-#include <android/hardware/media/c2/1.0/IInputSink.h>
-#include <hidl/Status.h>
-#include <hwbinder/IBinder.h>
+#include <aidl/android/hardware/media/bufferpool2/IClientManager.h>
+#include <aidl/android/hardware/media/c2/BnComponent.h>
+#include <aidl/android/hardware/media/c2/IComponentInterface.h>
+#include <aidl/android/hardware/media/c2/IComponentListener.h>
+#include <aidl/android/hardware/media/c2/IComponentStore.h>
#include <C2Component.h>
#include <C2Buffer.h>
@@ -38,86 +36,50 @@
#include <memory>
#include <mutex>
+namespace aidl {
namespace android {
namespace hardware {
namespace media {
namespace c2 {
-namespace V1_0 {
namespace utils {
-using ::android::hardware::hidl_array;
-using ::android::hardware::hidl_memory;
-using ::android::hardware::hidl_string;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::Return;
-using ::android::hardware::Void;
-using ::android::hardware::IBinder;
-using ::android::sp;
-using ::android::wp;
struct ComponentStore;
-struct Component : public IComponent,
+struct Component : public BnComponent,
public std::enable_shared_from_this<Component> {
Component(
const std::shared_ptr<C2Component>&,
- const sp<IComponentListener>& listener,
- const sp<ComponentStore>& store,
- const sp<::android::hardware::media::bufferpool::V2_0::
- IClientManager>& clientPoolManager);
+ const std::shared_ptr<IComponentListener>& listener,
+ const std::shared_ptr<ComponentStore>& store,
+ const std::shared_ptr<bufferpool2::IClientManager>& clientPoolManager);
c2_status_t status() const;
- typedef ::android::hardware::graphics::bufferqueue::V1_0::
- IGraphicBufferProducer HGraphicBufferProducer1;
- typedef ::android::hardware::graphics::bufferqueue::V2_0::
- IGraphicBufferProducer HGraphicBufferProducer2;
-
// Methods from IComponent follow.
- virtual Return<Status> queue(const WorkBundle& workBundle) override;
- virtual Return<void> flush(flush_cb _hidl_cb) override;
- virtual Return<Status> drain(bool withEos) override;
- virtual Return<Status> setOutputSurface(
- uint64_t blockPoolId,
- const sp<HGraphicBufferProducer2>& surface) override;
- virtual Return<void> connectToInputSurface(
- const sp<IInputSurface>& inputSurface,
- connectToInputSurface_cb _hidl_cb) override;
- virtual Return<void> connectToOmxInputSurface(
- const sp<HGraphicBufferProducer1>& producer,
- const sp<::android::hardware::media::omx::V1_0::
- IGraphicBufferSource>& source,
- connectToOmxInputSurface_cb _hidl_cb) override;
- virtual Return<Status> disconnectFromInputSurface() override;
- virtual Return<void> createBlockPool(
- uint32_t allocatorId,
- createBlockPool_cb _hidl_cb) override;
- virtual Return<Status> destroyBlockPool(uint64_t blockPoolId) override;
- virtual Return<Status> start() override;
- virtual Return<Status> stop() override;
- virtual Return<Status> reset() override;
- virtual Return<Status> release() override;
- virtual Return<sp<IComponentInterface>> getInterface() override;
- virtual Return<sp<IInputSink>> asInputSink() override;
-
- // Returns a C2Component associated to the given sink if the sink is indeed
- // a local component. Returns nullptr otherwise.
- //
- // This function is used by InputSurface::connect().
- static std::shared_ptr<C2Component> findLocalComponent(
- const sp<IInputSink>& sink);
+ ::ndk::ScopedAStatus queue(const WorkBundle& workBundle) override;
+ ::ndk::ScopedAStatus flush(WorkBundle *workBundle) override;
+ ::ndk::ScopedAStatus drain(bool withEos) override;
+ ::ndk::ScopedAStatus createBlockPool(
+ const IComponent::BlockPoolAllocator &allocator,
+ IComponent::BlockPool *blockPool) override;
+ ::ndk::ScopedAStatus destroyBlockPool(int64_t blockPoolId) override;
+ ::ndk::ScopedAStatus start() override;
+ ::ndk::ScopedAStatus stop() override;
+ ::ndk::ScopedAStatus reset() override;
+ ::ndk::ScopedAStatus release() override;
+ ::ndk::ScopedAStatus getInterface(
+ std::shared_ptr<IComponentInterface> *intf) override;
+ ::ndk::ScopedAStatus configureVideoTunnel(
+ int32_t avSyncHwId,
+ common::NativeHandle* handle) override;
protected:
c2_status_t mInit;
std::shared_ptr<C2Component> mComponent;
- sp<ComponentInterface> mInterface;
- sp<IComponentListener> mListener;
- sp<ComponentStore> mStore;
- ::android::hardware::media::c2::V1_0::utils::DefaultBufferPoolSender
- mBufferPoolSender;
-
- struct Sink;
- std::mutex mSinkMutex;
- sp<Sink> mSink;
+ std::shared_ptr<ComponentInterface> mInterface;
+ std::shared_ptr<IComponentListener> mListener;
+ std::shared_ptr<ComponentStore> mStore;
+ DefaultBufferPoolSender mBufferPoolSender;
std::mutex mBlockPoolsMutex;
// This map keeps C2BlockPool objects that are created by createBlockPool()
@@ -125,7 +87,7 @@
// destroyBlockPool(), reset() or release(), or by destroying the component.
std::map<uint64_t, std::shared_ptr<C2BlockPool>> mBlockPools;
- void initListener(const sp<Component>& self);
+ void initListener(const std::shared_ptr<Component>& self);
virtual ~Component() override;
@@ -133,15 +95,18 @@
struct Listener;
- using HwDeathRecipient = ::android::hardware::hidl_death_recipient;
- sp<HwDeathRecipient> mDeathRecipient;
+ ::ndk::ScopedAIBinder_DeathRecipient mDeathRecipient;
+ static void OnBinderDied(void *cookie);
+ static void OnBinderUnlinked(void *cookie);
+ struct DeathContext;
+ DeathContext *mDeathContext;
};
} // namespace utils
-} // namespace V1_0
} // namespace c2
} // namespace media
} // namespace hardware
} // namespace android
+} // namespace aidl
-#endif // CODEC2_HIDL_V1_0_UTILS_COMPONENT_H
+#endif // CODEC2_AIDL_UTILS_COMPONENT_H
diff --git a/media/codec2/hal/aidl/include/codec2/aidl/ComponentInterface.h b/media/codec2/hal/aidl/include/codec2/aidl/ComponentInterface.h
index 9102f92..7723bee 100644
--- a/media/codec2/hal/aidl/include/codec2/aidl/ComponentInterface.h
+++ b/media/codec2/hal/aidl/include/codec2/aidl/ComponentInterface.h
@@ -14,14 +14,13 @@
* limitations under the License.
*/
-#ifndef CODEC2_HIDL_V1_0_UTILS_COMPONENT_INTERFACE_H
-#define CODEC2_HIDL_V1_0_UTILS_COMPONENT_INTERFACE_H
+#ifndef CODEC2_AIDL_UTILS_COMPONENT_INTERFACE_H
+#define CODEC2_AIDL_UTILS_COMPONENT_INTERFACE_H
-#include <codec2/hidl/1.0/Configurable.h>
-#include <codec2/hidl/1.0/types.h>
+#include <codec2/aidl/Configurable.h>
+#include <codec2/aidl/ParamTypes.h>
-#include <android/hardware/media/c2/1.0/IComponentInterface.h>
-#include <hidl/Status.h>
+#include <aidl/android/hardware/media/c2/BnComponentInterface.h>
#include <C2Component.h>
#include <C2Buffer.h>
@@ -29,38 +28,35 @@
#include <memory>
+namespace aidl {
namespace android {
namespace hardware {
namespace media {
namespace c2 {
-namespace V1_0 {
namespace utils {
-using ::android::hardware::Return;
-using ::android::hardware::Void;
-using ::android::sp;
-
struct ComponentStore;
-struct ComponentInterface : public IComponentInterface {
+struct ComponentInterface : public BnComponentInterface {
ComponentInterface(
const std::shared_ptr<C2ComponentInterface>& interface,
const std::shared_ptr<ParameterCache>& cache);
c2_status_t status() const;
- virtual Return<sp<IConfigurable>> getConfigurable() override;
+ ::ndk::ScopedAStatus getConfigurable(
+ std::shared_ptr<IConfigurable> *intf) override;
protected:
std::shared_ptr<C2ComponentInterface> mInterface;
- sp<CachedConfigurable> mConfigurable;
+ std::shared_ptr<CachedConfigurable> mConfigurable;
c2_status_t mInit;
};
} // namespace utils
-} // namespace V1_0
} // namespace c2
} // namespace media
} // namespace hardware
} // namespace android
+} // namespace aidl
-#endif // CODEC2_HIDL_V1_0_UTILS_COMPONENT_INTERFACE_H
+#endif // CODEC2_AIDL_UTILS_COMPONENT_INTERFACE_H
diff --git a/media/codec2/hal/aidl/include/codec2/aidl/ComponentStore.h b/media/codec2/hal/aidl/include/codec2/aidl/ComponentStore.h
index 27e2a05..7fc5d2f 100644
--- a/media/codec2/hal/aidl/include/codec2/aidl/ComponentStore.h
+++ b/media/codec2/hal/aidl/include/codec2/aidl/ComponentStore.h
@@ -14,16 +14,15 @@
* limitations under the License.
*/
-#ifndef CODEC2_HIDL_V1_0_UTILS_COMPONENTSTORE_H
-#define CODEC2_HIDL_V1_0_UTILS_COMPONENTSTORE_H
+#ifndef CODEC2_AIDL_UTILS_COMPONENTSTORE_H
+#define CODEC2_AIDL_UTILS_COMPONENTSTORE_H
-#include <codec2/hidl/1.0/Component.h>
-#include <codec2/hidl/1.0/ComponentInterface.h>
-#include <codec2/hidl/1.0/Configurable.h>
+#include <android/binder_auto_utils.h>
+#include <codec2/aidl/ComponentInterface.h>
+#include <codec2/aidl/Configurable.h>
-#include <android/hardware/media/bufferpool/2.0/IClientManager.h>
-#include <android/hardware/media/c2/1.0/IComponentStore.h>
-#include <hidl/Status.h>
+#include <aidl/android/hardware/media/bufferpool2/IClientManager.h>
+#include <aidl/android/hardware/media/c2/BnComponentStore.h>
#include <C2Component.h>
#include <C2Param.h>
@@ -38,23 +37,21 @@
namespace android {
class FilterWrapper;
+} // namespace android
+namespace aidl {
+namespace android {
namespace hardware {
namespace media {
namespace c2 {
-namespace V1_0 {
namespace utils {
-using ::android::hardware::media::bufferpool::V2_0::IClientManager;
+struct Component;
-using ::android::hardware::hidl_handle;
-using ::android::hardware::hidl_string;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::Return;
-using ::android::hardware::Void;
-using ::android::sp;
+using ::aidl::android::hardware::media::bufferpool2::IClientManager;
-struct ComponentStore : public IComponentStore {
+struct ComponentStore : public BnComponentStore,
+ public std::enable_shared_from_this<ComponentStore> {
ComponentStore(const std::shared_ptr<C2ComponentStore>& store);
virtual ~ComponentStore();
@@ -76,38 +73,38 @@
*/
std::shared_ptr<ParameterCache> getParameterCache() const;
- static std::shared_ptr<FilterWrapper> GetFilterWrapper();
+ static std::shared_ptr<::android::FilterWrapper> GetFilterWrapper();
- // Methods from ::android::hardware::media::c2::V1_0::IComponentStore.
- virtual Return<void> createComponent(
- const hidl_string& name,
- const sp<IComponentListener>& listener,
- const sp<IClientManager>& pool,
- createComponent_cb _hidl_cb) override;
- virtual Return<void> createInterface(
- const hidl_string& name,
- createInterface_cb _hidl_cb) override;
- virtual Return<void> listComponents(listComponents_cb _hidl_cb) override;
- virtual Return<void> createInputSurface(
- createInputSurface_cb _hidl_cb) override;
- virtual Return<void> getStructDescriptors(
- const hidl_vec<uint32_t>& indices,
- getStructDescriptors_cb _hidl_cb) override;
- virtual Return<sp<IClientManager>> getPoolClientManager() override;
- virtual Return<Status> copyBuffer(
+ // Methods from ::aidl::android::hardware::media::c2::IComponentStore.
+ virtual ::ndk::ScopedAStatus createComponent(
+ const std::string& name,
+ const std::shared_ptr<IComponentListener>& listener,
+ const std::shared_ptr<IClientManager>& pool,
+ std::shared_ptr<IComponent> *component) override;
+ virtual ::ndk::ScopedAStatus createInterface(
+ const std::string& name,
+ std::shared_ptr<IComponentInterface> *intf) override;
+ virtual ::ndk::ScopedAStatus listComponents(
+ std::vector<IComponentStore::ComponentTraits>* traits) override;
+ virtual ::ndk::ScopedAStatus getStructDescriptors(
+ const std::vector<int32_t>& indices,
+ std::vector<StructDescriptor> *descs) override;
+ virtual ::ndk::ScopedAStatus getPoolClientManager(
+ std::shared_ptr<IClientManager> *manager) override;
+ virtual ::ndk::ScopedAStatus copyBuffer(
const Buffer& src,
const Buffer& dst) override;
- virtual Return<sp<IConfigurable>> getConfigurable() override;
+ virtual ::ndk::ScopedAStatus getConfigurable(
+ std::shared_ptr<IConfigurable> *configurable) override;
/**
* Dumps information when lshal is called.
*/
- virtual Return<void> debug(
- const hidl_handle& handle,
- const hidl_vec<hidl_string>& args) override;
+ virtual binder_status_t dump(
+ int fd, const char** args, uint32_t numArgs) override;
protected:
- sp<CachedConfigurable> mConfigurable;
+ std::shared_ptr<CachedConfigurable> mConfigurable;
struct StoreParameterCache;
std::shared_ptr<StoreParameterCache> mParameterCache;
@@ -153,10 +150,10 @@
};
} // namespace utils
-} // namespace V1_0
} // namespace c2
} // namespace media
} // namespace hardware
} // namespace android
+} // namespace aidl
-#endif // CODEC2_HIDL_V1_0_UTILS_COMPONENTSTORE_H
+#endif // CODEC2_AIDL_UTILS_COMPONENTSTORE_H
diff --git a/media/codec2/hal/aidl/include/codec2/aidl/Configurable.h b/media/codec2/hal/aidl/include/codec2/aidl/Configurable.h
index 8f49a97..6cc2c1b 100644
--- a/media/codec2/hal/aidl/include/codec2/aidl/Configurable.h
+++ b/media/codec2/hal/aidl/include/codec2/aidl/Configurable.h
@@ -14,11 +14,10 @@
* limitations under the License.
*/
-#ifndef CODEC2_HIDL_V1_0_UTILS_CONFIGURABLE_H
-#define CODEC2_HIDL_V1_0_UTILS_CONFIGURABLE_H
+#ifndef CODEC2_AIDL_UTILS_CONFIGURABLE_H
+#define CODEC2_AIDL_UTILS_CONFIGURABLE_H
-#include <android/hardware/media/c2/1.0/IConfigurable.h>
-#include <hidl/Status.h>
+#include <aidl/android/hardware/media/c2/BnConfigurable.h>
#include <C2Component.h>
#include <C2Param.h>
@@ -26,18 +25,13 @@
#include <memory>
+namespace aidl {
namespace android {
namespace hardware {
namespace media {
namespace c2 {
-namespace V1_0 {
namespace utils {
-using ::android::hardware::hidl_vec;
-using ::android::hardware::Return;
-using ::android::hardware::Void;
-using ::android::sp;
-
struct ComponentStore;
/**
@@ -102,7 +96,7 @@
*
* Note that caching happens
*/
-struct CachedConfigurable : public IConfigurable {
+struct CachedConfigurable : public BnConfigurable {
CachedConfigurable(std::unique_ptr<ConfigurableC2Intf>&& intf);
// Populates mSupportedParams.
@@ -110,29 +104,29 @@
// Methods from ::android::hardware::media::c2::V1_0::IConfigurable
- virtual Return<uint32_t> getId() override;
+ virtual ::ndk::ScopedAStatus getId(int32_t* id) override;
- virtual Return<void> getName(getName_cb _hidl_cb) override;
+ virtual ::ndk::ScopedAStatus getName(std::string* name) override;
- virtual Return<void> query(
- const hidl_vec<uint32_t>& indices,
+ virtual ::ndk::ScopedAStatus query(
+ const std::vector<int32_t>& indices,
bool mayBlock,
- query_cb _hidl_cb) override;
+ Params* params) override;
- virtual Return<void> config(
- const hidl_vec<uint8_t>& inParams,
+ virtual ::ndk::ScopedAStatus config(
+ const ::aidl::android::hardware::media::c2::Params& params,
bool mayBlock,
- config_cb _hidl_cb) override;
+ ConfigResult* result) override;
- virtual Return<void> querySupportedParams(
- uint32_t start,
- uint32_t count,
- querySupportedParams_cb _hidl_cb) override;
+ virtual ::ndk::ScopedAStatus querySupportedParams(
+ int32_t start,
+ int32_t count,
+ std::vector<ParamDescriptor>* paramDesc) override;
- virtual Return<void> querySupportedValues(
- const hidl_vec<FieldSupportedValuesQuery>& inFields,
+ virtual ::ndk::ScopedAStatus querySupportedValues(
+ const std::vector<FieldSupportedValuesQuery>& fields,
bool mayBlock,
- querySupportedValues_cb _hidl_cb) override;
+ std::vector<FieldSupportedValuesQueryResult>* result) override;
protected:
// Common Codec2.0 interface wrapper
@@ -143,11 +137,11 @@
};
} // namespace utils
-} // namespace V1_0
} // namespace c2
} // namespace media
} // namespace hardware
} // namespace android
+} // namespace aidl
-#endif // CODEC2_HIDL_V1_0_UTILS_CONFIGURABLE_H
+#endif // CODEC2_AIDL_UTILS_CONFIGURABLE_H
diff --git a/media/codec2/hal/aidl/include/codec2/aidl/InputBufferManager.h b/media/codec2/hal/aidl/include/codec2/aidl/InputBufferManager.h
index 42fa557..4e107a8 100644
--- a/media/codec2/hal/aidl/include/codec2/aidl/InputBufferManager.h
+++ b/media/codec2/hal/aidl/include/codec2/aidl/InputBufferManager.h
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-#ifndef CODEC2_HIDL_V1_0_UTILS_INPUT_BUFFER_MANAGER_H
-#define CODEC2_HIDL_V1_0_UTILS_INPUT_BUFFER_MANAGER_H
+#ifndef CODEC2_AIDL_UTILS_INPUT_BUFFER_MANAGER_H
+#define CODEC2_AIDL_UTILS_INPUT_BUFFER_MANAGER_H
-#include <android/hardware/media/c2/1.0/IComponentListener.h>
+#include <aidl/android/hardware/media/c2/IComponentListener.h>
#include <utils/Timers.h>
#include <C2Buffer.h>
@@ -27,15 +27,13 @@
#include <map>
#include <thread>
+namespace aidl {
namespace android {
namespace hardware {
namespace media {
namespace c2 {
-namespace V1_0 {
namespace utils {
-using namespace ::android;
-
/**
* InputBufferManager
* ==================
@@ -118,7 +116,7 @@
* \param input Input frame data whose input buffers are to be tracked.
*/
static void registerFrameData(
- const sp<IComponentListener>& listener,
+ const std::shared_ptr<IComponentListener>& listener,
const C2FrameData& input);
/**
@@ -134,7 +132,7 @@
* \param input Previously registered frame data.
*/
static void unregisterFrameData(
- const wp<IComponentListener>& listener,
+ const std::weak_ptr<IComponentListener>& listener,
const C2FrameData& input);
/**
@@ -150,7 +148,7 @@
* \param listener Previously registered listener.
*/
static void unregisterFrameData(
- const wp<IComponentListener>& listener);
+ const std::weak_ptr<IComponentListener>& listener);
/**
* Set the notification interval.
@@ -161,13 +159,13 @@
private:
void _registerFrameData(
- const sp<IComponentListener>& listener,
+ const std::shared_ptr<IComponentListener>& listener,
const C2FrameData& input);
void _unregisterFrameData(
- const wp<IComponentListener>& listener,
+ const std::weak_ptr<IComponentListener>& listener,
const C2FrameData& input);
void _unregisterFrameData(
- const wp<IComponentListener>& listener);
+ const std::weak_ptr<IComponentListener>& listener);
void _setNotificationInterval(nsecs_t notificationIntervalNs);
// The callback function tied to C2Buffer objects.
@@ -184,11 +182,11 @@
// Note that the "key" is bufferIndex according to operator<(). This is
// designed to work with TrackedBuffersMap defined below.
struct TrackedBuffer {
- wp<IComponentListener> listener;
+ std::weak_ptr<IComponentListener> listener;
uint64_t frameIndex;
size_t bufferIndex;
std::weak_ptr<C2Buffer> buffer;
- TrackedBuffer(const wp<IComponentListener>& listener,
+ TrackedBuffer(const std::weak_ptr<IComponentListener>& listener,
uint64_t frameIndex,
size_t bufferIndex,
const std::shared_ptr<C2Buffer>& buffer)
@@ -204,9 +202,10 @@
// However, the value of the innermost map is TrackedBuffer, which also
// contains an extra copy of listener and frameIndex. This is needed
// because onBufferDestroyed() needs to know listener and frameIndex too.
- typedef std::map<wp<IComponentListener>,
+ typedef std::map<std::weak_ptr<IComponentListener>,
std::map<uint64_t,
- std::set<TrackedBuffer*>>> TrackedBuffersMap;
+ std::set<TrackedBuffer*>>,
+ std::owner_less<std::weak_ptr<IComponentListener>>> TrackedBuffersMap;
// Storage for pending (unsent) death notifications for one listener.
// Each pair in member named "indices" are (frameIndex, bufferIndex) from
@@ -261,7 +260,9 @@
// A DeathNotifications object is associated to each listener. An entry in
// this map will be removed if its associated DeathNotifications has count =
// 0 and lastSentNs < systemTime() - mNotificationIntervalNs.
- std::map<wp<IComponentListener>, DeathNotifications> mDeathNotifications;
+ std::map<std::weak_ptr<IComponentListener>,
+ DeathNotifications,
+ std::owner_less<std::weak_ptr<IComponentListener>>> mDeathNotifications;
// Condition variable signaled when an entry is added to mDeathNotifications.
std::condition_variable mOnBufferDestroyed;
@@ -290,11 +291,11 @@
};
} // namespace utils
-} // namespace V1_0
} // namespace c2
} // namespace media
} // namespace hardware
} // namespace android
+} // namespace aidl
-#endif // CODEC2_HIDL_V1_0_UTILS_INPUT_BUFFER_MANAGER_H
+#endif // CODEC2_AIDL_UTILS_INPUT_BUFFER_MANAGER_H
diff --git a/media/codec2/hal/aidl/include/codec2/aidl/InputSurface.h b/media/codec2/hal/aidl/include/codec2/aidl/InputSurface.h
deleted file mode 100644
index 062dcd9..0000000
--- a/media/codec2/hal/aidl/include/codec2/aidl/InputSurface.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef CODEC2_HIDL_V1_0_UTILS_INPUTSURFACE_H
-#define CODEC2_HIDL_V1_0_UTILS_INPUTSURFACE_H
-
-#include <codec2/hidl/1.0/ComponentStore.h>
-
-#include <android/hardware/graphics/bufferqueue/2.0/IGraphicBufferProducer.h>
-#include <android/hardware/media/c2/1.0/IInputSink.h>
-#include <android/hardware/media/c2/1.0/IInputSurface.h>
-#include <hidl/Status.h>
-#include <media/stagefright/bqhelper/GraphicBufferSource.h>
-
-#include <util/C2InterfaceHelper.h>
-
-namespace android {
-namespace hardware {
-namespace media {
-namespace c2 {
-namespace V1_0 {
-namespace utils {
-
-using ::android::hardware::hidl_handle;
-using ::android::hardware::hidl_string;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::Return;
-using ::android::hardware::Void;
-using ::android::sp;
-
-struct InputSurface : public IInputSurface {
-
- typedef ::android::hardware::graphics::bufferqueue::V2_0::
- IGraphicBufferProducer HGraphicBufferProducer;
-
- typedef ::android::
- GraphicBufferSource GraphicBufferSource;
-
- virtual Return<sp<HGraphicBufferProducer>> getGraphicBufferProducer() override;
-
- virtual Return<sp<IConfigurable>> getConfigurable() override;
-
- virtual Return<void> connect(
- const sp<IInputSink>& sink,
- connect_cb _hidl_cb) override;
-
- InputSurface(
- const std::shared_ptr<ParameterCache>& cache,
- const std::shared_ptr<C2ReflectorHelper>& reflector,
- const sp<HGraphicBufferProducer>& base,
- const sp<GraphicBufferSource>& source);
-
-protected:
-
- class Interface;
- class ConfigurableIntf;
-
- std::shared_ptr<ParameterCache> mParameterCache;
- sp<HGraphicBufferProducer> mProducer;
- sp<GraphicBufferSource> mSource;
- std::shared_ptr<Interface> mIntf;
- sp<CachedConfigurable> mConfigurable;
-
- virtual ~InputSurface() override = default;
-};
-
-} // namespace utils
-} // namespace V1_0
-} // namespace c2
-} // namespace media
-} // namespace hardware
-} // namespace android
-
-#endif // CODEC2_HIDL_V1_0_UTILS_INPUTSURFACE_H
diff --git a/media/codec2/hal/aidl/include/codec2/aidl/InputSurfaceConnection.h b/media/codec2/hal/aidl/include/codec2/aidl/InputSurfaceConnection.h
deleted file mode 100644
index 475ce8b..0000000
--- a/media/codec2/hal/aidl/include/codec2/aidl/InputSurfaceConnection.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef CODEC2_HIDL_V1_0_UTILS_INPUTSURFACECONNECTION_H
-#define CODEC2_HIDL_V1_0_UTILS_INPUTSURFACECONNECTION_H
-
-#include <codec2/hidl/1.0/Component.h>
-#include <codec2/hidl/1.0/Configurable.h>
-
-#include <android/hardware/media/c2/1.0/IComponent.h>
-#include <android/hardware/media/c2/1.0/IConfigurable.h>
-#include <android/hardware/media/c2/1.0/IInputSurfaceConnection.h>
-
-#include <media/stagefright/bqhelper/GraphicBufferSource.h>
-
-#include <hidl/HidlSupport.h>
-#include <hidl/Status.h>
-
-#include <C2Component.h>
-
-#include <memory>
-#include <mutex>
-
-namespace android {
-namespace hardware {
-namespace media {
-namespace c2 {
-namespace V1_0 {
-namespace utils {
-
-using ::android::hardware::Return;
-using ::android::hardware::Void;
-using ::android::sp;
-using ::android::GraphicBufferSource;
-
-// An InputSurfaceConnection connects an InputSurface to a sink, which may be an
-// IInputSink or a local C2Component. This can be specified by choosing the
-// corresponding constructor. The reason for distinguishing these two cases is
-// that when an InputSurfaceConnection lives in the same process as the
-// component that processes the buffers, data parceling is not needed.
-struct InputSurfaceConnection : public IInputSurfaceConnection {
-
- virtual Return<Status> disconnect() override;
-
- virtual Return<sp<IConfigurable>> getConfigurable() override;
-
-protected:
-
- InputSurfaceConnection(
- const sp<GraphicBufferSource>& source,
- const std::shared_ptr<C2Component>& comp,
- const std::shared_ptr<ParameterCache>& cache);
-
- InputSurfaceConnection(
- const sp<GraphicBufferSource>& source,
- const sp<IInputSink>& sink,
- const std::shared_ptr<ParameterCache>& cache);
-
- bool init();
-
- friend struct InputSurface;
-
- InputSurfaceConnection() = delete;
- InputSurfaceConnection(const InputSurfaceConnection&) = delete;
- void operator=(const InputSurfaceConnection&) = delete;
-
- struct Impl;
-
- std::mutex mImplMutex;
- sp<Impl> mImpl;
- sp<CachedConfigurable> mConfigurable;
-
- virtual ~InputSurfaceConnection() override;
-};
-
-} // namespace utils
-} // namespace V1_0
-} // namespace c2
-} // namespace media
-} // namespace hardware
-} // namespace android
-
-#endif // CODEC2_HIDL_V1_0_UTILS_INPUTSURFACECONNECTION_H
diff --git a/media/codec2/hal/client/Android.bp b/media/codec2/hal/client/Android.bp
index 22aa35e..0b5b940 100644
--- a/media/codec2/hal/client/Android.bp
+++ b/media/codec2/hal/client/Android.bp
@@ -23,6 +23,7 @@
name: "libcodec2_client",
srcs: [
+ "GraphicBufferAllocator.cpp",
"GraphicsTracker.cpp",
"client.cpp",
"output.cpp",
diff --git a/media/codec2/hal/client/GraphicBufferAllocator.cpp b/media/codec2/hal/client/GraphicBufferAllocator.cpp
new file mode 100644
index 0000000..bbef1b5
--- /dev/null
+++ b/media/codec2/hal/client/GraphicBufferAllocator.cpp
@@ -0,0 +1,152 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <gui/IProducerListener.h>
+#include <media/stagefright/foundation/ADebug.h>
+
+#include <codec2/aidl/GraphicBufferAllocator.h>
+#include <codec2/aidl/GraphicsTracker.h>
+
+namespace aidl::android::hardware::media::c2::implementation {
+
+class OnBufferReleasedListener : public ::android::BnProducerListener {
+private:
+ uint32_t mGeneration;
+ std::weak_ptr<GraphicBufferAllocator> mAllocator;
+public:
+ OnBufferReleasedListener(
+ uint32_t generation,
+ const std::shared_ptr<GraphicBufferAllocator> &allocator)
+ : mGeneration(generation), mAllocator(allocator) {}
+ virtual ~OnBufferReleasedListener() = default;
+ virtual void onBufferReleased() {
+ auto p = mAllocator.lock();
+ if (p) {
+ p->onBufferReleased(mGeneration);
+ }
+ }
+ virtual bool needsReleaseNotify() { return true; }
+};
+
+::ndk::ScopedAStatus GraphicBufferAllocator::allocate(
+ const IGraphicBufferAllocator::Description& in_desc,
+ IGraphicBufferAllocator::Allocation* _aidl_return) {
+ AHardwareBuffer *buf;
+ ::android::sp<::android::Fence> fence;
+ c2_status_t ret = allocate(
+ in_desc.width, in_desc.height, in_desc.format, in_desc.usage,
+ &buf, &fence);
+ if (ret == C2_OK) {
+ _aidl_return->buffer.reset(buf);
+ _aidl_return->fence = ::ndk::ScopedFileDescriptor(fence->dup());
+ return ::ndk::ScopedAStatus::ok();
+ }
+ return ::ndk::ScopedAStatus::fromServiceSpecificError(ret);
+}
+
+::ndk::ScopedAStatus GraphicBufferAllocator::deallocate(int64_t in_id, bool* _aidl_return) {
+ *_aidl_return = deallocate(in_id, ::android::Fence::NO_FENCE);
+ return ::ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus GraphicBufferAllocator::getWaitableFds(
+ IGraphicBufferAllocator::WaitableFds* _aidl_return) {
+ int allocFd;
+ int statusFd;
+ c2_status_t ret = mGraphicsTracker->getWaitableFds(&allocFd, &statusFd);
+ if (ret == C2_OK) {
+ _aidl_return->allocEvent.set(allocFd);
+ _aidl_return->statusEvent.set(statusFd);
+ return ::ndk::ScopedAStatus::ok();
+ }
+ return ::ndk::ScopedAStatus::fromServiceSpecificError(ret);
+}
+
+bool GraphicBufferAllocator::configure(
+ const ::android::sp<IGraphicBufferProducer>& igbp,
+ uint32_t generation,
+ int maxDequeueBufferCount) {
+ c2_status_t ret = C2_OK;
+
+ ret = mGraphicsTracker->configureGraphics(igbp, generation);
+ if (ret != C2_OK) {
+ ALOGE("configuring igbp failed gen #(%d), configuring max dequeue count didn't happen",
+ (unsigned int)generation);
+ return false;
+ }
+
+ ret = mGraphicsTracker->configureMaxDequeueCount(maxDequeueBufferCount);
+ if (ret != C2_OK) {
+ ALOGE("configuring max dequeue count to %d failed", maxDequeueBufferCount);
+ return false;
+ }
+ return true;
+}
+
+void GraphicBufferAllocator::updateMaxDequeueBufferCount(int count) {
+ c2_status_t ret = mGraphicsTracker->configureMaxDequeueCount(count);
+ if (ret != C2_OK) {
+ ALOGE("updating max dequeue buffer count failed %d", ret);
+ }
+}
+
+void GraphicBufferAllocator::reset() {
+ mGraphicsTracker->stop();
+}
+
+const ::android::sp<::android::IProducerListener> GraphicBufferAllocator::createReleaseListener(
+ uint32_t generation) {
+ return new OnBufferReleasedListener(generation, ref<GraphicBufferAllocator>());
+}
+
+void GraphicBufferAllocator::onBufferReleased(uint32_t generation) {
+ mGraphicsTracker->onReleased(generation);
+}
+
+c2_status_t GraphicBufferAllocator::allocate(
+ uint32_t width, uint32_t height, ::android::PixelFormat format, uint64_t usage,
+ AHardwareBuffer **buf, ::android::sp<::android::Fence> *fence) {
+ return mGraphicsTracker->allocate(width, height, format, usage, buf, fence);
+}
+
+bool GraphicBufferAllocator::deallocate(const uint64_t id,
+ const ::android::sp<::android::Fence> &fence) {
+ c2_status_t ret = mGraphicsTracker->deallocate(id, fence);
+ if (ret != C2_OK) {
+ ALOGW("deallocate() %llu was not successful %d", (unsigned long long)id, ret);
+ return false;
+ }
+ return true;
+}
+
+c2_status_t GraphicBufferAllocator::displayBuffer(
+ const C2ConstGraphicBlock& block,
+ const IGraphicBufferProducer::QueueBufferInput& input,
+ IGraphicBufferProducer::QueueBufferOutput *output) {
+ return mGraphicsTracker->render(block, input, output);
+}
+
+GraphicBufferAllocator::~GraphicBufferAllocator() {}
+
+std::shared_ptr<GraphicBufferAllocator> GraphicBufferAllocator::CreateGraphicBufferAllocator(
+ int maxDequeueCount) {
+ return ::ndk::SharedRefBase::make<GraphicBufferAllocator>(maxDequeueCount);
+}
+
+GraphicBufferAllocator::GraphicBufferAllocator(int maxDequeueCount)
+ : mGraphicsTracker(GraphicsTracker::CreateGraphicsTracker(maxDequeueCount)) {}
+
+} // namespace aidl::android::hardware::media::c2::implementation
diff --git a/media/codec2/hal/client/include/codec2/aidl/GraphicBufferAllocator.h b/media/codec2/hal/client/include/codec2/aidl/GraphicBufferAllocator.h
new file mode 100644
index 0000000..f9c8aca
--- /dev/null
+++ b/media/codec2/hal/client/include/codec2/aidl/GraphicBufferAllocator.h
@@ -0,0 +1,154 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <aidl/android/hardware/media/c2/BnGraphicBufferAllocator.h>
+
+#include <android-base/unique_fd.h>
+#include <gui/IGraphicBufferProducer.h>
+
+#include <memory>
+
+#include <C2Buffer.h>
+
+namespace aidl::android::hardware::media::c2::implementation {
+
+// forward declarations
+class GraphicsTracker;
+
+struct GraphicBufferAllocator : public BnGraphicBufferAllocator {
+public:
+ // HAL interfaces
+ ::ndk::ScopedAStatus allocate(const IGraphicBufferAllocator::Description& in_desc,
+ IGraphicBufferAllocator::Allocation* _aidl_return) override;
+
+ ::ndk::ScopedAStatus deallocate(int64_t in_id, bool* _aidl_return) override;
+
+ ::ndk::ScopedAStatus getWaitableFds(
+ IGraphicBufferAllocator::WaitableFds* _aidl_return) override;
+
+ /**
+ * Configuring Surface/BufferQueue for the interface.
+ *
+ * Configure Surface, generation # and max dequeueBuffer() count for
+ * allocate interface.
+ *
+ * @param igbp Surface where to allocate.
+ * @param generation Generation # for allocations.
+ * @param maxDequeueBufferCount
+ * Maximum # of pending allocations.
+ */
+ bool configure(const ::android::sp<::android::IGraphicBufferProducer>& igbp,
+ uint32_t generation,
+ int maxDequeueBufferCount);
+
+ /**
+ * Update max dequeue buffer count of BufferQueue.
+ *
+ * BufferQueue does not update this value if count is smaller
+ * than the currently dequeued count.
+ * TODO: better to update the value inside this interface.
+ * for return value inspection from BQ, also for delayed updates.
+ *
+ * @param count the new value to update
+ */
+ void updateMaxDequeueBufferCount(int count);
+
+ void reset();
+
+ /**
+ * Create a listener for buffer being released.
+ *
+ * Surface will register this listener and notify whenever the consumer
+ * releases a buffer.
+ *
+ * @param generation generation # for the BufferQueue.
+ * @return IProducerListener can be used when connect# to Surface.
+ */
+ const ::android::sp<::android::IProducerListener> createReleaseListener(
+ uint32_t generation);
+
+ /**
+ * Notifies a buffer being released.
+ *
+ * @param generation generation # for the BufferQueue.
+ */
+ void onBufferReleased(uint32_t generation);
+
+ /**
+ * Allocates a buffer.
+ *
+ * @param width width of the requested buffer.
+ * @param height height of the requested buffer.
+ * @param format format of the requested buffer.
+ * @param usage usage of the requested buffer.
+ * @param buf out param for created buffer.
+ * @param fence out param for a pending fence.
+ *
+ * @return OK When an allocation was created.
+ * C2_BAD_STATE Client is not in the state for allocating
+ * C2_BLOCKING operation is blocked. Waitable fds can be
+ * used to know when it unblocks.
+ * C2_CORRUPTED Failed with a serious reason.
+ */
+ c2_status_t allocate(uint32_t width, uint32_t height,
+ ::android::PixelFormat format, uint64_t usage,
+ AHardwareBuffer **buf, ::android::sp<::android::Fence> *fence);
+
+ /**
+ * De-allocate a buffer.
+ *
+ * @param id unique id for a buffer.
+ * @param fence write fence if it's deallocated due to
+ * cancellation of displaying
+ */
+ bool deallocate(const uint64_t id, const ::android::sp<::android::Fence> &fence);
+
+ /**
+ * Display a graphic buffer to BufferQueue.
+ *
+ * @param block block to display to Surface.
+ * @param input input parameter for displaying.
+ * @param output out parameter from Surface.
+ */
+ c2_status_t displayBuffer(
+ const C2ConstGraphicBlock& block,
+ const ::android::IGraphicBufferProducer::QueueBufferInput& input,
+ ::android::IGraphicBufferProducer::QueueBufferOutput *output);
+
+ ~GraphicBufferAllocator();
+
+ /**
+ * Create the interface.
+ *
+ * The interface and codec instance's relationship is 1 to 1.
+ * The interface will be cretaed in the beginning of Codec createion. And
+ * lives until the instance destroyed.
+ *
+ * @param maxDequeueCount Initial max allocatable count
+ */
+ static std::shared_ptr<GraphicBufferAllocator> CreateGraphicBufferAllocator(
+ int maxDequeueCount);
+private:
+ GraphicBufferAllocator(int maxDequeueCount);
+
+ std::shared_ptr<GraphicsTracker> mGraphicsTracker;
+
+ friend class ::ndk::SharedRefBase;
+};
+
+} // namespace aidl::android::hardware::media::c2::implementation
diff --git a/media/codec2/hal/hidl/1.0/vts/functional/Android.bp b/media/codec2/hal/hidl/1.0/vts/functional/Android.bp
index 0ae133c..1c5c7d6 100644
--- a/media/codec2/hal/hidl/1.0/vts/functional/Android.bp
+++ b/media/codec2/hal/hidl/1.0/vts/functional/Android.bp
@@ -29,10 +29,8 @@
srcs: [
"res/bbb_aac_stereo_128kbps_48000hz.aac",
"res/bbb_aac_stereo_128kbps_48000hz.info",
- "res/bbb_aac_stereo_128kbps_48000hz_multi_frame.info",
"res/bbb_amrwb_1ch_14kbps_16000hz.amrwb",
"res/bbb_amrwb_1ch_14kbps_16000hz.info",
- "res/bbb_amrwb_1ch_14kbps_16000hz_multi_frame.info",
"res/bbb_flac_stereo_680kbps_48000hz.flac",
"res/bbb_flac_stereo_680kbps_48000hz.info",
"res/bbb_g711alaw_1ch_8khz.info",
@@ -43,7 +41,6 @@
"res/bbb_gsm_1ch_8khz_13kbps.raw",
"res/bbb_mp3_stereo_192kbps_48000hz.info",
"res/bbb_mp3_stereo_192kbps_48000hz.mp3",
- "res/bbb_mp3_stereo_192kbps_48000hz_multi_frame.info",
"res/bbb_opus_stereo_128kbps_48000hz.info",
"res/bbb_opus_stereo_128kbps_48000hz.opus",
"res/bbb_raw_1ch_8khz_s32le.info",
@@ -52,7 +49,6 @@
"res/bbb_vorbis_stereo_128kbps_48000hz.vorbis",
"res/sine_amrnb_1ch_12kbps_8000hz.amrnb",
"res/sine_amrnb_1ch_12kbps_8000hz.info",
- "res/sine_amrnb_1ch_12kbps_8000hz_multi_frame.info",
],
}
diff --git a/media/codec2/hal/hidl/1.0/vts/functional/audio/VtsHalMediaC2V1_0TargetAudioDecTest.cpp b/media/codec2/hal/hidl/1.0/vts/functional/audio/VtsHalMediaC2V1_0TargetAudioDecTest.cpp
index 8b0ea91..222c3d2 100644
--- a/media/codec2/hal/hidl/1.0/vts/functional/audio/VtsHalMediaC2V1_0TargetAudioDecTest.cpp
+++ b/media/codec2/hal/hidl/1.0/vts/functional/audio/VtsHalMediaC2V1_0TargetAudioDecTest.cpp
@@ -44,17 +44,9 @@
std::vector<CompToFiles> gCompToFiles = {
{"mp4a-latm", "bbb_aac_stereo_128kbps_48000hz.aac", "bbb_aac_stereo_128kbps_48000hz.info"},
- {"mp4a-latm", "bbb_aac_stereo_128kbps_48000hz.aac",
- "bbb_aac_stereo_128kbps_48000hz_multi_frame.info"},
{"mpeg", "bbb_mp3_stereo_192kbps_48000hz.mp3", "bbb_mp3_stereo_192kbps_48000hz.info"},
- {"mpeg", "bbb_mp3_stereo_192kbps_48000hz.mp3",
- "bbb_mp3_stereo_192kbps_48000hz_multi_frame.info"},
{"3gpp", "sine_amrnb_1ch_12kbps_8000hz.amrnb", "sine_amrnb_1ch_12kbps_8000hz.info"},
- {"3gpp", "sine_amrnb_1ch_12kbps_8000hz.amrnb",
- "sine_amrnb_1ch_12kbps_8000hz_multi_frame.info"},
{"amr-wb", "bbb_amrwb_1ch_14kbps_16000hz.amrwb", "bbb_amrwb_1ch_14kbps_16000hz.info"},
- {"amr-wb", "bbb_amrwb_1ch_14kbps_16000hz.amrwb",
- "bbb_amrwb_1ch_14kbps_16000hz_multi_frame.info"},
{"vorbis", "bbb_vorbis_stereo_128kbps_48000hz.vorbis",
"bbb_vorbis_stereo_128kbps_48000hz.info"},
{"opus", "bbb_opus_stereo_128kbps_48000hz.opus", "bbb_opus_stereo_128kbps_48000hz.info"},
diff --git a/media/codec2/hal/hidl/1.0/vts/functional/audio/VtsHalMediaC2V1_0TargetAudioDecTest.xml b/media/codec2/hal/hidl/1.0/vts/functional/audio/VtsHalMediaC2V1_0TargetAudioDecTest.xml
index a22f8cf..6c04683 100644
--- a/media/codec2/hal/hidl/1.0/vts/functional/audio/VtsHalMediaC2V1_0TargetAudioDecTest.xml
+++ b/media/codec2/hal/hidl/1.0/vts/functional/audio/VtsHalMediaC2V1_0TargetAudioDecTest.xml
@@ -23,10 +23,8 @@
<!-- Files used for audio testing -->
<option name="push-file" key="bbb_aac_stereo_128kbps_48000hz.aac" value="/data/local/tmp/media/bbb_aac_stereo_128kbps_48000hz.aac" />
<option name="push-file" key="bbb_aac_stereo_128kbps_48000hz.info" value="/data/local/tmp/media/bbb_aac_stereo_128kbps_48000hz.info" />
- <option name="push-file" key="bbb_aac_stereo_128kbps_48000hz_multi_frame.info" value="/data/local/tmp/media/bbb_aac_stereo_128kbps_48000hz_multi_frame.info" />
<option name="push-file" key="bbb_amrwb_1ch_14kbps_16000hz.amrwb" value="/data/local/tmp/media/bbb_amrwb_1ch_14kbps_16000hz.amrwb" />
<option name="push-file" key="bbb_amrwb_1ch_14kbps_16000hz.info" value="/data/local/tmp/media/bbb_amrwb_1ch_14kbps_16000hz.info" />
- <option name="push-file" key="bbb_amrwb_1ch_14kbps_16000hz_multi_frame.info" value="/data/local/tmp/media/bbb_amrwb_1ch_14kbps_16000hz_multi_frame.info" />
<option name="push-file" key="bbb_flac_stereo_680kbps_48000hz.flac" value="/data/local/tmp/media/bbb_flac_stereo_680kbps_48000hz.flac" />
<option name="push-file" key="bbb_flac_stereo_680kbps_48000hz.info" value="/data/local/tmp/media/bbb_flac_stereo_680kbps_48000hz.info" />
<option name="push-file" key="bbb_g711alaw_1ch_8khz.info" value="/data/local/tmp/media/bbb_g711alaw_1ch_8khz.info" />
@@ -37,7 +35,6 @@
<option name="push-file" key="bbb_gsm_1ch_8khz_13kbps.raw" value="/data/local/tmp/media/bbb_gsm_1ch_8khz_13kbps.raw" />
<option name="push-file" key="bbb_mp3_stereo_192kbps_48000hz.info" value="/data/local/tmp/media/bbb_mp3_stereo_192kbps_48000hz.info" />
<option name="push-file" key="bbb_mp3_stereo_192kbps_48000hz.mp3" value="/data/local/tmp/media/bbb_mp3_stereo_192kbps_48000hz.mp3" />
- <option name="push-file" key="bbb_mp3_stereo_192kbps_48000hz_multi_frame.info" value="/data/local/tmp/media/bbb_mp3_stereo_192kbps_48000hz_multi_frame.info" />
<option name="push-file" key="bbb_opus_stereo_128kbps_48000hz.info" value="/data/local/tmp/media/bbb_opus_stereo_128kbps_48000hz.info" />
<option name="push-file" key="bbb_opus_stereo_128kbps_48000hz.opus" value="/data/local/tmp/media/bbb_opus_stereo_128kbps_48000hz.opus" />
<option name="push-file" key="bbb_raw_1ch_8khz_s32le.info" value="/data/local/tmp/media/bbb_raw_1ch_8khz_s32le.info" />
@@ -46,7 +43,6 @@
<option name="push-file" key="bbb_vorbis_stereo_128kbps_48000hz.vorbis" value="/data/local/tmp/media/bbb_vorbis_stereo_128kbps_48000hz.vorbis" />
<option name="push-file" key="sine_amrnb_1ch_12kbps_8000hz.amrnb" value="/data/local/tmp/media/sine_amrnb_1ch_12kbps_8000hz.amrnb" />
<option name="push-file" key="sine_amrnb_1ch_12kbps_8000hz.info" value="/data/local/tmp/media/sine_amrnb_1ch_12kbps_8000hz.info" />
- <option name="push-file" key="sine_amrnb_1ch_12kbps_8000hz_multi_frame.info" value="/data/local/tmp/media/sine_amrnb_1ch_12kbps_8000hz_multi_frame.info" />
</target_preparer>
@@ -55,4 +51,4 @@
<option name="module-name" value="vts_media_c2_v1_0_audio_dec_test" />
<option name="native-test-flag" value="-P /data/local/tmp/media/" />
</test>
-</configuration>
\ No newline at end of file
+</configuration>
diff --git a/media/codec2/hal/hidl/1.0/vts/functional/res/bbb_aac_stereo_128kbps_48000hz_multi_frame.info b/media/codec2/hal/hidl/1.0/vts/functional/res/bbb_aac_stereo_128kbps_48000hz_multi_frame.info
deleted file mode 100644
index 182af20..0000000
--- a/media/codec2/hal/hidl/1.0/vts/functional/res/bbb_aac_stereo_128kbps_48000hz_multi_frame.info
+++ /dev/null
@@ -1,443 +0,0 @@
-5 32 0
-5 32 0
-337 1 0
-322 1 21333
-279 1 42666
-563 1 64000
-635 1 106666
-634 1 149333
-629 1 192000
-680 1 234666
-688 1 277333
-1036 1 320000
-1040 1 384000
-1009 1 448000
-1020 1 512000
-1357 1 576000
-1353 1 661333
-1351 1 746666
-1351 1 832000
-343 1 917333
-335 1 938666
-339 1 960000
-342 1 981333
-348 1 1002666
-350 1 1024000
-351 1 1045333
-342 1 1066666
-366 1 1088000
-340 1 1109333
-354 1 1130666
-340 1 1152000
-334 1 1173333
-338 1 1194666
-340 1 1216000
-351 1 1237333
-346 1 1258666
-331 1 1280000
-321 1 1301333
-343 1 1322666
-342 1 1344000
-345 1 1365333
-326 1 1386666
-342 1 1408000
-356 1 1429333
-351 1 1450666
-343 1 1472000
-347 1 1493333
-349 1 1514666
-350 1 1536000
-330 1 1557333
-341 1 1578666
-340 1 1600000
-330 1 1621333
-340 1 1642666
-335 1 1664000
-344 1 1685333
-359 1 1706666
-337 1 1728000
-346 1 1749333
-330 1 1770666
-351 1 1792000
-355 1 1813333
-352 1 1834666
-325 1 1856000
-342 1 1877333
-327 1 1898666
-349 1 1920000
-326 1 1941333
-337 1 1962666
-378 1 1984000
-321 1 2005333
-319 1 2026666
-346 1 2048000
-352 1 2069333
-349 1 2090666
-331 1 2112000
-330 1 2133333
-329 1 2154666
-333 1 2176000
-367 1 2197333
-362 1 2218666
-337 1 2240000
-337 1 2261333
-360 1 2282666
-333 1 2304000
-317 1 2325333
-344 1 2346666
-335 1 2368000
-337 1 2389333
-349 1 2410666
-336 1 2432000
-348 1 2453333
-349 1 2474666
-342 1 2496000
-359 1 2517333
-340 1 2538666
-340 1 2560000
-348 1 2581333
-334 1 2602666
-328 1 2624000
-341 1 2645333
-339 1 2666666
-337 1 2688000
-350 1 2709333
-326 1 2730666
-360 1 2752000
-344 1 2773333
-340 1 2794666
-343 1 2816000
-361 1 2837333
-329 1 2858666
-345 1 2880000
-345 1 2901333
-330 1 2922666
-342 1 2944000
-344 1 2965333
-330 1 2986666
-329 1 3008000
-335 1 3029333
-366 1 3050666
-328 1 3072000
-349 1 3093333
-339 1 3114666
-340 1 3136000
-335 1 3157333
-327 1 3178666
-348 1 3200000
-339 1 3221333
-334 1 3242666
-350 1 3264000
-325 1 3285333
-361 1 3306666
-338 1 3328000
-350 1 3349333
-353 1 3370666
-327 1 3392000
-346 1 3413333
-348 1 3434666
-339 1 3456000
-342 1 3477333
-334 1 3498666
-350 1 3520000
-354 1 3541333
-363 1 3562666
-322 1 3584000
-337 1 3605333
-355 1 3626666
-329 1 3648000
-324 1 3669333
-338 1 3690666
-356 1 3712000
-330 1 3733333
-321 1 3754666
-337 1 3776000
-345 1 3797333
-335 1 3818666
-348 1 3840000
-342 1 3861333
-348 1 3882666
-335 1 3904000
-344 1 3925333
-357 1 3946666
-368 1 3968000
-324 1 3989333
-343 1 4010666
-341 1 4032000
-329 1 4053333
-356 1 4074666
-317 1 4096000
-351 1 4117333
-340 1 4138666
-340 1 4160000
-332 1 4181333
-355 1 4202666
-357 1 4224000
-327 1 4245333
-338 1 4266666
-323 1 4288000
-346 1 4309333
-352 1 4330666
-347 1 4352000
-343 1 4373333
-311 1 4394666
-338 1 4416000
-365 1 4437333
-349 1 4458666
-327 1 4480000
-355 1 4501333
-319 1 4522666
-349 1 4544000
-351 1 4565333
-337 1 4586666
-340 1 4608000
-349 1 4629333
-316 1 4650666
-344 1 4672000
-334 1 4693333
-344 1 4714666
-347 1 4736000
-348 1 4757333
-334 1 4778666
-338 1 4800000
-331 1 4821333
-344 1 4842666
-342 1 4864000
-336 1 4885333
-326 1 4906666
-364 1 4928000
-350 1 4949333
-350 1 4970666
-363 1 4992000
-358 1 5013333
-305 1 5034666
-344 1 5056000
-346 1 5077333
-342 1 5098666
-330 1 5120000
-318 1 5141333
-361 1 5162666
-354 1 5184000
-313 1 5205333
-330 1 5226666
-350 1 5248000
-347 1 5269333
-346 1 5290666
-357 1 5312000
-325 1 5333333
-335 1 5354666
-331 1 5376000
-366 1 5397333
-329 1 5418666
-349 1 5440000
-371 1 5461333
-326 1 5482666
-333 1 5504000
-319 1 5525333
-327 1 5546666
-353 1 5568000
-356 1 5589333
-348 1 5610666
-338 1 5632000
-331 1 5653333
-341 1 5674666
-362 1 5696000
-326 1 5717333
-359 1 5738666
-315 1 5760000
-376 1 5781333
-343 1 5802666
-354 1 5824000
-353 1 5845333
-344 1 5866666
-334 1 5888000
-345 1 5909333
-355 1 5930666
-322 1 5952000
-334 1 5973333
-353 1 5994666
-338 1 6016000
-351 1 6037333
-334 1 6058666
-339 1 6080000
-345 1 6101333
-347 1 6122666
-355 1 6144000
-312 1 6165333
-352 1 6186666
-354 1 6208000
-318 1 6229333
-344 1 6250666
-363 1 6272000
-321 1 6293333
-339 1 6314666
-356 1 6336000
-334 1 6357333
-354 1 6378666
-325 1 6400000
-321 1 6421333
-341 1 6442666
-337 1 6464000
-351 1 6485333
-343 1 6506666
-341 1 6528000
-344 1 6549333
-341 1 6570666
-364 1 6592000
-319 1 6613333
-348 1 6634666
-332 1 6656000
-333 1 6677333
-343 1 6698666
-348 1 6720000
-347 1 6741333
-350 1 6762666
-342 1 6784000
-341 1 6805333
-326 1 6826666
-351 1 6848000
-329 1 6869333
-323 1 6890666
-350 1 6912000
-361 1 6933333
-326 1 6954666
-345 1 6976000
-345 1 6997333
-311 1 7018666
-349 1 7040000
-358 1 7061333
-352 1 7082666
-347 1 7104000
-364 1 7125333
-328 1 7146666
-318 1 7168000
-351 1 7189333
-340 1 7210666
-341 1 7232000
-355 1 7253333
-336 1 7274666
-352 1 7296000
-341 1 7317333
-334 1 7338666
-348 1 7360000
-342 1 7381333
-335 1 7402666
-342 1 7424000
-359 1 7445333
-349 1 7466666
-329 1 7488000
-356 1 7509333
-292 1 7530666
-316 1 7552000
-318 1 7573333
-320 1 7594666
-342 1 7616000
-285 1 7637333
-326 1 7658666
-352 1 7680000
-392 1 7701333
-364 1 7722666
-384 1 7744000
-334 1 7765333
-317 1 7786666
-326 1 7808000
-373 1 7829333
-354 1 7850666
-329 1 7872000
-347 1 7893333
-353 1 7914666
-338 1 7936000
-317 1 7957333
-354 1 7978666
-345 1 8000000
-350 1 8021333
-351 1 8042666
-332 1 8064000
-358 1 8085333
-315 1 8106666
-336 1 8128000
-358 1 8149333
-343 1 8170666
-319 1 8192000
-370 1 8213333
-344 1 8234666
-361 1 8256000
-343 1 8277333
-337 1 8298666
-354 1 8320000
-332 1 8341333
-348 1 8362666
-328 1 8384000
-345 1 8405333
-340 1 8426666
-346 1 8448000
-341 1 8469333
-344 1 8490666
-342 1 8512000
-341 1 8533333
-345 1 8554666
-337 1 8576000
-335 1 8597333
-335 1 8618666
-340 1 8640000
-345 1 8661333
-341 1 8682666
-342 1 8704000
-338 1 8725333
-343 1 8746666
-336 1 8768000
-338 1 8789333
-353 1 8810666
-339 1 8832000
-329 1 8853333
-349 1 8874666
-323 1 8896000
-351 1 8917333
-359 1 8938666
-357 1 8960000
-341 1 8981333
-333 1 9002666
-335 1 9024000
-328 1 9045333
-347 1 9066666
-343 1 9088000
-369 1 9109333
-331 1 9130666
-344 1 9152000
-330 1 9173333
-346 1 9194666
-337 1 9216000
-341 1 9237333
-338 1 9258666
-329 1 9280000
-360 1 9301333
-336 1 9322666
-341 1 9344000
-341 1 9365333
-345 1 9386666
-351 1 9408000
-349 1 9429333
-336 1 9450666
-326 1 9472000
-349 1 9493333
-343 1 9514666
-357 1 9536000
-342 1 9557333
-325 1 9578666
-346 1 9600000
-326 1 9621333
-402 1 9642666
-331 1 9664000
-339 1 9685333
-371 1 9706666
-314 1 9728000
-310 1 9749333
-364 1 9770666
-338 1 9792000
-339 1 9813333
-337 1 9834666
-355 1 9856000
-351 1 9877333
-332 1 9898666
-316 1 9920000
-474 1 9941333
diff --git a/media/codec2/hal/hidl/1.0/vts/functional/res/bbb_amrwb_1ch_14kbps_16000hz_multi_frame.info b/media/codec2/hal/hidl/1.0/vts/functional/res/bbb_amrwb_1ch_14kbps_16000hz_multi_frame.info
deleted file mode 100644
index c420009..0000000
--- a/media/codec2/hal/hidl/1.0/vts/functional/res/bbb_amrwb_1ch_14kbps_16000hz_multi_frame.info
+++ /dev/null
@@ -1,460 +0,0 @@
-41 1 0
-41 1 20000
-82 1 40000
-82 1 80000
-82 1 120000
-82 1 160000
-82 1 200000
-82 1 240000
-82 1 280000
-82 1 320000
-82 1 360000
-123 1 400000
-123 1 460000
-123 1 520000
-123 1 580000
-123 1 640000
-164 1 700000
-164 1 780000
-164 1 860000
-164 1 940000
-164 1 1020000
-41 1 1100000
-41 1 1120000
-41 1 1140000
-41 1 1160000
-41 1 1180000
-41 1 1200000
-41 1 1220000
-41 1 1240000
-41 1 1260000
-41 1 1280000
-41 1 1300000
-41 1 1320000
-41 1 1340000
-41 1 1360000
-41 1 1380000
-41 1 1400000
-41 1 1420000
-41 1 1440000
-41 1 1460000
-41 1 1480000
-41 1 1500000
-41 1 1520000
-41 1 1540000
-41 1 1560000
-41 1 1580000
-41 1 1600000
-41 1 1620000
-41 1 1640000
-41 1 1660000
-41 1 1680000
-41 1 1700000
-41 1 1720000
-41 1 1740000
-41 1 1760000
-41 1 1780000
-41 1 1800000
-41 1 1820000
-41 1 1840000
-41 1 1860000
-41 1 1880000
-41 1 1900000
-41 1 1920000
-41 1 1940000
-41 1 1960000
-41 1 1980000
-41 1 2000000
-41 1 2020000
-41 1 2040000
-41 1 2060000
-41 1 2080000
-41 1 2100000
-41 1 2120000
-41 1 2140000
-41 1 2160000
-41 1 2180000
-41 1 2200000
-41 1 2220000
-41 1 2240000
-41 1 2260000
-41 1 2280000
-41 1 2300000
-41 1 2320000
-41 1 2340000
-41 1 2360000
-41 1 2380000
-41 1 2400000
-41 1 2420000
-41 1 2440000
-41 1 2460000
-41 1 2480000
-41 1 2500000
-41 1 2520000
-41 1 2540000
-41 1 2560000
-41 1 2580000
-41 1 2600000
-41 1 2620000
-41 1 2640000
-41 1 2660000
-41 1 2680000
-41 1 2700000
-41 1 2720000
-41 1 2740000
-41 1 2760000
-41 1 2780000
-41 1 2800000
-41 1 2820000
-41 1 2840000
-41 1 2860000
-41 1 2880000
-41 1 2900000
-41 1 2920000
-41 1 2940000
-41 1 2960000
-41 1 2980000
-41 1 3000000
-41 1 3020000
-41 1 3040000
-41 1 3060000
-41 1 3080000
-41 1 3100000
-41 1 3120000
-41 1 3140000
-41 1 3160000
-41 1 3180000
-41 1 3200000
-41 1 3220000
-41 1 3240000
-41 1 3260000
-41 1 3280000
-41 1 3300000
-41 1 3320000
-41 1 3340000
-41 1 3360000
-41 1 3380000
-41 1 3400000
-41 1 3420000
-41 1 3440000
-41 1 3460000
-41 1 3480000
-41 1 3500000
-41 1 3520000
-41 1 3540000
-41 1 3560000
-41 1 3580000
-41 1 3600000
-41 1 3620000
-41 1 3640000
-41 1 3660000
-41 1 3680000
-41 1 3700000
-41 1 3720000
-41 1 3740000
-41 1 3760000
-41 1 3780000
-41 1 3800000
-41 1 3820000
-41 1 3840000
-41 1 3860000
-41 1 3880000
-41 1 3900000
-41 1 3920000
-41 1 3940000
-41 1 3960000
-41 1 3980000
-41 1 4000000
-41 1 4020000
-41 1 4040000
-41 1 4060000
-41 1 4080000
-41 1 4100000
-41 1 4120000
-41 1 4140000
-41 1 4160000
-41 1 4180000
-41 1 4200000
-41 1 4220000
-41 1 4240000
-41 1 4260000
-41 1 4280000
-41 1 4300000
-41 1 4320000
-41 1 4340000
-41 1 4360000
-41 1 4380000
-41 1 4400000
-41 1 4420000
-41 1 4440000
-41 1 4460000
-41 1 4480000
-41 1 4500000
-41 1 4520000
-41 1 4540000
-41 1 4560000
-41 1 4580000
-41 1 4600000
-41 1 4620000
-41 1 4640000
-41 1 4660000
-41 1 4680000
-41 1 4700000
-41 1 4720000
-41 1 4740000
-41 1 4760000
-41 1 4780000
-41 1 4800000
-41 1 4820000
-41 1 4840000
-41 1 4860000
-41 1 4880000
-41 1 4900000
-41 1 4920000
-41 1 4940000
-41 1 4960000
-41 1 4980000
-41 1 5000000
-41 1 5020000
-41 1 5040000
-41 1 5060000
-41 1 5080000
-41 1 5100000
-41 1 5120000
-41 1 5140000
-41 1 5160000
-41 1 5180000
-41 1 5200000
-41 1 5220000
-41 1 5240000
-41 1 5260000
-41 1 5280000
-41 1 5300000
-41 1 5320000
-41 1 5340000
-41 1 5360000
-41 1 5380000
-41 1 5400000
-41 1 5420000
-41 1 5440000
-41 1 5460000
-41 1 5480000
-41 1 5500000
-41 1 5520000
-41 1 5540000
-41 1 5560000
-41 1 5580000
-41 1 5600000
-41 1 5620000
-41 1 5640000
-41 1 5660000
-41 1 5680000
-41 1 5700000
-41 1 5720000
-41 1 5740000
-41 1 5760000
-41 1 5780000
-41 1 5800000
-41 1 5820000
-41 1 5840000
-41 1 5860000
-41 1 5880000
-41 1 5900000
-41 1 5920000
-41 1 5940000
-41 1 5960000
-41 1 5980000
-41 1 6000000
-41 1 6020000
-41 1 6040000
-41 1 6060000
-41 1 6080000
-41 1 6100000
-41 1 6120000
-41 1 6140000
-41 1 6160000
-41 1 6180000
-41 1 6200000
-41 1 6220000
-41 1 6240000
-41 1 6260000
-41 1 6280000
-41 1 6300000
-41 1 6320000
-41 1 6340000
-41 1 6360000
-41 1 6380000
-41 1 6400000
-41 1 6420000
-41 1 6440000
-41 1 6460000
-41 1 6480000
-41 1 6500000
-41 1 6520000
-41 1 6540000
-41 1 6560000
-41 1 6580000
-41 1 6600000
-41 1 6620000
-41 1 6640000
-41 1 6660000
-41 1 6680000
-41 1 6700000
-41 1 6720000
-41 1 6740000
-41 1 6760000
-41 1 6780000
-41 1 6800000
-41 1 6820000
-41 1 6840000
-41 1 6860000
-41 1 6880000
-41 1 6900000
-41 1 6920000
-41 1 6940000
-41 1 6960000
-41 1 6980000
-41 1 7000000
-41 1 7020000
-41 1 7040000
-41 1 7060000
-41 1 7080000
-41 1 7100000
-41 1 7120000
-41 1 7140000
-41 1 7160000
-41 1 7180000
-41 1 7200000
-41 1 7220000
-41 1 7240000
-41 1 7260000
-41 1 7280000
-41 1 7300000
-41 1 7320000
-41 1 7340000
-41 1 7360000
-41 1 7380000
-41 1 7400000
-41 1 7420000
-41 1 7440000
-41 1 7460000
-41 1 7480000
-41 1 7500000
-41 1 7520000
-41 1 7540000
-41 1 7560000
-41 1 7580000
-41 1 7600000
-41 1 7620000
-41 1 7640000
-41 1 7660000
-41 1 7680000
-41 1 7700000
-41 1 7720000
-41 1 7740000
-41 1 7760000
-41 1 7780000
-41 1 7800000
-41 1 7820000
-41 1 7840000
-41 1 7860000
-41 1 7880000
-41 1 7900000
-41 1 7920000
-41 1 7940000
-41 1 7960000
-41 1 7980000
-41 1 8000000
-41 1 8020000
-41 1 8040000
-41 1 8060000
-41 1 8080000
-41 1 8100000
-41 1 8120000
-41 1 8140000
-41 1 8160000
-41 1 8180000
-41 1 8200000
-41 1 8220000
-41 1 8240000
-41 1 8260000
-41 1 8280000
-41 1 8300000
-41 1 8320000
-41 1 8340000
-41 1 8360000
-41 1 8380000
-41 1 8400000
-41 1 8420000
-41 1 8440000
-41 1 8460000
-41 1 8480000
-41 1 8500000
-41 1 8520000
-41 1 8540000
-41 1 8560000
-41 1 8580000
-41 1 8600000
-41 1 8620000
-41 1 8640000
-41 1 8660000
-41 1 8680000
-41 1 8700000
-41 1 8720000
-41 1 8740000
-41 1 8760000
-41 1 8780000
-41 1 8800000
-41 1 8820000
-41 1 8840000
-41 1 8860000
-41 1 8880000
-41 1 8900000
-41 1 8920000
-41 1 8940000
-41 1 8960000
-41 1 8980000
-41 1 9000000
-41 1 9020000
-41 1 9040000
-41 1 9060000
-41 1 9080000
-41 1 9100000
-41 1 9120000
-41 1 9140000
-41 1 9160000
-41 1 9180000
-41 1 9200000
-41 1 9220000
-41 1 9240000
-41 1 9260000
-41 1 9280000
-41 1 9300000
-41 1 9320000
-41 1 9340000
-41 1 9360000
-41 1 9380000
-41 1 9400000
-41 1 9420000
-41 1 9440000
-41 1 9460000
-41 1 9480000
-41 1 9500000
-41 1 9520000
-41 1 9540000
-41 1 9560000
-41 1 9580000
-41 1 9600000
-41 1 9620000
-41 1 9640000
-41 1 9660000
-41 1 9680000
-41 1 9700000
-41 1 9720000
-41 1 9740000
-41 1 9760000
-41 1 9780000
-41 1 9800000
-41 1 9820000
-41 1 9840000
-41 1 9860000
diff --git a/media/codec2/hal/hidl/1.0/vts/functional/res/bbb_mp3_stereo_192kbps_48000hz_multi_frame.info b/media/codec2/hal/hidl/1.0/vts/functional/res/bbb_mp3_stereo_192kbps_48000hz_multi_frame.info
deleted file mode 100644
index 575c75f..0000000
--- a/media/codec2/hal/hidl/1.0/vts/functional/res/bbb_mp3_stereo_192kbps_48000hz_multi_frame.info
+++ /dev/null
@@ -1,385 +0,0 @@
-576 1 0
-576 1 24000
-1152 1 48000
-1152 1 96000
-1152 1 144000
-1152 1 192000
-1728 1 240000
-1728 1 312000
-1728 1 384000
-1728 1 456000
-1728 1 528000
-2304 1 600000
-2304 1 696000
-2304 1 792000
-2304 1 888000
-2304 1 984000
-576 1 1080000
-576 1 1104000
-576 1 1128000
-576 1 1152000
-576 1 1176000
-576 1 1200000
-576 1 1224000
-576 1 1248000
-576 1 1272000
-576 1 1296000
-576 1 1320000
-576 1 1344000
-576 1 1368000
-576 1 1392000
-576 1 1416000
-576 1 1440000
-576 1 1464000
-576 1 1488000
-576 1 1512000
-576 1 1536000
-576 1 1560000
-576 1 1584000
-576 1 1608000
-576 1 1632000
-576 1 1656000
-576 1 1680000
-576 1 1704000
-576 1 1728000
-576 1 1752000
-576 1 1776000
-576 1 1800000
-576 1 1824000
-576 1 1848000
-576 1 1872000
-576 1 1896000
-576 1 1920000
-576 1 1944000
-576 1 1968000
-576 1 1992000
-576 1 2016000
-576 1 2040000
-576 1 2064000
-576 1 2088000
-576 1 2112000
-576 1 2136000
-576 1 2160000
-576 1 2184000
-576 1 2208000
-576 1 2232000
-576 1 2256000
-576 1 2280000
-576 1 2304000
-576 1 2328000
-576 1 2352000
-576 1 2376000
-576 1 2400000
-576 1 2424000
-576 1 2448000
-576 1 2472000
-576 1 2496000
-576 1 2520000
-576 1 2544000
-576 1 2568000
-576 1 2592000
-576 1 2616000
-576 1 2640000
-576 1 2664000
-576 1 2688000
-576 1 2712000
-576 1 2736000
-576 1 2760000
-576 1 2784000
-576 1 2808000
-576 1 2832000
-576 1 2856000
-576 1 2880000
-576 1 2904000
-576 1 2928000
-576 1 2952000
-576 1 2976000
-576 1 3000000
-576 1 3024000
-576 1 3048000
-576 1 3072000
-576 1 3096000
-576 1 3120000
-576 1 3144000
-576 1 3168000
-576 1 3192000
-576 1 3216000
-576 1 3240000
-576 1 3264000
-576 1 3288000
-576 1 3312000
-576 1 3336000
-576 1 3360000
-576 1 3384000
-576 1 3408000
-576 1 3432000
-576 1 3456000
-576 1 3480000
-576 1 3504000
-576 1 3528000
-576 1 3552000
-576 1 3576000
-576 1 3600000
-576 1 3624000
-576 1 3648000
-576 1 3672000
-576 1 3696000
-576 1 3720000
-576 1 3744000
-576 1 3768000
-576 1 3792000
-576 1 3816000
-576 1 3840000
-576 1 3864000
-576 1 3888000
-576 1 3912000
-576 1 3936000
-576 1 3960000
-576 1 3984000
-576 1 4008000
-576 1 4032000
-576 1 4056000
-576 1 4080000
-576 1 4104000
-576 1 4128000
-576 1 4152000
-576 1 4176000
-576 1 4200000
-576 1 4224000
-576 1 4248000
-576 1 4272000
-576 1 4296000
-576 1 4320000
-576 1 4344000
-576 1 4368000
-576 1 4392000
-576 1 4416000
-576 1 4440000
-576 1 4464000
-576 1 4488000
-576 1 4512000
-576 1 4536000
-576 1 4560000
-576 1 4584000
-576 1 4608000
-576 1 4632000
-576 1 4656000
-576 1 4680000
-576 1 4704000
-576 1 4728000
-576 1 4752000
-576 1 4776000
-576 1 4800000
-576 1 4824000
-576 1 4848000
-576 1 4872000
-576 1 4896000
-576 1 4920000
-576 1 4944000
-576 1 4968000
-576 1 4992000
-576 1 5016000
-576 1 5040000
-576 1 5064000
-576 1 5088000
-576 1 5112000
-576 1 5136000
-576 1 5160000
-576 1 5184000
-576 1 5208000
-576 1 5232000
-576 1 5256000
-576 1 5280000
-576 1 5304000
-576 1 5328000
-576 1 5352000
-576 1 5376000
-576 1 5400000
-576 1 5424000
-576 1 5448000
-576 1 5472000
-576 1 5496000
-576 1 5520000
-576 1 5544000
-576 1 5568000
-576 1 5592000
-576 1 5616000
-576 1 5640000
-576 1 5664000
-576 1 5688000
-576 1 5712000
-576 1 5736000
-576 1 5760000
-576 1 5784000
-576 1 5808000
-576 1 5832000
-576 1 5856000
-576 1 5880000
-576 1 5904000
-576 1 5928000
-576 1 5952000
-576 1 5976000
-576 1 6000000
-576 1 6024000
-576 1 6048000
-576 1 6072000
-576 1 6096000
-576 1 6120000
-576 1 6144000
-576 1 6168000
-576 1 6192000
-576 1 6216000
-576 1 6240000
-576 1 6264000
-576 1 6288000
-576 1 6312000
-576 1 6336000
-576 1 6360000
-576 1 6384000
-576 1 6408000
-576 1 6432000
-576 1 6456000
-576 1 6480000
-576 1 6504000
-576 1 6528000
-576 1 6552000
-576 1 6576000
-576 1 6600000
-576 1 6624000
-576 1 6648000
-576 1 6672000
-576 1 6696000
-576 1 6720000
-576 1 6744000
-576 1 6768000
-576 1 6792000
-576 1 6816000
-576 1 6840000
-576 1 6864000
-576 1 6888000
-576 1 6912000
-576 1 6936000
-576 1 6960000
-576 1 6984000
-576 1 7008000
-576 1 7032000
-576 1 7056000
-576 1 7080000
-576 1 7104000
-576 1 7128000
-576 1 7152000
-576 1 7176000
-576 1 7200000
-576 1 7224000
-576 1 7248000
-576 1 7272000
-576 1 7296000
-576 1 7320000
-576 1 7344000
-576 1 7368000
-576 1 7392000
-576 1 7416000
-576 1 7440000
-576 1 7464000
-576 1 7488000
-576 1 7512000
-576 1 7536000
-576 1 7560000
-576 1 7584000
-576 1 7608000
-576 1 7632000
-576 1 7656000
-576 1 7680000
-576 1 7704000
-576 1 7728000
-576 1 7752000
-576 1 7776000
-576 1 7800000
-576 1 7824000
-576 1 7848000
-576 1 7872000
-576 1 7896000
-576 1 7920000
-576 1 7944000
-576 1 7968000
-576 1 7992000
-576 1 8016000
-576 1 8040000
-576 1 8064000
-576 1 8088000
-576 1 8112000
-576 1 8136000
-576 1 8160000
-576 1 8184000
-576 1 8208000
-576 1 8232000
-576 1 8256000
-576 1 8280000
-576 1 8304000
-576 1 8328000
-576 1 8352000
-576 1 8376000
-576 1 8400000
-576 1 8424000
-576 1 8448000
-576 1 8472000
-576 1 8496000
-576 1 8520000
-576 1 8544000
-576 1 8568000
-576 1 8592000
-576 1 8616000
-576 1 8640000
-576 1 8664000
-576 1 8688000
-576 1 8712000
-576 1 8736000
-576 1 8760000
-576 1 8784000
-576 1 8808000
-576 1 8832000
-576 1 8856000
-576 1 8880000
-576 1 8904000
-576 1 8928000
-576 1 8952000
-576 1 8976000
-576 1 9000000
-576 1 9024000
-576 1 9048000
-576 1 9072000
-576 1 9096000
-576 1 9120000
-576 1 9144000
-576 1 9168000
-576 1 9192000
-576 1 9216000
-576 1 9240000
-576 1 9264000
-576 1 9288000
-576 1 9312000
-576 1 9336000
-576 1 9360000
-576 1 9384000
-576 1 9408000
-576 1 9432000
-576 1 9456000
-576 1 9480000
-576 1 9504000
-576 1 9528000
-576 1 9552000
-576 1 9576000
-576 1 9600000
-576 1 9624000
-576 1 9648000
-576 1 9672000
-576 1 9696000
-576 1 9720000
-576 1 9744000
-576 1 9768000
-576 1 9792000
-576 1 9816000
-576 1 9840000
-576 1 9864000
-576 1 9888000
-576 1 9912000
diff --git a/media/codec2/hal/hidl/1.0/vts/functional/res/sine_amrnb_1ch_12kbps_8000hz_multi_frame.info b/media/codec2/hal/hidl/1.0/vts/functional/res/sine_amrnb_1ch_12kbps_8000hz_multi_frame.info
deleted file mode 100644
index 0176eaf4..0000000
--- a/media/codec2/hal/hidl/1.0/vts/functional/res/sine_amrnb_1ch_12kbps_8000hz_multi_frame.info
+++ /dev/null
@@ -1,807 +0,0 @@
-32 1 0
-32 1 20000
-64 1 40000
-64 1 80000
-64 1 120000
-96 1 160000
-96 1 220000
-96 1 280000
-96 1 340000
-128 1 400000
-128 1 480000
-128 1 560000
-128 1 640000
-128 1 720000
-32 1 800000
-32 1 820000
-32 1 840000
-32 1 860000
-32 1 880000
-32 1 900000
-32 1 920000
-32 1 940000
-32 1 960000
-32 1 980000
-32 1 1000000
-32 1 1020000
-32 1 1040000
-32 1 1060000
-32 1 1080000
-32 1 1100000
-32 1 1120000
-32 1 1140000
-32 1 1160000
-32 1 1180000
-32 1 1200000
-32 1 1220000
-32 1 1240000
-32 1 1260000
-32 1 1280000
-32 1 1300000
-32 1 1320000
-32 1 1340000
-32 1 1360000
-32 1 1380000
-32 1 1400000
-32 1 1420000
-32 1 1440000
-32 1 1460000
-32 1 1480000
-32 1 1500000
-32 1 1520000
-32 1 1540000
-32 1 1560000
-32 1 1580000
-32 1 1600000
-32 1 1620000
-32 1 1640000
-32 1 1660000
-32 1 1680000
-32 1 1700000
-32 1 1720000
-32 1 1740000
-32 1 1760000
-32 1 1780000
-32 1 1800000
-32 1 1820000
-32 1 1840000
-32 1 1860000
-32 1 1880000
-32 1 1900000
-32 1 1920000
-32 1 1940000
-32 1 1960000
-32 1 1980000
-32 1 2000000
-32 1 2020000
-32 1 2040000
-32 1 2060000
-32 1 2080000
-32 1 2100000
-32 1 2120000
-32 1 2140000
-32 1 2160000
-32 1 2180000
-32 1 2200000
-32 1 2220000
-32 1 2240000
-32 1 2260000
-32 1 2280000
-32 1 2300000
-32 1 2320000
-32 1 2340000
-32 1 2360000
-32 1 2380000
-32 1 2400000
-32 1 2420000
-32 1 2440000
-32 1 2460000
-32 1 2480000
-32 1 2500000
-32 1 2520000
-32 1 2540000
-32 1 2560000
-32 1 2580000
-32 1 2600000
-32 1 2620000
-32 1 2640000
-32 1 2660000
-32 1 2680000
-32 1 2700000
-32 1 2720000
-32 1 2740000
-32 1 2760000
-32 1 2780000
-32 1 2800000
-32 1 2820000
-32 1 2840000
-32 1 2860000
-32 1 2880000
-32 1 2900000
-32 1 2920000
-32 1 2940000
-32 1 2960000
-32 1 2980000
-32 1 3000000
-32 1 3020000
-32 1 3040000
-32 1 3060000
-32 1 3080000
-32 1 3100000
-32 1 3120000
-32 1 3140000
-32 1 3160000
-32 1 3180000
-32 1 3200000
-32 1 3220000
-32 1 3240000
-32 1 3260000
-32 1 3280000
-32 1 3300000
-32 1 3320000
-32 1 3340000
-32 1 3360000
-32 1 3380000
-32 1 3400000
-32 1 3420000
-32 1 3440000
-32 1 3460000
-32 1 3480000
-32 1 3500000
-32 1 3520000
-32 1 3540000
-32 1 3560000
-32 1 3580000
-32 1 3600000
-32 1 3620000
-32 1 3640000
-32 1 3660000
-32 1 3680000
-32 1 3700000
-32 1 3720000
-32 1 3740000
-32 1 3760000
-32 1 3780000
-32 1 3800000
-32 1 3820000
-32 1 3840000
-32 1 3860000
-32 1 3880000
-32 1 3900000
-32 1 3920000
-32 1 3940000
-32 1 3960000
-32 1 3980000
-32 1 4000000
-32 1 4020000
-32 1 4040000
-32 1 4060000
-32 1 4080000
-32 1 4100000
-32 1 4120000
-32 1 4140000
-32 1 4160000
-32 1 4180000
-32 1 4200000
-32 1 4220000
-32 1 4240000
-32 1 4260000
-32 1 4280000
-32 1 4300000
-32 1 4320000
-32 1 4340000
-32 1 4360000
-32 1 4380000
-32 1 4400000
-32 1 4420000
-32 1 4440000
-32 1 4460000
-32 1 4480000
-32 1 4500000
-32 1 4520000
-32 1 4540000
-32 1 4560000
-32 1 4580000
-32 1 4600000
-32 1 4620000
-32 1 4640000
-32 1 4660000
-32 1 4680000
-32 1 4700000
-32 1 4720000
-32 1 4740000
-32 1 4760000
-32 1 4780000
-32 1 4800000
-32 1 4820000
-32 1 4840000
-32 1 4860000
-32 1 4880000
-32 1 4900000
-32 1 4920000
-32 1 4940000
-32 1 4960000
-32 1 4980000
-32 1 5000000
-32 1 5020000
-32 1 5040000
-32 1 5060000
-32 1 5080000
-32 1 5100000
-32 1 5120000
-32 1 5140000
-32 1 5160000
-32 1 5180000
-32 1 5200000
-32 1 5220000
-32 1 5240000
-32 1 5260000
-32 1 5280000
-32 1 5300000
-32 1 5320000
-32 1 5340000
-32 1 5360000
-32 1 5380000
-32 1 5400000
-32 1 5420000
-32 1 5440000
-32 1 5460000
-32 1 5480000
-32 1 5500000
-32 1 5520000
-32 1 5540000
-32 1 5560000
-32 1 5580000
-32 1 5600000
-32 1 5620000
-32 1 5640000
-32 1 5660000
-32 1 5680000
-32 1 5700000
-32 1 5720000
-32 1 5740000
-32 1 5760000
-32 1 5780000
-32 1 5800000
-32 1 5820000
-32 1 5840000
-32 1 5860000
-32 1 5880000
-32 1 5900000
-32 1 5920000
-32 1 5940000
-32 1 5960000
-32 1 5980000
-32 1 6000000
-32 1 6020000
-32 1 6040000
-32 1 6060000
-32 1 6080000
-32 1 6100000
-32 1 6120000
-32 1 6140000
-32 1 6160000
-32 1 6180000
-32 1 6200000
-32 1 6220000
-32 1 6240000
-32 1 6260000
-32 1 6280000
-32 1 6300000
-32 1 6320000
-32 1 6340000
-32 1 6360000
-32 1 6380000
-32 1 6400000
-32 1 6420000
-32 1 6440000
-32 1 6460000
-32 1 6480000
-32 1 6500000
-32 1 6520000
-32 1 6540000
-32 1 6560000
-32 1 6580000
-32 1 6600000
-32 1 6620000
-32 1 6640000
-32 1 6660000
-32 1 6680000
-32 1 6700000
-32 1 6720000
-32 1 6740000
-32 1 6760000
-32 1 6780000
-32 1 6800000
-32 1 6820000
-32 1 6840000
-32 1 6860000
-32 1 6880000
-32 1 6900000
-32 1 6920000
-32 1 6940000
-32 1 6960000
-32 1 6980000
-32 1 7000000
-32 1 7020000
-32 1 7040000
-32 1 7060000
-32 1 7080000
-32 1 7100000
-32 1 7120000
-32 1 7140000
-32 1 7160000
-32 1 7180000
-32 1 7200000
-32 1 7220000
-32 1 7240000
-32 1 7260000
-32 1 7280000
-32 1 7300000
-32 1 7320000
-32 1 7340000
-32 1 7360000
-32 1 7380000
-32 1 7400000
-32 1 7420000
-32 1 7440000
-32 1 7460000
-32 1 7480000
-32 1 7500000
-32 1 7520000
-32 1 7540000
-32 1 7560000
-32 1 7580000
-32 1 7600000
-32 1 7620000
-32 1 7640000
-32 1 7660000
-32 1 7680000
-32 1 7700000
-32 1 7720000
-32 1 7740000
-32 1 7760000
-32 1 7780000
-32 1 7800000
-32 1 7820000
-32 1 7840000
-32 1 7860000
-32 1 7880000
-32 1 7900000
-32 1 7920000
-32 1 7940000
-32 1 7960000
-32 1 7980000
-32 1 8000000
-32 1 8020000
-32 1 8040000
-32 1 8060000
-32 1 8080000
-32 1 8100000
-32 1 8120000
-32 1 8140000
-32 1 8160000
-32 1 8180000
-32 1 8200000
-32 1 8220000
-32 1 8240000
-32 1 8260000
-32 1 8280000
-32 1 8300000
-32 1 8320000
-32 1 8340000
-32 1 8360000
-32 1 8380000
-32 1 8400000
-32 1 8420000
-32 1 8440000
-32 1 8460000
-32 1 8480000
-32 1 8500000
-32 1 8520000
-32 1 8540000
-32 1 8560000
-32 1 8580000
-32 1 8600000
-32 1 8620000
-32 1 8640000
-32 1 8660000
-32 1 8680000
-32 1 8700000
-32 1 8720000
-32 1 8740000
-32 1 8760000
-32 1 8780000
-32 1 8800000
-32 1 8820000
-32 1 8840000
-32 1 8860000
-32 1 8880000
-32 1 8900000
-32 1 8920000
-32 1 8940000
-32 1 8960000
-32 1 8980000
-32 1 9000000
-32 1 9020000
-32 1 9040000
-32 1 9060000
-32 1 9080000
-32 1 9100000
-32 1 9120000
-32 1 9140000
-32 1 9160000
-32 1 9180000
-32 1 9200000
-32 1 9220000
-32 1 9240000
-32 1 9260000
-32 1 9280000
-32 1 9300000
-32 1 9320000
-32 1 9340000
-32 1 9360000
-32 1 9380000
-32 1 9400000
-32 1 9420000
-32 1 9440000
-32 1 9460000
-32 1 9480000
-32 1 9500000
-32 1 9520000
-32 1 9540000
-32 1 9560000
-32 1 9580000
-32 1 9600000
-32 1 9620000
-32 1 9640000
-32 1 9660000
-32 1 9680000
-32 1 9700000
-32 1 9720000
-32 1 9740000
-32 1 9760000
-32 1 9780000
-32 1 9800000
-32 1 9820000
-32 1 9840000
-32 1 9860000
-32 1 9880000
-32 1 9900000
-32 1 9920000
-32 1 9940000
-32 1 9960000
-32 1 9980000
-32 1 10000000
-32 1 10020000
-32 1 10040000
-32 1 10060000
-32 1 10080000
-32 1 10100000
-32 1 10120000
-32 1 10140000
-32 1 10160000
-32 1 10180000
-32 1 10200000
-32 1 10220000
-32 1 10240000
-32 1 10260000
-32 1 10280000
-32 1 10300000
-32 1 10320000
-32 1 10340000
-32 1 10360000
-32 1 10380000
-32 1 10400000
-32 1 10420000
-32 1 10440000
-32 1 10460000
-32 1 10480000
-32 1 10500000
-32 1 10520000
-32 1 10540000
-32 1 10560000
-32 1 10580000
-32 1 10600000
-32 1 10620000
-32 1 10640000
-32 1 10660000
-32 1 10680000
-32 1 10700000
-32 1 10720000
-32 1 10740000
-32 1 10760000
-32 1 10780000
-32 1 10800000
-32 1 10820000
-32 1 10840000
-32 1 10860000
-32 1 10880000
-32 1 10900000
-32 1 10920000
-32 1 10940000
-32 1 10960000
-32 1 10980000
-32 1 11000000
-32 1 11020000
-32 1 11040000
-32 1 11060000
-32 1 11080000
-32 1 11100000
-32 1 11120000
-32 1 11140000
-32 1 11160000
-32 1 11180000
-32 1 11200000
-32 1 11220000
-32 1 11240000
-32 1 11260000
-32 1 11280000
-32 1 11300000
-32 1 11320000
-32 1 11340000
-32 1 11360000
-32 1 11380000
-32 1 11400000
-32 1 11420000
-32 1 11440000
-32 1 11460000
-32 1 11480000
-32 1 11500000
-32 1 11520000
-32 1 11540000
-32 1 11560000
-32 1 11580000
-32 1 11600000
-32 1 11620000
-32 1 11640000
-32 1 11660000
-32 1 11680000
-32 1 11700000
-32 1 11720000
-32 1 11740000
-32 1 11760000
-32 1 11780000
-32 1 11800000
-32 1 11820000
-32 1 11840000
-32 1 11860000
-32 1 11880000
-32 1 11900000
-32 1 11920000
-32 1 11940000
-32 1 11960000
-32 1 11980000
-32 1 12000000
-32 1 12020000
-32 1 12040000
-32 1 12060000
-32 1 12080000
-32 1 12100000
-32 1 12120000
-32 1 12140000
-32 1 12160000
-32 1 12180000
-32 1 12200000
-32 1 12220000
-32 1 12240000
-32 1 12260000
-32 1 12280000
-32 1 12300000
-32 1 12320000
-32 1 12340000
-32 1 12360000
-32 1 12380000
-32 1 12400000
-32 1 12420000
-32 1 12440000
-32 1 12460000
-32 1 12480000
-32 1 12500000
-32 1 12520000
-32 1 12540000
-32 1 12560000
-32 1 12580000
-32 1 12600000
-32 1 12620000
-32 1 12640000
-32 1 12660000
-32 1 12680000
-32 1 12700000
-32 1 12720000
-32 1 12740000
-32 1 12760000
-32 1 12780000
-32 1 12800000
-32 1 12820000
-32 1 12840000
-32 1 12860000
-32 1 12880000
-32 1 12900000
-32 1 12920000
-32 1 12940000
-32 1 12960000
-32 1 12980000
-32 1 13000000
-32 1 13020000
-32 1 13040000
-32 1 13060000
-32 1 13080000
-32 1 13100000
-32 1 13120000
-32 1 13140000
-32 1 13160000
-32 1 13180000
-32 1 13200000
-32 1 13220000
-32 1 13240000
-32 1 13260000
-32 1 13280000
-32 1 13300000
-32 1 13320000
-32 1 13340000
-32 1 13360000
-32 1 13380000
-32 1 13400000
-32 1 13420000
-32 1 13440000
-32 1 13460000
-32 1 13480000
-32 1 13500000
-32 1 13520000
-32 1 13540000
-32 1 13560000
-32 1 13580000
-32 1 13600000
-32 1 13620000
-32 1 13640000
-32 1 13660000
-32 1 13680000
-32 1 13700000
-32 1 13720000
-32 1 13740000
-32 1 13760000
-32 1 13780000
-32 1 13800000
-32 1 13820000
-32 1 13840000
-32 1 13860000
-32 1 13880000
-32 1 13900000
-32 1 13920000
-32 1 13940000
-32 1 13960000
-32 1 13980000
-32 1 14000000
-32 1 14020000
-32 1 14040000
-32 1 14060000
-32 1 14080000
-32 1 14100000
-32 1 14120000
-32 1 14140000
-32 1 14160000
-32 1 14180000
-32 1 14200000
-32 1 14220000
-32 1 14240000
-32 1 14260000
-32 1 14280000
-32 1 14300000
-32 1 14320000
-32 1 14340000
-32 1 14360000
-32 1 14380000
-32 1 14400000
-32 1 14420000
-32 1 14440000
-32 1 14460000
-32 1 14480000
-32 1 14500000
-32 1 14520000
-32 1 14540000
-32 1 14560000
-32 1 14580000
-32 1 14600000
-32 1 14620000
-32 1 14640000
-32 1 14660000
-32 1 14680000
-32 1 14700000
-32 1 14720000
-32 1 14740000
-32 1 14760000
-32 1 14780000
-32 1 14800000
-32 1 14820000
-32 1 14840000
-32 1 14860000
-32 1 14880000
-32 1 14900000
-32 1 14920000
-32 1 14940000
-32 1 14960000
-32 1 14980000
-32 1 15000000
-32 1 15020000
-32 1 15040000
-32 1 15060000
-32 1 15080000
-32 1 15100000
-32 1 15120000
-32 1 15140000
-32 1 15160000
-32 1 15180000
-32 1 15200000
-32 1 15220000
-32 1 15240000
-32 1 15260000
-32 1 15280000
-32 1 15300000
-32 1 15320000
-32 1 15340000
-32 1 15360000
-32 1 15380000
-32 1 15400000
-32 1 15420000
-32 1 15440000
-32 1 15460000
-32 1 15480000
-32 1 15500000
-32 1 15520000
-32 1 15540000
-32 1 15560000
-32 1 15580000
-32 1 15600000
-32 1 15620000
-32 1 15640000
-32 1 15660000
-32 1 15680000
-32 1 15700000
-32 1 15720000
-32 1 15740000
-32 1 15760000
-32 1 15780000
-32 1 15800000
-32 1 15820000
-32 1 15840000
-32 1 15860000
-32 1 15880000
-32 1 15900000
-32 1 15920000
-32 1 15940000
-32 1 15960000
-32 1 15980000
-32 1 16000000
-32 1 16020000
-32 1 16040000
-32 1 16060000
-32 1 16080000
-32 1 16100000
-32 1 16120000
-32 1 16140000
-32 1 16160000
-32 1 16180000
-32 1 16200000
-32 1 16220000
-32 1 16240000
-32 1 16260000
-32 1 16280000
-32 1 16300000
-32 1 16320000
-32 1 16340000
-32 1 16360000
-32 1 16380000
-32 1 16400000
-32 1 16420000
-32 1 16440000
-32 1 16460000
-32 1 16480000
-32 1 16500000
-32 1 16520000
-32 1 16540000
-32 1 16560000
-32 1 16580000
-32 1 16600000
-32 1 16620000
-32 1 16640000
diff --git a/media/codec2/hal/hidl/1.0/vts/functional/video/VtsHalMediaC2V1_0TargetVideoDecTest.cpp b/media/codec2/hal/hidl/1.0/vts/functional/video/VtsHalMediaC2V1_0TargetVideoDecTest.cpp
index c19701d..d561adc 100644
--- a/media/codec2/hal/hidl/1.0/vts/functional/video/VtsHalMediaC2V1_0TargetVideoDecTest.cpp
+++ b/media/codec2/hal/hidl/1.0/vts/functional/video/VtsHalMediaC2V1_0TargetVideoDecTest.cpp
@@ -685,7 +685,7 @@
if (mDisableTest) GTEST_SKIP() << "Test is disabled";
if (!(strcasestr(mMime.c_str(), "avc") || strcasestr(mMime.c_str(), "hevc") ||
strcasestr(mMime.c_str(), "vp8") || strcasestr(mMime.c_str(), "vp9") ||
- strcasestr(mMime.c_str(), "mpeg2"))) {
+ strcasestr(mMime.c_str(), "mpeg2") || strcasestr(mMime.c_str(), "av01"))) {
return;
}
diff --git a/media/codec2/hal/hidl/1.0/vts/functional/video/VtsHalMediaC2V1_0TargetVideoEncTest.cpp b/media/codec2/hal/hidl/1.0/vts/functional/video/VtsHalMediaC2V1_0TargetVideoEncTest.cpp
index 8305feb..db68b96 100644
--- a/media/codec2/hal/hidl/1.0/vts/functional/video/VtsHalMediaC2V1_0TargetVideoEncTest.cpp
+++ b/media/codec2/hal/hidl/1.0/vts/functional/video/VtsHalMediaC2V1_0TargetVideoEncTest.cpp
@@ -500,7 +500,7 @@
description("Encodes input file");
if (mDisableTest) GTEST_SKIP() << "Test is disabled";
- bool signalEOS = std::get<3>(GetParam());
+ bool signalEOS = std::get<2>(GetParam());
// Send an empty frame to receive CSD data from encoder.
bool sendEmptyFirstFrame = std::get<3>(GetParam());
mConfigBPictures = std::get<4>(GetParam());
diff --git a/media/codec2/hal/services/Android.bp b/media/codec2/hal/services/Android.bp
index 524519c..663e159 100644
--- a/media/codec2/hal/services/Android.bp
+++ b/media/codec2/hal/services/Android.bp
@@ -39,13 +39,17 @@
}
cc_binary {
- name: "android.hardware.media.c2@1.2-default-service",
+ name: "android.hardware.media.c2-default-service",
vendor: true,
relative_install_path: "hw",
- init_rc: ["android.hardware.media.c2@1.2-default-service.rc"],
+ init_rc: ["android.hardware.media.c2-default-service.rc"],
- defaults: ["libcodec2-hidl-defaults"],
+ defaults: [
+ "libcodec2-hidl-defaults",
+ "libcodec2-aidl-defaults",
+ ],
+
srcs: [
"vendor.cpp",
],
@@ -54,13 +58,14 @@
shared_libs: [
"libavservices_minijail",
"libbinder",
+ "libbinder_ndk",
],
- required: ["android.hardware.media.c2@1.2-default-seccomp_policy"],
+ required: ["android.hardware.media.c2-default-seccomp_policy"],
- // The content in manifest_media_c2_V1_1_default.xml can be included
+ // The content in manifest_media_c2_default.xml can be included
// directly in the main device manifest.xml file or via vintf_fragments.
// (Remove the line below if the entry is already in the main manifest.)
- vintf_fragments: ["manifest_media_c2_V1_1_default.xml"],
+ vintf_fragments: ["manifest_media_c2_default.xml"],
// Remove this line to enable this module.
enabled: false,
@@ -73,30 +78,29 @@
// Files in the "seccomp_policy" subdirectory are only provided as examples.
// They may not work on some devices and/or architectures without modification.
prebuilt_etc {
- name: "android.hardware.media.c2@1.2-default-seccomp_policy",
+ name: "android.hardware.media.c2-default-seccomp_policy",
vendor: true,
sub_dir: "seccomp_policy",
// If a specific architecture is targeted, multiple choices are not needed.
arch: {
arm: {
- src: "seccomp_policy/android.hardware.media.c2@1.2-default-arm.policy",
+ src: "seccomp_policy/android.hardware.media.c2-default-arm.policy",
},
arm64: {
- src: "seccomp_policy/android.hardware.media.c2@1.2-default-arm64.policy",
+ src: "seccomp_policy/android.hardware.media.c2-default-arm64.policy",
},
riscv64: {
- src: "seccomp_policy/android.hardware.media.c2@1.2-default-riscv64.policy",
+ src: "seccomp_policy/android.hardware.media.c2-default-riscv64.policy",
},
x86: {
- src: "seccomp_policy/android.hardware.media.c2@1.2-default-x86.policy",
+ src: "seccomp_policy/android.hardware.media.c2-default-x86.policy",
},
x86_64: {
- src: "seccomp_policy/android.hardware.media.c2@1.2-default-x86_64.policy",
+ src: "seccomp_policy/android.hardware.media.c2-default-x86_64.policy",
},
},
// This may be removed.
required: ["crash_dump.policy"],
}
-
diff --git a/media/codec2/hal/services/android.hardware.media.c2-default-service.rc b/media/codec2/hal/services/android.hardware.media.c2-default-service.rc
new file mode 100644
index 0000000..dcc8e71
--- /dev/null
+++ b/media/codec2/hal/services/android.hardware.media.c2-default-service.rc
@@ -0,0 +1,7 @@
+service android-hardware-media-c2-hal /vendor/bin/hw/android.hardware.media.c2-default-service
+ class hal
+ user mediacodec
+ group camera mediadrm drmrpc
+ ioprio rt 4
+ task_profiles ProcessCapacityHigh
+
diff --git a/media/codec2/hal/services/android.hardware.media.c2@1.2-default-service.rc b/media/codec2/hal/services/android.hardware.media.c2@1.2-default-service.rc
deleted file mode 100644
index 12da593..0000000
--- a/media/codec2/hal/services/android.hardware.media.c2@1.2-default-service.rc
+++ /dev/null
@@ -1,7 +0,0 @@
-service android-hardware-media-c2-hal-1-2 /vendor/bin/hw/android.hardware.media.c2@1.2-default-service
- class hal
- user mediacodec
- group camera mediadrm drmrpc
- ioprio rt 4
- task_profiles ProcessCapacityHigh
-
diff --git a/media/codec2/hal/services/manifest_media_c2_V1_0_default.xml b/media/codec2/hal/services/manifest_media_c2_V1_0_default.xml
deleted file mode 100644
index e97c3ce..0000000
--- a/media/codec2/hal/services/manifest_media_c2_V1_0_default.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<manifest version="1.0" type="device">
- <hal>
- <name>android.hardware.media.c2</name>
- <transport>hwbinder</transport>
- <version>1.0</version>
- <interface>
- <name>IComponentStore</name>
- <instance>default</instance>
- </interface>
- </hal>
-</manifest>
diff --git a/media/codec2/hal/services/manifest_media_c2_V1_1_default.xml b/media/codec2/hal/services/manifest_media_c2_V1_1_default.xml
deleted file mode 100644
index bf0d72f..0000000
--- a/media/codec2/hal/services/manifest_media_c2_V1_1_default.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<manifest version="1.0" type="device">
- <hal>
- <name>android.hardware.media.c2</name>
- <transport>hwbinder</transport>
- <version>1.1</version>
- <interface>
- <name>IComponentStore</name>
- <instance>default</instance>
- </interface>
- </hal>
-</manifest>
diff --git a/media/codec2/hal/services/manifest_media_c2_V1_2_default.xml b/media/codec2/hal/services/manifest_media_c2_V1_2_default.xml
deleted file mode 100644
index a5e8d87..0000000
--- a/media/codec2/hal/services/manifest_media_c2_V1_2_default.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<manifest version="1.0" type="device">
- <hal>
- <name>android.hardware.media.c2</name>
- <transport>hwbinder</transport>
- <version>1.2</version>
- <interface>
- <name>IComponentStore</name>
- <instance>default</instance>
- </interface>
- </hal>
-</manifest>
diff --git a/media/codec2/hal/services/manifest_media_c2_default.xml b/media/codec2/hal/services/manifest_media_c2_default.xml
new file mode 100644
index 0000000..5e3d060
--- /dev/null
+++ b/media/codec2/hal/services/manifest_media_c2_default.xml
@@ -0,0 +1,18 @@
+<manifest version="1.0" type="device">
+ <!-- HIDL fragment -->
+ <hal>
+ <name>android.hardware.media.c2</name>
+ <transport>hwbinder</transport>
+ <version>1.2</version>
+ <interface>
+ <name>IComponentStore</name>
+ <instance>default</instance>
+ </interface>
+ </hal>
+ <!-- AIDL fragment -->
+ <hal format="aidl">
+ <name>android.hardware.media.c2</name>
+ <version>1</version>
+ <fqname>IComponentStore/default</fqname>
+ </hal>
+</manifest>
diff --git a/media/codec2/hal/services/seccomp_policy/android.hardware.media.c2@1.2-default-arm.policy b/media/codec2/hal/services/seccomp_policy/android.hardware.media.c2-default-arm.policy
similarity index 100%
rename from media/codec2/hal/services/seccomp_policy/android.hardware.media.c2@1.2-default-arm.policy
rename to media/codec2/hal/services/seccomp_policy/android.hardware.media.c2-default-arm.policy
diff --git a/media/codec2/hal/services/seccomp_policy/android.hardware.media.c2@1.2-default-arm64.policy b/media/codec2/hal/services/seccomp_policy/android.hardware.media.c2-default-arm64.policy
similarity index 100%
rename from media/codec2/hal/services/seccomp_policy/android.hardware.media.c2@1.2-default-arm64.policy
rename to media/codec2/hal/services/seccomp_policy/android.hardware.media.c2-default-arm64.policy
diff --git a/media/codec2/hal/services/seccomp_policy/android.hardware.media.c2@1.2-default-riscv64.policy b/media/codec2/hal/services/seccomp_policy/android.hardware.media.c2-default-riscv64.policy
similarity index 100%
rename from media/codec2/hal/services/seccomp_policy/android.hardware.media.c2@1.2-default-riscv64.policy
rename to media/codec2/hal/services/seccomp_policy/android.hardware.media.c2-default-riscv64.policy
diff --git a/media/codec2/hal/services/seccomp_policy/android.hardware.media.c2@1.2-default-x86.policy b/media/codec2/hal/services/seccomp_policy/android.hardware.media.c2-default-x86.policy
similarity index 100%
rename from media/codec2/hal/services/seccomp_policy/android.hardware.media.c2@1.2-default-x86.policy
rename to media/codec2/hal/services/seccomp_policy/android.hardware.media.c2-default-x86.policy
diff --git a/media/codec2/hal/services/seccomp_policy/android.hardware.media.c2@1.2-default-x86_64.policy b/media/codec2/hal/services/seccomp_policy/android.hardware.media.c2-default-x86_64.policy
similarity index 100%
rename from media/codec2/hal/services/seccomp_policy/android.hardware.media.c2@1.2-default-x86_64.policy
rename to media/codec2/hal/services/seccomp_policy/android.hardware.media.c2-default-x86_64.policy
diff --git a/media/codec2/hal/services/vendor.cpp b/media/codec2/hal/services/vendor.cpp
index 0d0684d..7cb7e6d 100644
--- a/media/codec2/hal/services/vendor.cpp
+++ b/media/codec2/hal/services/vendor.cpp
@@ -15,29 +15,43 @@
*/
//#define LOG_NDEBUG 0
-#define LOG_TAG "android.hardware.media.c2@1.2-service"
+#define LOG_TAG "android.hardware.media.c2-service"
#include <android-base/logging.h>
-#include <binder/ProcessState.h>
-#include <codec2/hidl/1.2/ComponentStore.h>
-#include <hidl/HidlTransportSupport.h>
#include <minijail.h>
#include <util/C2InterfaceHelper.h>
#include <C2Component.h>
#include <C2Config.h>
+// HIDL
+#include <binder/ProcessState.h>
+#include <codec2/hidl/1.2/ComponentStore.h>
+#include <hidl/HidlTransportSupport.h>
+
+// AIDL
+#include <android/binder_manager.h>
+#include <android/binder_process.h>
+#include <codec2/aidl/ComponentStore.h>
+#include <codec2/aidl/ParamTypes.h>
+
// This is the absolute on-device path of the prebuild_etc module
-// "android.hardware.media.c2@1.1-default-seccomp_policy" in Android.bp.
+// "android.hardware.media.c2-default-seccomp_policy" in Android.bp.
static constexpr char kBaseSeccompPolicyPath[] =
"/vendor/etc/seccomp_policy/"
- "android.hardware.media.c2@1.2-default-seccomp-policy";
+ "android.hardware.media.c2-default-seccomp_policy";
// Additional seccomp permissions can be added in this file.
// This file does not exist by default.
static constexpr char kExtSeccompPolicyPath[] =
"/vendor/etc/seccomp_policy/"
- "android.hardware.media.c2@1.2-extended-seccomp-policy";
+ "android.hardware.media.c2-extended-seccomp_policy";
+
+// We want multiple threads to be running so that a blocking operation
+// on one codec does not block the other codecs.
+// For HIDL: Extra threads may be needed to handle a stacked IPC sequence that
+// contains alternating binder and hwbinder calls. (See b/35283480.)
+static constexpr int kThreadCount = 8;
class StoreImpl : public C2ComponentStore {
public:
@@ -125,12 +139,12 @@
addParameter(
DefineParam(mDmaBufUsageInfo, "dmabuf-usage")
- .withDefault(new C2StoreDmaBufUsageInfo())
+ .withDefault(C2StoreDmaBufUsageInfo::AllocShared(128))
.withFields({
- C2F(mDmaBufUsageInfo, usage).flags({C2MemoryUsage::CPU_READ | C2MemoryUsage::CPU_WRITE}),
- C2F(mDmaBufUsageInfo, capacity).inRange(0, UINT32_MAX, 1024),
- C2F(mDmaBufUsageInfo, heapName).any(),
- C2F(mDmaBufUsageInfo, allocFlags).flags({}),
+ C2F(mDmaBufUsageInfo, m.usage).flags({C2MemoryUsage::CPU_READ | C2MemoryUsage::CPU_WRITE}),
+ C2F(mDmaBufUsageInfo, m.capacity).inRange(0, UINT32_MAX, 1024),
+ C2F(mDmaBufUsageInfo, m.allocFlags).flags({}),
+ C2F(mDmaBufUsageInfo, m.heapName).any(),
})
.withSetter(SetDmaBufUsage)
.build());
@@ -162,21 +176,49 @@
Interface mInterface;
};
-int main(int /* argc */, char** /* argv */) {
- using namespace ::android;
- LOG(DEBUG) << "android.hardware.media.c2@1.2-service starting...";
+void runAidlService() {
+ ABinderProcess_setThreadPoolMaxThreadCount(kThreadCount);
+ ABinderProcess_startThreadPool();
- // Set up minijail to limit system calls.
- signal(SIGPIPE, SIG_IGN);
- SetUpMinijail(kBaseSeccompPolicyPath, kExtSeccompPolicyPath);
+ // Create IComponentStore service.
+ using namespace ::aidl::android::hardware::media::c2;
+ std::shared_ptr<IComponentStore> store;
+
+ // TODO: Replace this with
+ // store = new utils::ComponentStore(
+ // /* implementation of C2ComponentStore */);
+ LOG(DEBUG) << "Instantiating Codec2's IComponentStore service...";
+ store = ::ndk::SharedRefBase::make<utils::ComponentStore>(
+ std::make_shared<StoreImpl>());
+
+ if (store == nullptr) {
+ LOG(ERROR) << "Cannot create Codec2's IComponentStore service.";
+ } else {
+ const std::string serviceName =
+ std::string(IComponentStore::descriptor) + "/default";
+ binder_exception_t ex = AServiceManager_addService(
+ store->asBinder().get(), serviceName.c_str());
+ if (ex != EX_NONE) {
+ LOG(ERROR) << "Cannot register Codec2's IComponentStore service"
+ " with instance name << \""
+ << serviceName << "\".";
+ } else {
+ LOG(DEBUG) << "Codec2's IComponentStore service registered. "
+ "Instance name: \"" << serviceName << "\".";
+ }
+ }
+
+ ABinderProcess_joinThreadPool();
+}
+
+void runHidlService() {
+ using namespace ::android;
// Enable vndbinder to allow vendor-to-vendor binder calls.
ProcessState::initWithDriver("/dev/vndbinder");
ProcessState::self()->startThreadPool();
- // Extra threads may be needed to handle a stacked IPC sequence that
- // contains alternating binder and hwbinder calls. (See b/35283480.)
- hardware::configureRpcThreadpool(8, true /* callerWillJoin */);
+ hardware::configureRpcThreadpool(kThreadCount, true /* callerWillJoin */);
// Create IComponentStore service.
{
@@ -206,5 +248,20 @@
}
hardware::joinRpcThreadpool();
+}
+
+int main(int /* argc */, char** /* argv */) {
+ const bool aidlEnabled = ::aidl::android::hardware::media::c2::utils::IsEnabled();
+ LOG(DEBUG) << "android.hardware.media.c2" << (aidlEnabled ? "-V1" : "@1.2")
+ << "-service starting...";
+
+ // Set up minijail to limit system calls.
+ signal(SIGPIPE, SIG_IGN);
+ android::SetUpMinijail(kBaseSeccompPolicyPath, kExtSeccompPolicyPath);
+ if (aidlEnabled) {
+ runAidlService();
+ } else {
+ runHidlService();
+ }
return 0;
}
diff --git a/media/codec2/vndk/C2AllocatorGralloc.cpp b/media/codec2/vndk/C2AllocatorGralloc.cpp
index f272499..0803dc3 100644
--- a/media/codec2/vndk/C2AllocatorGralloc.cpp
+++ b/media/codec2/vndk/C2AllocatorGralloc.cpp
@@ -23,6 +23,7 @@
#include <aidl/android/hardware/graphics/common/PlaneLayoutComponentType.h>
#include <android/hardware/graphics/common/1.2/types.h>
#include <cutils/native_handle.h>
+#include <drm/drm_fourcc.h>
#include <gralloctypes/Gralloc4.h>
#include <hardware/gralloc.h>
#include <ui/GraphicBufferAllocator.h>
@@ -478,7 +479,25 @@
// 'NATIVE' on Android means LITTLE_ENDIAN
constexpr C2PlaneInfo::endianness_t kEndianness = C2PlaneInfo::NATIVE;
- switch (mFormat) {
+ // Try to resolve IMPLEMENTATION_DEFINED format to accurate format if
+ // possible.
+ uint32_t format = mFormat;
+ uint32_t fourCc;
+ if (format == HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED &&
+ !GraphicBufferMapper::get().getPixelFormatFourCC(mBuffer, &fourCc)) {
+ switch (fourCc) {
+ case DRM_FORMAT_XBGR8888:
+ format = static_cast<uint32_t>(PixelFormat4::RGBX_8888);
+ break;
+ case DRM_FORMAT_ABGR8888:
+ format = static_cast<uint32_t>(PixelFormat4::RGBA_8888);
+ break;
+ default:
+ break;
+ }
+ }
+
+ switch (format) {
case static_cast<uint32_t>(PixelFormat4::RGBA_1010102): {
// TRICKY: this is used for media as YUV444 in the case when it is queued directly to a
// Surface. In all other cases it is RGBA. We don't know which case it is here, so
diff --git a/media/libaudioclient/tests/audiosystem_tests.cpp b/media/libaudioclient/tests/audiosystem_tests.cpp
index f31bd95..2869ca4 100644
--- a/media/libaudioclient/tests/audiosystem_tests.cpp
+++ b/media/libaudioclient/tests/audiosystem_tests.cpp
@@ -21,9 +21,9 @@
#include <set>
#include <gtest/gtest.h>
+#include <log/log.h>
#include <media/AidlConversionCppNdk.h>
#include <media/IAudioFlinger.h>
-#include <utils/Log.h>
#include "audio_test_utils.h"
@@ -277,23 +277,30 @@
GTEST_SKIP() << "No output devices returned by the audio system";
}
+ bool sourceFound = false, sinkFound = false;
for (const auto& port : ports) {
if (port.role == AUDIO_PORT_ROLE_SOURCE && port.type == AUDIO_PORT_TYPE_DEVICE) {
sourcePort = port;
+ sourceFound = true;
}
if (port.role == AUDIO_PORT_ROLE_SINK && port.type == AUDIO_PORT_TYPE_DEVICE &&
port.ext.device.type == AUDIO_DEVICE_OUT_SPEAKER) {
sinkPort = port;
+ sinkFound = true;
}
+ if (sourceFound && sinkFound) break;
+ }
+ if (!sourceFound || !sinkFound) {
+ GTEST_SKIP() << "No ports suitable for testing";
}
audioPatch.sources[0] = sourcePort.active_config;
audioPatch.sinks[0] = sinkPort.active_config;
status = AudioSystem::createAudioPatch(&audioPatch, &audioPatchHandle);
- EXPECT_EQ(OK, status) << "AudioSystem::createAudiopatch failed between source "
- << sourcePort.ext.device.address << " and sink "
- << sinkPort.ext.device.address;
+ EXPECT_EQ(OK, status) << "AudioSystem::createAudioPatch failed between source "
+ << audio_device_to_string(sourcePort.ext.device.type) << " and sink "
+ << audio_device_to_string(sinkPort.ext.device.type);
// verify that patch is established between source and the sink.
ASSERT_NO_FATAL_FAILURE(anyPatchContainsInputDevice(sourcePort.id, patchFound));
@@ -302,8 +309,8 @@
EXPECT_NE(AUDIO_PORT_HANDLE_NONE, audioPatchHandle);
status = AudioSystem::releaseAudioPatch(audioPatchHandle);
EXPECT_EQ(OK, status) << "AudioSystem::releaseAudioPatch failed between source "
- << sourcePort.ext.device.address << " and sink "
- << sinkPort.ext.device.address;
+ << audio_device_to_string(sourcePort.ext.device.type) << " and sink "
+ << audio_device_to_string(sinkPort.ext.device.type);
// verify that no patch is established between source and the sink after releaseAudioPatch.
ASSERT_NO_FATAL_FAILURE(anyPatchContainsInputDevice(sourcePort.id, patchFound));
@@ -608,28 +615,37 @@
android::media::audio::common::AudioPort GenerateUniqueDeviceAddress(
const android::media::audio::common::AudioPort& port) {
+ // Point-to-point connections do not use addresses.
+ static const std::set<std::string> kPointToPointConnections = {
+ AudioDeviceDescription::CONNECTION_ANALOG(), AudioDeviceDescription::CONNECTION_HDMI(),
+ AudioDeviceDescription::CONNECTION_HDMI_ARC(),
+ AudioDeviceDescription::CONNECTION_HDMI_EARC(),
+ AudioDeviceDescription::CONNECTION_SPDIF()};
static int nextId = 0;
using Tag = AudioDeviceAddress::Tag;
+ const auto& deviceDescription = port.ext.get<AudioPortExt::Tag::device>().device.type;
AudioDeviceAddress address;
- switch (suggestDeviceAddressTag(port.ext.get<AudioPortExt::Tag::device>().device.type)) {
- case Tag::id:
- address = AudioDeviceAddress::make<Tag::id>(std::to_string(++nextId));
- break;
- case Tag::mac:
- address = AudioDeviceAddress::make<Tag::mac>(
- std::vector<uint8_t>{1, 2, 3, 4, 5, static_cast<uint8_t>(++nextId & 0xff)});
- break;
- case Tag::ipv4:
- address = AudioDeviceAddress::make<Tag::ipv4>(
- std::vector<uint8_t>{192, 168, 0, static_cast<uint8_t>(++nextId & 0xff)});
- break;
- case Tag::ipv6:
- address = AudioDeviceAddress::make<Tag::ipv6>(std::vector<int32_t>{
- 0xfc00, 0x0123, 0x4567, 0x89ab, 0xcdef, 0, 0, ++nextId & 0xffff});
- break;
- case Tag::alsa:
- address = AudioDeviceAddress::make<Tag::alsa>(std::vector<int32_t>{1, ++nextId});
- break;
+ if (kPointToPointConnections.count(deviceDescription.connection) == 0) {
+ switch (suggestDeviceAddressTag(deviceDescription)) {
+ case Tag::id:
+ address = AudioDeviceAddress::make<Tag::id>(std::to_string(++nextId));
+ break;
+ case Tag::mac:
+ address = AudioDeviceAddress::make<Tag::mac>(
+ std::vector<uint8_t>{1, 2, 3, 4, 5, static_cast<uint8_t>(++nextId & 0xff)});
+ break;
+ case Tag::ipv4:
+ address = AudioDeviceAddress::make<Tag::ipv4>(
+ std::vector<uint8_t>{192, 168, 0, static_cast<uint8_t>(++nextId & 0xff)});
+ break;
+ case Tag::ipv6:
+ address = AudioDeviceAddress::make<Tag::ipv6>(std::vector<int32_t>{
+ 0xfc00, 0x0123, 0x4567, 0x89ab, 0xcdef, 0, 0, ++nextId & 0xffff});
+ break;
+ case Tag::alsa:
+ address = AudioDeviceAddress::make<Tag::alsa>(std::vector<int32_t>{1, ++nextId});
+ break;
+ }
}
android::media::audio::common::AudioPort result = port;
result.ext.get<AudioPortExt::Tag::device>().device.address = std::move(address);
@@ -689,3 +705,24 @@
EXPECT_EQ(AUDIO_POLICY_DEVICE_STATE_UNAVAILABLE, deviceState);
}
}
+
+class TestExecutionTracer : public ::testing::EmptyTestEventListener {
+ public:
+ void OnTestStart(const ::testing::TestInfo& test_info) override {
+ TraceTestState("Started", test_info);
+ }
+ void OnTestEnd(const ::testing::TestInfo& test_info) override {
+ TraceTestState("Completed", test_info);
+ }
+
+ private:
+ static void TraceTestState(const std::string& state, const ::testing::TestInfo& test_info) {
+ ALOGI("%s %s::%s", state.c_str(), test_info.test_suite_name(), test_info.name());
+ }
+};
+
+int main(int argc, char** argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+ ::testing::UnitTest::GetInstance()->listeners().Append(new TestExecutionTracer());
+ return RUN_ALL_TESTS();
+}
diff --git a/media/libaudiohal/impl/DeviceHalAidl.cpp b/media/libaudiohal/impl/DeviceHalAidl.cpp
index e22acc4..131684c 100644
--- a/media/libaudiohal/impl/DeviceHalAidl.cpp
+++ b/media/libaudiohal/impl/DeviceHalAidl.cpp
@@ -42,6 +42,7 @@
using aidl::android::media::audio::common::AudioDevice;
using aidl::android::media::audio::common::AudioDeviceAddress;
using aidl::android::media::audio::common::AudioDeviceType;
+using aidl::android::media::audio::common::AudioFormatDescription;
using aidl::android::media::audio::common::AudioFormatType;
using aidl::android::media::audio::common::AudioInputFlags;
using aidl::android::media::audio::common::AudioIoFlags;
@@ -97,9 +98,15 @@
}
void setPortConfigFromConfig(AudioPortConfig* portConfig, const AudioConfig& config) {
- portConfig->sampleRate = Int{ .value = config.base.sampleRate };
- portConfig->channelMask = config.base.channelMask;
- portConfig->format = config.base.format;
+ if (config.base.sampleRate != 0) {
+ portConfig->sampleRate = Int{ .value = config.base.sampleRate };
+ }
+ if (config.base.channelMask != AudioChannelLayout{}) {
+ portConfig->channelMask = config.base.channelMask;
+ }
+ if (config.base.format != AudioFormatDescription{}) {
+ portConfig->format = config.base.format;
+ }
}
// Note: these converters are for types defined in different AIDL files. Although these
@@ -706,7 +713,11 @@
aidlPatch.sourcePortConfigIds.clear();
aidlPatch.sinkPortConfigIds.clear();
}
- ALOGD("%s: sources: %s, sinks: %s",
+ // The IDs will be found by 'fillPortConfigs', however the original 'aidlSources' and
+ // 'aidlSinks' will not be updated because 'setAudioPatch' only needs IDs. Here we log
+ // the source arguments, where only the audio configuration and device specifications
+ // are relevant.
+ ALOGD("%s: [disregard IDs] sources: %s, sinks: %s",
__func__, ::android::internal::ToString(aidlSources).c_str(),
::android::internal::ToString(aidlSinks).c_str());
auto fillPortConfigs = [&](
@@ -1013,11 +1024,12 @@
// There is not AIDL API defined for `prepareToDisconnectExternalDevice`.
// Call `setConnectedState` instead.
// TODO(b/279824103): call prepareToDisconnectExternalDevice when it is added.
- const status_t status = setConnectedState(port, false /*connected*/);
- if (status == NO_ERROR) {
+ if (const status_t status = setConnectedState(port, false /*connected*/); status == NO_ERROR) {
mDeviceDisconnectionNotified.insert(port->id);
}
- return status;
+ // Return that there was no error as otherwise the disconnection procedure will not be
+ // considered complete for upper layers, and 'setConnectedState' will not be called again.
+ return NO_ERROR;
}
status_t DeviceHalAidl::setConnectedState(const struct audio_port_v7 *port, bool connected) {
@@ -1050,10 +1062,14 @@
matchDevice.address = AudioDeviceAddress::make<AudioDeviceAddress::id>();
auto portsIt = findPort(matchDevice);
if (portsIt == mPorts.end()) {
- ALOGW("%s: device port for device %s is not found in the module %s",
- __func__, matchDevice.toString().c_str(), mInstance.c_str());
+ // Since 'setConnectedState' is called for all modules, it is normal when the device
+ // port not found in every one of them.
return BAD_VALUE;
+ } else {
+ ALOGD("%s: device port for device %s found in the module %s",
+ __func__, matchDevice.toString().c_str(), mInstance.c_str());
}
+ resetUnusedPatchesAndPortConfigs();
// Use the ID of the "template" port, use all the information from the provided port.
aidlPort.id = portsIt->first;
AudioPort connectedPort;
@@ -1064,20 +1080,32 @@
"%s: module %s, duplicate port ID received from HAL: %s, existing port: %s",
__func__, mInstance.c_str(), connectedPort.toString().c_str(),
it->second.toString().c_str());
+ mConnectedPorts[connectedPort.id] = false;
} else { // !connected
AudioDevice matchDevice = aidlPort.ext.get<AudioPortExt::device>().device;
auto portsIt = findPort(matchDevice);
if (portsIt == mPorts.end()) {
- ALOGW("%s: device port for device %s is not found in the module %s",
- __func__, matchDevice.toString().c_str(), mInstance.c_str());
+ // Since 'setConnectedState' is called for all modules, it is normal when the device
+ // port not found in every one of them.
return BAD_VALUE;
+ } else {
+ ALOGD("%s: device port for device %s found in the module %s",
+ __func__, matchDevice.toString().c_str(), mInstance.c_str());
}
- // Any streams opened on the external device must be closed by this time,
- // thus we can clean up patches and port configs that were created for them.
resetUnusedPatchesAndPortConfigs();
- RETURN_STATUS_IF_ERROR(statusTFromBinderStatus(mModule->disconnectExternalDevice(
- portsIt->second.id)));
- mPorts.erase(portsIt);
+ // Streams are closed by AudioFlinger independently from device disconnections.
+ // It is possible that the stream has not been closed yet.
+ const int32_t portId = portsIt->second.id;
+ if (!isPortHeldByAStream(portId)) {
+ RETURN_STATUS_IF_ERROR(statusTFromBinderStatus(
+ mModule->disconnectExternalDevice(portId)));
+ mPorts.erase(portsIt);
+ mConnectedPorts.erase(portId);
+ } else {
+ ALOGD("%s: since device port ID %d is used by a stream, "
+ "external device disconnection postponed", __func__, portId);
+ mConnectedPorts[portId] = true;
+ }
}
return updateRoutes();
}
@@ -1085,6 +1113,7 @@
status_t DeviceHalAidl::setSimulateDeviceConnections(bool enabled) {
TIME_CHECK();
if (!mModule) return NO_INIT;
+ resetUnusedPatchesAndPortConfigs();
ModuleDebug debug{ .simulateDeviceConnections = enabled };
status_t status = statusTFromBinderStatus(mModule->setModuleDebug(debug));
// This is important to log as it affects HAL behavior.
@@ -1499,7 +1528,7 @@
}
RETURN_STATUS_IF_ERROR(createOrUpdatePortConfig(requestedPortConfig, &portConfigIt,
created));
- } else if (!flags.has_value()) {
+ } else if (portConfigIt == mPortConfigs.end() && !flags.has_value()) {
ALOGW("%s: mix port config for %s, handle %d not found in the module %s, "
"and was not created as flags are not specified",
__func__, config.toString().c_str(), ioHandle, mInstance.c_str());
@@ -1574,8 +1603,25 @@
} else if (device.type.type == AudioDeviceType::OUT_DEFAULT) {
return mPorts.find(mDefaultOutputPortId);
}
- return std::find_if(mPorts.begin(), mPorts.end(),
- [&](const auto& pair) { return audioDeviceMatches(device, pair.second); });
+ if (device.address.getTag() != AudioDeviceAddress::id ||
+ !device.address.get<AudioDeviceAddress::id>().empty()) {
+ return std::find_if(mPorts.begin(), mPorts.end(),
+ [&](const auto& pair) { return audioDeviceMatches(device, pair.second); });
+ }
+ // For connection w/o an address, two ports can be found: the template port,
+ // and a connected port (if exists). Make sure we return the connected port.
+ DeviceHalAidl::Ports::iterator portIt = mPorts.end();
+ for (auto it = mPorts.begin(); it != mPorts.end(); ++it) {
+ if (audioDeviceMatches(device, it->second)) {
+ if (mConnectedPorts.find(it->first) != mConnectedPorts.end()) {
+ return it;
+ } else {
+ // Will return 'it' if there is no connected port.
+ portIt = it;
+ }
+ }
+ }
+ return portIt;
}
DeviceHalAidl::Ports::iterator DeviceHalAidl::findPort(
@@ -1653,6 +1699,28 @@
p.ext.template get<Tag::mix>().handle == ioHandle; });
}
+bool DeviceHalAidl::isPortHeldByAStream(int32_t portId) {
+ // It is assumed that mStreams has already been cleaned up.
+ for (const auto& streamPair : mStreams) {
+ int32_t patchId = streamPair.second;
+ auto patchIt = mPatches.find(patchId);
+ if (patchIt == mPatches.end()) continue;
+ for (int32_t id : patchIt->second.sourcePortConfigIds) {
+ auto portConfigIt = mPortConfigs.find(id);
+ if (portConfigIt != mPortConfigs.end() && portConfigIt->second.portId == portId) {
+ return true;
+ }
+ }
+ for (int32_t id : patchIt->second.sinkPortConfigIds) {
+ auto portConfigIt = mPortConfigs.find(id);
+ if (portConfigIt != mPortConfigs.end() && portConfigIt->second.portId == portId) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
void DeviceHalAidl::resetPatch(int32_t patchId) {
if (auto it = mPatches.find(patchId); it != mPatches.end()) {
mPatches.erase(it);
@@ -1702,10 +1770,10 @@
// The assumption is that port configs are used to create patches
// (or to open streams, but that involves creation of patches, too). Thus,
// orphaned port configs can and should be reset.
- std::set<int32_t> portConfigIds;
+ std::map<int32_t, int32_t /*portID*/> portConfigIds;
std::transform(mPortConfigs.begin(), mPortConfigs.end(),
std::inserter(portConfigIds, portConfigIds.end()),
- [](const auto& pcPair) { return pcPair.first; });
+ [](const auto& pcPair) { return std::make_pair(pcPair.first, pcPair.second.portId); });
for (const auto& p : mPatches) {
for (int32_t id : p.second.sourcePortConfigIds) portConfigIds.erase(id);
for (int32_t id : p.second.sinkPortConfigIds) portConfigIds.erase(id);
@@ -1713,7 +1781,28 @@
for (int32_t id : mInitialPortConfigIds) {
portConfigIds.erase(id);
}
- for (int32_t id : portConfigIds) resetPortConfig(id);
+ std::set<int32_t> retryDeviceDisconnection;
+ for (const auto& portConfigAndIdPair : portConfigIds) {
+ resetPortConfig(portConfigAndIdPair.first);
+ if (const auto it = mConnectedPorts.find(portConfigAndIdPair.second);
+ it != mConnectedPorts.end() && it->second) {
+ retryDeviceDisconnection.insert(portConfigAndIdPair.second);
+ }
+ }
+ for (int32_t portId : retryDeviceDisconnection) {
+ if (!isPortHeldByAStream(portId)) {
+ TIME_CHECK();
+ if (auto status = mModule->disconnectExternalDevice(portId); status.isOk()) {
+ mPorts.erase(portId);
+ mConnectedPorts.erase(portId);
+ ALOGD("%s: executed postponed external device disconnection for port ID %d",
+ __func__, portId);
+ }
+ }
+ }
+ if (!retryDeviceDisconnection.empty()) {
+ updateRoutes();
+ }
}
status_t DeviceHalAidl::updateRoutes() {
diff --git a/media/libaudiohal/impl/DeviceHalAidl.h b/media/libaudiohal/impl/DeviceHalAidl.h
index 2e393c7..da96d80 100644
--- a/media/libaudiohal/impl/DeviceHalAidl.h
+++ b/media/libaudiohal/impl/DeviceHalAidl.h
@@ -187,6 +187,8 @@
Status status = Status::UNKNOWN;
MicrophoneInfoProvider::Info info;
};
+ // IDs of ports for connected external devices, and whether they are held by streams.
+ using ConnectedPorts = std::map<int32_t /*port ID*/, bool>;
using Patches = std::map<int32_t /*patch ID*/,
::aidl::android::hardware::audio::core::AudioPatch>;
using PortConfigs = std::map<int32_t /*port config ID*/,
@@ -257,6 +259,7 @@
const ::aidl::android::media::audio::common::AudioConfig& config,
const std::optional<::aidl::android::media::audio::common::AudioIoFlags>& flags,
int32_t ioHandle);
+ bool isPortHeldByAStream(int32_t portId);
status_t prepareToOpenStream(
int32_t aidlHandle,
const ::aidl::android::media::audio::common::AudioDevice& aidlDevice,
@@ -312,6 +315,7 @@
std::mutex mLock;
std::map<void*, Callbacks> mCallbacks GUARDED_BY(mLock);
std::set<audio_port_handle_t> mDeviceDisconnectionNotified;
+ ConnectedPorts mConnectedPorts;
};
} // namespace android
diff --git a/media/libaudiohal/impl/EffectConversionHelperAidl.cpp b/media/libaudiohal/impl/EffectConversionHelperAidl.cpp
index 751c239..ae73262 100644
--- a/media/libaudiohal/impl/EffectConversionHelperAidl.cpp
+++ b/media/libaudiohal/impl/EffectConversionHelperAidl.cpp
@@ -101,6 +101,8 @@
const void* pCmdData __unused, uint32_t* replySize,
void* pReplyData) {
if (!replySize || *replySize < sizeof(int) || !pReplyData) {
+ ALOGE("%s parameter invalid, replySize %s pReplyData %p", __func__,
+ numericPointerToString(replySize).c_str(), pReplyData);
return BAD_VALUE;
}
@@ -110,8 +112,10 @@
status_t EffectConversionHelperAidl::handleSetParameter(uint32_t cmdSize, const void* pCmdData,
uint32_t* replySize, void* pReplyData) {
- if (cmdSize < sizeof(effect_param_t) || !pCmdData || !replySize ||
- *replySize < sizeof(int) || !pReplyData) {
+ if (cmdSize < sizeof(effect_param_t) || !pCmdData || !replySize || *replySize < sizeof(int) ||
+ !pReplyData) {
+ ALOGE("%s parameter invalid, cmdSize %u pCmdData %p replySize %s pReplyData %p", __func__,
+ cmdSize, pCmdData, numericPointerToString(replySize).c_str(), pReplyData);
return BAD_VALUE;
}
@@ -130,8 +134,8 @@
status_t EffectConversionHelperAidl::handleGetParameter(uint32_t cmdSize, const void* pCmdData,
uint32_t* replySize, void* pReplyData) {
if (cmdSize < sizeof(effect_param_t) || !pCmdData || !replySize || !pReplyData) {
- ALOGE("%s illegal cmdSize %u pCmdData %p replySize %p replyData %p", __func__, cmdSize,
- pCmdData, replySize, pReplyData);
+ ALOGE("%s illegal cmdSize %u pCmdData %p replySize %s replyData %p", __func__, cmdSize,
+ pCmdData, numericPointerToString(replySize).c_str(), pReplyData);
return BAD_VALUE;
}
@@ -158,8 +162,8 @@
uint32_t* replySize, void* pReplyData) {
if (!replySize || *replySize != sizeof(int) || !pReplyData ||
cmdSize != sizeof(effect_config_t)) {
- ALOGE("%s parameter invalid %u %p %p %p", __func__, cmdSize, pCmdData, replySize,
- pReplyData);
+ ALOGE("%s parameter invalid, cmdSize %u pCmdData %p replySize %s pReplyData %p", __func__,
+ cmdSize, pCmdData, numericPointerToString(replySize).c_str(), pReplyData);
return BAD_VALUE;
}
@@ -225,13 +229,19 @@
const void* pCmdData __unused,
uint32_t* replySize, void* pReplyData) {
if (!replySize || *replySize != sizeof(effect_config_t) || !pReplyData) {
- ALOGE("%s parameter invalid %p %p", __func__, replySize, pReplyData);
+ ALOGE("%s parameter invalid, replySize %s pReplyData %p", __func__,
+ numericPointerToString(replySize).c_str(), pReplyData);
return BAD_VALUE;
}
Parameter param;
RETURN_STATUS_IF_ERROR(statusTFromBinderStatus(mEffect->getParameter(
Parameter::Id::make<Parameter::Id::commonTag>(Parameter::common), ¶m)));
+ if (param.getTag() != Parameter::common) {
+ *replySize = 0;
+ ALOGW("%s no valid common tag return from HAL: %s", __func__, param.toString().c_str());
+ return BAD_VALUE;
+ }
const auto& common = param.get<Parameter::common>();
effect_config_t* pConfig = (effect_config_t*)pReplyData;
@@ -246,7 +256,8 @@
const void* pCmdData __unused, uint32_t* replySize,
void* pReplyData) {
if (!replySize || !pReplyData) {
- ALOGE("%s parameter invalid %p %p", __func__, replySize, pReplyData);
+ ALOGE("%s parameter invalid, replySize %s pReplyData %p", __func__,
+ numericPointerToString(replySize).c_str(), pReplyData);
return BAD_VALUE;
}
@@ -257,7 +268,8 @@
const void* pCmdData __unused,
uint32_t* replySize, void* pReplyData) {
if (!replySize || !pReplyData) {
- ALOGE("%s parameter invalid %p %p", __func__, replySize, pReplyData);
+ ALOGE("%s parameter invalid, replySize %s pReplyData %p", __func__,
+ numericPointerToString(replySize).c_str(), pReplyData);
return BAD_VALUE;
}
@@ -268,7 +280,8 @@
const void* pCmdData __unused,
uint32_t* replySize, void* pReplyData) {
if (!replySize || !pReplyData) {
- ALOGE("%s parameter invalid %p %p", __func__, replySize, pReplyData);
+ ALOGE("%s parameter invalid, replySize %s pReplyData %p", __func__,
+ numericPointerToString(replySize).c_str(), pReplyData);
return BAD_VALUE;
}
@@ -278,8 +291,8 @@
status_t EffectConversionHelperAidl::handleSetAudioSource(uint32_t cmdSize, const void* pCmdData,
uint32_t* replySize, void* pReplyData) {
if (cmdSize != sizeof(uint32_t) || !pCmdData || !replySize || !pReplyData) {
- ALOGE("%s parameter invalid %u %p %p %p", __func__, cmdSize, pCmdData, replySize,
- pReplyData);
+ ALOGE("%s parameter invalid, cmdSize %u pCmdData %p replySize %s pReplyData %p", __func__,
+ cmdSize, pCmdData, numericPointerToString(replySize).c_str(), pReplyData);
return BAD_VALUE;
}
if (!getDescriptor().common.flags.audioSourceIndication) {
@@ -298,8 +311,8 @@
status_t EffectConversionHelperAidl::handleSetAudioMode(uint32_t cmdSize, const void* pCmdData,
uint32_t* replySize, void* pReplyData) {
if (cmdSize != sizeof(uint32_t) || !pCmdData || !replySize || !pReplyData) {
- ALOGE("%s parameter invalid %u %p %p %p", __func__, cmdSize, pCmdData, replySize,
- pReplyData);
+ ALOGE("%s parameter invalid, cmdSize %u pCmdData %p replySize %s pReplyData %p", __func__,
+ cmdSize, pCmdData, numericPointerToString(replySize).c_str(), pReplyData);
return BAD_VALUE;
}
if (!getDescriptor().common.flags.audioModeIndication) {
@@ -317,8 +330,8 @@
status_t EffectConversionHelperAidl::handleSetDevice(uint32_t cmdSize, const void* pCmdData,
uint32_t* replySize, void* pReplyData) {
if (cmdSize != sizeof(uint32_t) || !pCmdData || !replySize || !pReplyData) {
- ALOGE("%s parameter invalid %u %p %p %p", __func__, cmdSize, pCmdData, replySize,
- pReplyData);
+ ALOGE("%s parameter invalid, cmdSize %u pCmdData %p replySize %s pReplyData %p", __func__,
+ cmdSize, pCmdData, numericPointerToString(replySize).c_str(), pReplyData);
return BAD_VALUE;
}
if (!getDescriptor().common.flags.deviceIndication) {
@@ -354,21 +367,27 @@
}
constexpr uint32_t unityGain = 1 << 24;
- Parameter::VolumeStereo requestedVolume = {.left = (float)(*(uint32_t*)pCmdData) / unityGain,
- .right = (float)(*(uint32_t*)pCmdData + 1) / unityGain};
-
+ uint32_t vl = *(uint32_t*)pCmdData;
+ uint32_t vr = *((uint32_t*)pCmdData + 1);
RETURN_STATUS_IF_ERROR(statusTFromBinderStatus(
- mEffect->setParameter(Parameter::make<Parameter::volumeStereo>(requestedVolume))));
+ mEffect->setParameter(Parameter::make<Parameter::volumeStereo>(Parameter::VolumeStereo(
+ {.left = (float)vl / unityGain, .right = (float)vr / unityGain})))));
- // get volume from effect and set if changed.
+ // get volume from effect and set if changed, return the volume in command if HAL not return
+ // correct parameter.
Parameter::Id id = Parameter::Id::make<Parameter::Id::commonTag>(Parameter::volumeStereo);
Parameter volParam;
- RETURN_STATUS_IF_ERROR(statusTFromBinderStatus(mEffect->getParameter(id, &volParam)));
- Parameter::VolumeStereo appliedVolume = volParam.get<Parameter::volumeStereo>();
+ const status_t getParamStatus = statusTFromBinderStatus(mEffect->getParameter(id, &volParam));
+ if (getParamStatus != OK || volParam.getTag() != Parameter::volumeStereo) {
+ ALOGW("%s no valid volume return from HAL, status %d: %s, return volume in command",
+ __func__, getParamStatus, volParam.toString().c_str());
+ } else {
+ Parameter::VolumeStereo appliedVolume = volParam.get<Parameter::volumeStereo>();
+ vl = (uint32_t)(appliedVolume.left * unityGain);
+ vr = (uint32_t)(appliedVolume.right * unityGain);
+ }
if (replySize && *replySize == 2 * sizeof(uint32_t) && pReplyData) {
- uint32_t vl = (uint32_t)(appliedVolume.left * unityGain);
- uint32_t vr = (uint32_t)(appliedVolume.right * unityGain);
uint32_t vol_ret[2] = {vl, vr};
memcpy(pReplyData, vol_ret, sizeof(vol_ret));
}
@@ -378,8 +397,8 @@
status_t EffectConversionHelperAidl::handleSetOffload(uint32_t cmdSize, const void* pCmdData,
uint32_t* replySize, void* pReplyData) {
if (cmdSize < sizeof(effect_offload_param_t) || !pCmdData || !replySize || !pReplyData) {
- ALOGE("%s parameter invalid %u %p %p %p", __func__, cmdSize, pCmdData, replySize,
- pReplyData);
+ ALOGE("%s parameter invalid, cmdSize %u pCmdData %p replySize %s pReplyData %p", __func__,
+ cmdSize, pCmdData, numericPointerToString(replySize).c_str(), pReplyData);
return BAD_VALUE;
}
effect_offload_param_t* offload = (effect_offload_param_t*)pCmdData;
@@ -411,7 +430,8 @@
uint32_t* replySize,
void* pReplyData) {
if (!replySize || !pReplyData) {
- ALOGE("%s parameter invalid %p %p", __func__, replySize, pReplyData);
+ ALOGE("%s parameter invalid replySize %s pReplyData %p", __func__,
+ numericPointerToString(replySize).c_str(), pReplyData);
return BAD_VALUE;
}
@@ -431,7 +451,8 @@
uint32_t* replySize,
void* pReplyData) {
if (!replySize || !pReplyData) {
- ALOGE("%s parameter invalid %p %p", __func__, replySize, pReplyData);
+ ALOGE("%s parameter invalid, replySize %s pReplyData %p", __func__,
+ numericPointerToString(replySize).c_str(), pReplyData);
return BAD_VALUE;
}
diff --git a/media/libaudiohal/impl/EffectConversionHelperAidl.h b/media/libaudiohal/impl/EffectConversionHelperAidl.h
index b671a24..5db334c 100644
--- a/media/libaudiohal/impl/EffectConversionHelperAidl.h
+++ b/media/libaudiohal/impl/EffectConversionHelperAidl.h
@@ -75,6 +75,11 @@
static constexpr int kDefaultframeCount = 0x100;
+ template <typename T, typename = std::enable_if_t<std::is_arithmetic_v<T>>>
+ static inline std::string numericPointerToString(T* pt) {
+ return pt ? std::to_string(*pt) : "nullptr";
+ }
+
using AudioChannelLayout = aidl::android::media::audio::common::AudioChannelLayout;
const aidl::android::media::audio::common::AudioConfig kDefaultAudioConfig = {
.base = {.sampleRate = 44100,
diff --git a/media/libaudiohal/impl/StreamHalAidl.cpp b/media/libaudiohal/impl/StreamHalAidl.cpp
index f9aea37..c058386 100644
--- a/media/libaudiohal/impl/StreamHalAidl.cpp
+++ b/media/libaudiohal/impl/StreamHalAidl.cpp
@@ -840,7 +840,7 @@
parameters, String8(AudioParameter::keyOffloadCodecDelaySamples),
[&](int value) {
// The legacy keys are misnamed, the value is in frames.
- return value > 0 ? mOffloadMetadata.delayFrames = value, OK : BAD_VALUE;
+ return value >= 0 ? mOffloadMetadata.delayFrames = value, OK : BAD_VALUE;
}))) {
updateMetadata = true;
}
@@ -848,7 +848,7 @@
parameters, String8(AudioParameter::keyOffloadCodecPaddingSamples),
[&](int value) {
// The legacy keys are misnamed, the value is in frames.
- return value > 0 ? mOffloadMetadata.paddingFrames = value, OK : BAD_VALUE;
+ return value >= 0 ? mOffloadMetadata.paddingFrames = value, OK : BAD_VALUE;
}))) {
updateMetadata = true;
}
diff --git a/media/libaudiohal/impl/effectsAidlConversion/AidlConversionDynamicsProcessing.cpp b/media/libaudiohal/impl/effectsAidlConversion/AidlConversionDynamicsProcessing.cpp
index 89f8b83..f77c093 100644
--- a/media/libaudiohal/impl/effectsAidlConversion/AidlConversionDynamicsProcessing.cpp
+++ b/media/libaudiohal/impl/effectsAidlConversion/AidlConversionDynamicsProcessing.cpp
@@ -227,7 +227,7 @@
RETURN_IF_ERROR(param.readFromValue(&enable));
return DynamicsProcessing::ChannelConfig(
- {.enable = VALUE_OR_RETURN(convertIntegral<bool>(enable)), .channel = channel});
+ {.channel = channel, .enable = VALUE_OR_RETURN(convertIntegral<bool>(enable))});
}
ConversionResult<DynamicsProcessing::EqBandConfig>
diff --git a/media/libmedia/include/media/mediametadataretriever.h b/media/libmedia/include/media/mediametadataretriever.h
index fba1a30..9074574 100644
--- a/media/libmedia/include/media/mediametadataretriever.h
+++ b/media/libmedia/include/media/mediametadataretriever.h
@@ -96,13 +96,19 @@
status_t setDataSource(
const sp<IDataSource>& dataSource, const char *mime = NULL);
sp<IMemory> getFrameAtTime(int64_t timeUs, int option,
- int colorFormat = HAL_PIXEL_FORMAT_RGB_565, bool metaOnly = false);
+ int colorFormat, bool metaOnly = false);
+ sp<IMemory> getFrameAtTime(int64_t timeUs, int option,
+ bool metaOnly = false);
sp<IMemory> getImageAtIndex(int index,
- int colorFormat = HAL_PIXEL_FORMAT_RGB_565, bool metaOnly = false, bool thumbnail = false);
+ int colorFormat, bool metaOnly = false, bool thumbnail = false);
+ sp<IMemory> getImageAtIndex(int index,
+ bool metaOnly = false, bool thumbnail = false);
sp<IMemory> getImageRectAtIndex(
int index, int colorFormat, int left, int top, int right, int bottom);
sp<IMemory> getFrameAtIndex(
- int index, int colorFormat = HAL_PIXEL_FORMAT_RGB_565, bool metaOnly = false);
+ int index, int colorFormat, bool metaOnly = false);
+ sp<IMemory> getFrameAtIndex(
+ int index, bool metaOnly = false);
sp<IMemory> extractAlbumArt();
const char* extractMetadata(int keyCode);
diff --git a/media/libmedia/mediametadataretriever.cpp b/media/libmedia/mediametadataretriever.cpp
index 2ae76b3..427a3bd 100644
--- a/media/libmedia/mediametadataretriever.cpp
+++ b/media/libmedia/mediametadataretriever.cpp
@@ -142,6 +142,11 @@
}
sp<IMemory> MediaMetadataRetriever::getFrameAtTime(
+ int64_t timeUs, int option, bool metaOnly) {
+ return getFrameAtTime(timeUs, option, HAL_PIXEL_FORMAT_RGB_565, metaOnly);
+}
+
+sp<IMemory> MediaMetadataRetriever::getFrameAtTime(
int64_t timeUs, int option, int colorFormat, bool metaOnly)
{
ALOGV("getFrameAtTime: time(%" PRId64 " us) option(%d) colorFormat(%d) metaOnly(%d)",
@@ -155,6 +160,11 @@
}
sp<IMemory> MediaMetadataRetriever::getImageAtIndex(
+ int index, bool metaOnly, bool thumbnail) {
+ return getImageAtIndex(index, HAL_PIXEL_FORMAT_RGB_565, metaOnly, thumbnail);
+}
+
+sp<IMemory> MediaMetadataRetriever::getImageAtIndex(
int index, int colorFormat, bool metaOnly, bool thumbnail) {
ALOGV("getImageAtIndex: index(%d) colorFormat(%d) metaOnly(%d) thumbnail(%d)",
index, colorFormat, metaOnly, thumbnail);
@@ -180,6 +190,11 @@
}
sp<IMemory> MediaMetadataRetriever::getFrameAtIndex(
+ int index, bool metaOnly) {
+ return getFrameAtIndex(index, HAL_PIXEL_FORMAT_RGB_565, metaOnly);
+}
+
+sp<IMemory> MediaMetadataRetriever::getFrameAtIndex(
int index, int colorFormat, bool metaOnly) {
ALOGV("getFrameAtIndex: index(%d), colorFormat(%d) metaOnly(%d)",
index, colorFormat, metaOnly);
diff --git a/media/libstagefright/MediaCodec.cpp b/media/libstagefright/MediaCodec.cpp
index 8be9c48..5c9f68e 100644
--- a/media/libstagefright/MediaCodec.cpp
+++ b/media/libstagefright/MediaCodec.cpp
@@ -1609,23 +1609,21 @@
mFramesInput++;
}
- const int64_t nowNs = systemTime(SYSTEM_TIME_MONOTONIC);
- BufferFlightTiming_t startdata = { presentationUs, nowNs };
+ // mutex access to mBuffersInFlight and other stats
+ Mutex::Autolock al(mLatencyLock);
- {
- // mutex access to mBuffersInFlight and other stats
- Mutex::Autolock al(mLatencyLock);
-
-
- // XXX: we *could* make sure that the time is later than the end of queue
- // as part of a consistency check...
+ // XXX: we *could* make sure that the time is later than the end of queue
+ // as part of a consistency check...
+ if (!mTunneled) {
+ const int64_t nowNs = systemTime(SYSTEM_TIME_MONOTONIC);
+ BufferFlightTiming_t startdata = { presentationUs, nowNs };
mBuffersInFlight.push_back(startdata);
-
- if (mIsLowLatencyModeOn && mIndexOfFirstFrameWhenLowLatencyOn < 0) {
- mIndexOfFirstFrameWhenLowLatencyOn = mInputBufferCounter;
- }
- ++mInputBufferCounter;
}
+
+ if (mIsLowLatencyModeOn && mIndexOfFirstFrameWhenLowLatencyOn < 0) {
+ mIndexOfFirstFrameWhenLowLatencyOn = mInputBufferCounter;
+ }
+ ++mInputBufferCounter;
}
// when we get a buffer back from the codec
diff --git a/media/libstagefright/exports.lds b/media/libstagefright/exports.lds
index 7fe6d6c..ee38550 100644
--- a/media/libstagefright/exports.lds
+++ b/media/libstagefright/exports.lds
@@ -171,7 +171,6 @@
FixedDiv1_C;
FixedDiv_C;
fixed_invtbl8;
- GetARGBBlend;
H420ToABGR;
H420ToARGB;
H422ToABGR;
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 6aafa07..da9a900 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -1801,7 +1801,7 @@
config->type = AUDIO_PORT_TYPE_MIX;
config->ext.mix.handle = mId;
config->sample_rate = mSampleRate;
- config->format = mFormat;
+ config->format = mHALFormat;
config->channel_mask = mChannelMask;
config->config_mask = AUDIO_PORT_CONFIG_SAMPLE_RATE|AUDIO_PORT_CONFIG_CHANNEL_MASK|
AUDIO_PORT_CONFIG_FORMAT;
@@ -6167,12 +6167,11 @@
// Ensure volumeshaper state always advances even when muted.
const sp<AudioTrackServerProxy> proxy = track->mAudioTrackServerProxy;
- const size_t framesReleased = proxy->framesReleased();
const int64_t frames = mTimestamp.mPosition[ExtendedTimestamp::LOCATION_KERNEL];
const int64_t time = mTimestamp.mTimeNs[ExtendedTimestamp::LOCATION_KERNEL];
- ALOGV("%s: Direct/Offload bufferConsumed:%zu timestamp frames:%lld time:%lld",
- __func__, framesReleased, (long long)frames, (long long)time);
+ ALOGVV("%s: Direct/Offload bufferConsumed:%zu timestamp frames:%lld time:%lld",
+ __func__, proxy->framesReleased(), (long long)frames, (long long)time);
const int64_t volumeShaperFrames =
mMonotonicFrameCounter.updateAndGetMonotonicFrameCount(frames, time);
@@ -9238,6 +9237,7 @@
Mutex::Autolock _l(mLock);
AudioStreamIn *input = mInput;
mInput = NULL;
+ mInputSource.clear();
return input;
}
diff --git a/services/camera/libcameraservice/common/CameraProviderManager.h b/services/camera/libcameraservice/common/CameraProviderManager.h
index 98298ea..7f3130e 100644
--- a/services/camera/libcameraservice/common/CameraProviderManager.h
+++ b/services/camera/libcameraservice/common/CameraProviderManager.h
@@ -86,6 +86,7 @@
};
#define CAMERA_DEVICE_API_VERSION_1_0 HARDWARE_DEVICE_API_VERSION(1, 0)
+#define CAMERA_DEVICE_API_VERSION_1_2 HARDWARE_DEVICE_API_VERSION(1, 2)
#define CAMERA_DEVICE_API_VERSION_3_0 HARDWARE_DEVICE_API_VERSION(3, 0)
#define CAMERA_DEVICE_API_VERSION_3_1 HARDWARE_DEVICE_API_VERSION(3, 1)
#define CAMERA_DEVICE_API_VERSION_3_2 HARDWARE_DEVICE_API_VERSION(3, 2)
diff --git a/services/camera/libcameraservice/device3/Camera3Device.cpp b/services/camera/libcameraservice/device3/Camera3Device.cpp
index f7a3cc7..4344902 100644
--- a/services/camera/libcameraservice/device3/Camera3Device.cpp
+++ b/services/camera/libcameraservice/device3/Camera3Device.cpp
@@ -51,6 +51,7 @@
#include <cutils/properties.h>
#include <camera/StringUtils.h>
+#include <android-base/properties.h>
#include <android/hardware/camera/device/3.7/ICameraInjectionSession.h>
#include <android/hardware/camera2/ICameraDeviceUser.h>
@@ -277,13 +278,6 @@
}
}
}
- // Signal to request thread that we're not expecting any
- // more requests. This will be true since once we're in
- // disconnect and we've cleared off the request queue, the
- // request thread can't receive any new requests through
- // binder calls - since disconnect holds
- // mBinderSerialization lock.
- mRequestThread->setRequestClearing();
}
if (mStatus == STATUS_ERROR) {
@@ -756,8 +750,7 @@
auto firstRequest = requestList->begin();
for (auto& outputStream : (*firstRequest)->mOutputStreams) {
if (outputStream->isVideoStream()) {
- (*firstRequest)->mBatchSize = requestList->size();
- outputStream->setBatchSize(requestList->size());
+ applyMaxBatchSizeLocked(requestList, outputStream);
break;
}
}
@@ -2254,6 +2247,9 @@
Mutex::Autolock il(mInterfaceLock);
nsecs_t maxExpectedDuration = getExpectedInFlightDuration();
+ // Make sure status tracker is flushed
+ mStatusTracker->flushPendingStates();
+
Mutex::Autolock l(mLock);
if (checkAbandonedStreamsLocked()) {
ALOGW("%s: Abandoned stream detected, session parameters can't be applied correctly!",
@@ -2941,7 +2937,6 @@
mRotateAndCropOverride(ANDROID_SCALER_ROTATE_AND_CROP_NONE),
mComposerOutput(false),
mCameraMute(ANDROID_SENSOR_TEST_PATTERN_MODE_OFF),
- mCameraMuteChanged(false),
mRepeatingLastFrameNumber(
hardware::camera2::ICameraDeviceUser::NO_IN_FLIGHT_REPEATING_FRAMES),
mPrepareVideoStream(false),
@@ -3196,8 +3191,12 @@
}
void Camera3Device::RequestThread::requestExit() {
- // Call parent to set up shutdown
- Thread::requestExit();
+ {
+ Mutex::Autolock l(mRequestLock);
+ mRequestClearing = true;
+ // Call parent to set up shutdown
+ Thread::requestExit();
+ }
// The exit from any possible waits
mDoPauseSignal.signal();
mRequestSignal.signal();
@@ -4110,7 +4109,6 @@
Mutex::Autolock l(mTriggerMutex);
if (muteMode != mCameraMute) {
mCameraMute = muteMode;
- mCameraMuteChanged = true;
}
return OK;
}
@@ -4285,11 +4283,6 @@
return;
}
-void Camera3Device::RequestThread::setRequestClearing() {
- Mutex::Autolock l(mRequestLock);
- mRequestClearing = true;
-}
-
sp<Camera3Device::CaptureRequest>
Camera3Device::RequestThread::waitForNextRequestLocked() {
status_t res;
diff --git a/services/camera/libcameraservice/device3/Camera3Device.h b/services/camera/libcameraservice/device3/Camera3Device.h
index 7b89f9f..7243fc0 100644
--- a/services/camera/libcameraservice/device3/Camera3Device.h
+++ b/services/camera/libcameraservice/device3/Camera3Device.h
@@ -656,6 +656,15 @@
status_t initializeCommonLocked();
/**
+ * Update capture request list so that each batch size honors the batch_size_max report from
+ * the HAL. Set the batch size to output stream for buffer operations.
+ *
+ * Must be called with mLock held.
+ */
+ virtual void applyMaxBatchSizeLocked(
+ RequestList* requestList, const sp<camera3::Camera3OutputStreamInterface>& stream) = 0;
+
+ /**
* Get the last request submitted to the hal by the request thread.
*
* Must be called with mLock held.
@@ -878,9 +887,6 @@
*/
void setPaused(bool paused);
- // set mRequestClearing - no new requests are expected to be queued to RequestThread
- void setRequestClearing();
-
/**
* Wait until thread processes the capture request with settings'
* android.request.id == requestId.
@@ -1088,7 +1094,6 @@
camera_metadata_enum_android_scaler_rotate_and_crop_t mRotateAndCropOverride;
bool mComposerOutput;
int32_t mCameraMute; // 0 = no mute, otherwise the TEST_PATTERN_MODE to use
- bool mCameraMuteChanged;
int64_t mRepeatingLastFrameNumber;
diff --git a/services/camera/libcameraservice/device3/StatusTracker.cpp b/services/camera/libcameraservice/device3/StatusTracker.cpp
index bd78e0a..f13109a 100644
--- a/services/camera/libcameraservice/device3/StatusTracker.cpp
+++ b/services/camera/libcameraservice/device3/StatusTracker.cpp
@@ -34,7 +34,8 @@
mParent(parent),
mNextComponentId(0),
mIdleFence(new Fence()),
- mDeviceState(IDLE) {
+ mDeviceState(IDLE),
+ mFlushed(true) {
}
StatusTracker::~StatusTracker() {
@@ -111,16 +112,33 @@
const sp<Fence>& componentFence) {
ALOGV("%s: Component %d is now %s", __FUNCTION__, id,
state == IDLE ? "idle" : "active");
- Mutex::Autolock l(mPendingLock);
- StateChange newState = {
- id,
- state,
- componentFence
- };
+ // If any component state changes, the status tracker is considered
+ // not flushed.
+ {
+ Mutex::Autolock l(mFlushLock);
+ mFlushed = false;
+ }
- mPendingChangeQueue.add(newState);
- mPendingChangeSignal.signal();
+ {
+ Mutex::Autolock l(mPendingLock);
+
+ StateChange newState = {
+ id,
+ state,
+ componentFence
+ };
+
+ mPendingChangeQueue.add(newState);
+ mPendingChangeSignal.signal();
+ }
+}
+
+void StatusTracker::flushPendingStates() {
+ Mutex::Autolock l(mFlushLock);
+ while (!mFlushed && isRunning()) {
+ mFlushCondition.waitRelative(mFlushLock, kWaitDuration);
+ }
}
void StatusTracker::requestExit() {
@@ -128,6 +146,7 @@
Thread::requestExit();
// Then exit any waits
mPendingChangeSignal.signal();
+ mFlushCondition.signal();
}
StatusTracker::ComponentState StatusTracker::getDeviceStateLocked() {
@@ -231,6 +250,17 @@
}
mStateTransitions.clear();
+ // After all pending changes are cleared and notified, mark the tracker
+ // as flushed.
+ {
+ Mutex::Autolock fl(mFlushLock);
+ Mutex::Autolock pl(mPendingLock);
+ if (mPendingChangeQueue.size() == 0) {
+ mFlushed = true;
+ mFlushCondition.signal();
+ }
+ }
+
if (waitForIdleFence) {
auto ret = mIdleFence->wait(kWaitDuration);
if (ret == NO_ERROR) {
diff --git a/services/camera/libcameraservice/device3/StatusTracker.h b/services/camera/libcameraservice/device3/StatusTracker.h
index 069bff6..fc65502 100644
--- a/services/camera/libcameraservice/device3/StatusTracker.h
+++ b/services/camera/libcameraservice/device3/StatusTracker.h
@@ -70,6 +70,10 @@
void dumpActiveComponents();
+ // Flush all pending states inflight in the tracker, and return upon
+ // completion.
+ void flushPendingStates();
+
virtual void requestExit();
protected:
@@ -113,6 +117,11 @@
// Current overall device state
ComponentState mDeviceState;
+ // For flushing all pending states transitions
+ bool mFlushed;
+ Mutex mFlushLock;
+ Condition mFlushCondition;
+
// Private to threadLoop
// Determine current overall device state
diff --git a/services/camera/libcameraservice/device3/aidl/AidlCamera3Device.cpp b/services/camera/libcameraservice/device3/aidl/AidlCamera3Device.cpp
index 1f9313e..1f2ac23 100644
--- a/services/camera/libcameraservice/device3/aidl/AidlCamera3Device.cpp
+++ b/services/camera/libcameraservice/device3/aidl/AidlCamera3Device.cpp
@@ -51,6 +51,7 @@
#include <aidl/android/hardware/camera/device/ICameraInjectionSession.h>
#include <aidlcommonsupport/NativeHandle.h>
+#include <android-base/properties.h>
#include <android/binder_ibinder_platform.h>
#include <android/hardware/camera2/ICameraDeviceUser.h>
#include <camera/StringUtils.h>
@@ -309,6 +310,20 @@
}
}
+ // batch size limit is applied to the device with camera device version larger than 3.2 which is
+ // AIDL v2
+ hardware::hidl_version maxVersion{0, 0};
+ IPCTransport transport = IPCTransport::AIDL;
+ res = manager->getHighestSupportedVersion(mId, &maxVersion, &transport);
+ if (res != OK) {
+ ALOGE("%s: Error in getting camera device version id: %s (%d)", __FUNCTION__,
+ strerror(-res), res);
+ return res;
+ }
+ int deviceVersion = HARDWARE_DEVICE_API_VERSION(maxVersion.get_major(), maxVersion.get_minor());
+
+ mBatchSizeLimitEnabled = (deviceVersion >= CAMERA_DEVICE_API_VERSION_1_2);
+
return initializeCommonLocked();
}
@@ -1572,6 +1587,66 @@
return OK;
}
+void AidlCamera3Device::applyMaxBatchSizeLocked(
+ RequestList* requestList, const sp<camera3::Camera3OutputStreamInterface>& stream) {
+ int batchSize = requestList->size();
+
+ if (!mBatchSizeLimitEnabled) {
+ (*requestList->begin())->mBatchSize = batchSize;
+ stream->setBatchSize(batchSize);
+ return;
+ }
+
+ const auto& metadata = (*requestList->begin())->mSettingsList.begin()->metadata;
+
+ uint32_t tag = ANDROID_CONTROL_AVAILABLE_HIGH_SPEED_VIDEO_CONFIGURATIONS;
+ auto sensorPixelModeEntry = metadata.find(ANDROID_SENSOR_PIXEL_MODE);
+ if (sensorPixelModeEntry.count != 0) {
+ if (ANDROID_SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION == sensorPixelModeEntry.data.u8[0]) {
+ tag = ANDROID_CONTROL_AVAILABLE_HIGH_SPEED_VIDEO_CONFIGURATIONS_MAXIMUM_RESOLUTION;
+ }
+ }
+
+ const auto fpsRange = metadata.find(ANDROID_CONTROL_AE_TARGET_FPS_RANGE);
+ if (fpsRange.count > 1) {
+ auto configEntry = mDeviceInfo.find(tag);
+ for (size_t index = 4; index < configEntry.count; index += 5) {
+ if (stream->getWidth() == static_cast<uint32_t>(configEntry.data.i32[index - 4]) &&
+ stream->getHeight() == static_cast<uint32_t>(configEntry.data.i32[index - 3]) &&
+ fpsRange.data.i32[0] == configEntry.data.i32[index - 2] &&
+ fpsRange.data.i32[1] == configEntry.data.i32[index - 1]) {
+ const int maxBatchSize = configEntry.data.i32[index - 1] / 30;
+ const int reportedSize = configEntry.data.i32[index];
+
+ if (maxBatchSize % reportedSize == 0 && requestList->size() % reportedSize == 0) {
+ batchSize = reportedSize;
+ ALOGVV("Matching high speed configuration found. Limit batch size to %d",
+ batchSize);
+ } else if (maxBatchSize % reportedSize == 0 &&
+ reportedSize % requestList->size() == 0) {
+ ALOGVV("Matching high speed configuration found, but requested batch size is "
+ "divisor of batch_size_max. No need to limit batch size.");
+ } else {
+ ALOGW("Matching high speed configuration found, but batch_size_max is not a "
+ "divisor of corresponding fps_max/30 or requested batch size is not a "
+ "divisor of batch_size_max, (fps_max %d, batch_size_max %d, requested "
+ "batch size %zu)",
+ configEntry.data.i32[index - 1], reportedSize, requestList->size());
+ }
+ break;
+ }
+ }
+ }
+
+ for (auto request = requestList->begin(); request != requestList->end(); request++) {
+ if (requestList->distance(requestList->begin(), request) % batchSize == 0) {
+ (*request)->mBatchSize = batchSize;
+ }
+ }
+
+ stream->setBatchSize(batchSize);
+}
+
status_t AidlCamera3Device::injectionCameraInitialize(const std::string &injectedCamId,
sp<CameraProviderManager> manager) {
return (static_cast<AidlCamera3DeviceInjectionMethods *>
diff --git a/services/camera/libcameraservice/device3/aidl/AidlCamera3Device.h b/services/camera/libcameraservice/device3/aidl/AidlCamera3Device.h
index f4554d4..4d7d139 100644
--- a/services/camera/libcameraservice/device3/aidl/AidlCamera3Device.h
+++ b/services/camera/libcameraservice/device3/aidl/AidlCamera3Device.h
@@ -252,6 +252,10 @@
};
private:
+ virtual void applyMaxBatchSizeLocked(
+ RequestList* requestList,
+ const sp<camera3::Camera3OutputStreamInterface>& stream) override;
+
virtual status_t injectionCameraInitialize(const std::string &injectCamId,
sp<CameraProviderManager> manager) override;
@@ -271,6 +275,9 @@
std::shared_ptr<AidlCameraDeviceCallbacks> mCallbacks = nullptr;
+ // Whether the batch_size_max field in the high speed configuration actually applied to
+ // capture requests.
+ bool mBatchSizeLimitEnabled = false;
}; // class AidlCamera3Device
diff --git a/services/camera/libcameraservice/device3/hidl/HidlCamera3Device.cpp b/services/camera/libcameraservice/device3/hidl/HidlCamera3Device.cpp
index c22aad6..d234d83 100644
--- a/services/camera/libcameraservice/device3/hidl/HidlCamera3Device.cpp
+++ b/services/camera/libcameraservice/device3/hidl/HidlCamera3Device.cpp
@@ -699,6 +699,14 @@
// Java side to make sure the CameraCaptureSession is properly closed
}
+void HidlCamera3Device::applyMaxBatchSizeLocked(
+ RequestList* requestList, const sp<camera3::Camera3OutputStreamInterface>& stream) {
+ int batchSize = requestList->size();
+
+ (*requestList->begin())->mBatchSize = batchSize;
+ stream->setBatchSize(batchSize);
+}
+
sp<Camera3Device::RequestThread> HidlCamera3Device::createNewRequestThread(
wp<Camera3Device> parent, sp<camera3::StatusTracker> statusTracker,
sp<Camera3Device::HalInterface> interface,
diff --git a/services/camera/libcameraservice/device3/hidl/HidlCamera3Device.h b/services/camera/libcameraservice/device3/hidl/HidlCamera3Device.h
index e64bcf0..2d33277 100644
--- a/services/camera/libcameraservice/device3/hidl/HidlCamera3Device.h
+++ b/services/camera/libcameraservice/device3/hidl/HidlCamera3Device.h
@@ -213,6 +213,10 @@
hardware::Return<void> notifyHelper(
const hardware::hidl_vec<NotifyMsgType>& msgs);
+ virtual void applyMaxBatchSizeLocked(
+ RequestList* requestList,
+ const sp<camera3::Camera3OutputStreamInterface>& stream) override;
+
virtual status_t injectionCameraInitialize(const std::string &injectCamId,
sp<CameraProviderManager> manager) override;