From ee148fe88e7b30e5a4379c297db6274cd0ea4157 Mon Sep 17 00:00:00 2001 From: Sungtak Lee Date: Tue, 22 Aug 2023 22:08:34 +0000 Subject: [PATCH] media.c2 aidl: Use IGraphicBufferAllocator for createBlockPool() Add IGraphicBufferAllocator interface as an alternate param for IComponent::createBlockPool(). Bug: 254050314 Test: m Change-Id: Iab3f1eb35287a8ed7c887ceb70c70d936d5bcfa8 --- .../android/hardware/media/c2/IComponent.aidl | 7 +++-- .../android/hardware/media/c2/IComponent.aidl | 28 ++++++++++--------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponent.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponent.aidl index 1af66d0a0a..c7d8a970cf 100644 --- a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponent.aidl +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponent.aidl @@ -35,7 +35,7 @@ package android.hardware.media.c2; @VintfStability interface IComponent { android.hardware.common.NativeHandle configureVideoTunnel(in int avSyncHwId); - android.hardware.media.c2.IComponent.BlockPool createBlockPool(in int allocatorId); + android.hardware.media.c2.IComponent.BlockPool createBlockPool(in android.hardware.media.c2.IComponent.BlockPoolAllocator allocator); void destroyBlockPool(in long blockPoolId); void drain(in boolean withEos); android.hardware.media.c2.WorkBundle flush(); @@ -43,11 +43,14 @@ interface IComponent { void queue(in android.hardware.media.c2.WorkBundle workBundle); void release(); void reset(); - void setDecoderOutputAllocator(in android.hardware.media.c2.IGraphicBufferAllocator allocator); void start(); void stop(); parcelable BlockPool { long blockPoolId; android.hardware.media.c2.IConfigurable configurable; } + union BlockPoolAllocator { + int allocatorId; + android.hardware.media.c2.IGraphicBufferAllocator igba; + } } diff --git a/media/c2/aidl/android/hardware/media/c2/IComponent.aidl b/media/c2/aidl/android/hardware/media/c2/IComponent.aidl index a9fddbb094..a330d46c40 100644 --- a/media/c2/aidl/android/hardware/media/c2/IComponent.aidl +++ b/media/c2/aidl/android/hardware/media/c2/IComponent.aidl @@ -43,6 +43,18 @@ interface IComponent { long blockPoolId; IConfigurable configurable; } + + /** + * Allocator for C2BlockPool. + * + * C2BlockPool will use a C2Allocator which is specified by an id. + * or C2AIDL allocator interface directly. + */ + union BlockPoolAllocator { + int allocatorId; + IGraphicBufferAllocator igba; + } + /** * Configures a component for a tunneled playback mode. * @@ -86,7 +98,8 @@ interface IComponent { * destroyBlockPool(), reset() or release(). reset() and release() must * destroy all `C2BlockPool` objects that have been created. * - * @param allocatorId Id of a `C2Allocator`. + * @param allocator AIDL allocator interface or C2Allocator specifier + * for C2BlockPool * @param out configurable Configuration interface for the created pool. This * must not be null. * @return Created block pool information. This could be used to config/query and @@ -97,7 +110,7 @@ interface IComponent { * - `Status::TIMED_OUT` - The operation cannot be finished in a timely manner. * - `Status::CORRUPTED` - Some unknown error occurred. */ - BlockPool createBlockPool(in int allocatorId); + BlockPool createBlockPool(in BlockPoolAllocator allocator); /** * Destroys a local block pool previously created by createBlockPool(). @@ -231,17 +244,6 @@ interface IComponent { */ void reset(); - /** - * Specify an allocator for decoder output buffer from HAL. - * - * The method will be used once during the life-cycle of a codec instance. - * @param allocator Decoder output buffer allocator from the client - * @throws ServiceSpecificException with one of the following values - * - `Status::CANNOT_DO` - The component does not support allocating from the client. - * - `Status::CORRUPTED` - Some unknown error occurred. - */ - void setDecoderOutputAllocator(in IGraphicBufferAllocator allocator); - /** * Starts the component. *