From 421ca19c147970067b49c57da28fe365d8da8ffc Mon Sep 17 00:00:00 2001 From: Shunkai Yao Date: Wed, 29 Nov 2023 00:27:13 +0000 Subject: [PATCH] Effect AIDL: add AudioTrack metadata as a common parameter for effects Bug: 307368176 Test: m android.hardware.audio.effect-update-api Test: atest --test-mapping hardware/interfaces/audio/aidl Change-Id: I5affc96c09445a425361f326f728b8ef9b04daee --- .../android/hardware/audio/effect/Flags.aidl | 2 ++ .../hardware/audio/effect/Parameter.aidl | 2 ++ .../android/hardware/audio/effect/Flags.aidl | 14 ++++++++++++++ .../hardware/audio/effect/Parameter.aidl | 18 ++++++++++++++++++ 4 files changed, 36 insertions(+) diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Flags.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Flags.aidl index bcbf870fd7..046c220ea0 100644 --- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Flags.aidl +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Flags.aidl @@ -43,6 +43,8 @@ parcelable Flags { boolean audioModeIndication; boolean audioSourceIndication; boolean bypass; + boolean sinkMetadataIndication; + boolean sourceMetadataIndication; @Backing(type="byte") @VintfStability enum Type { INSERT = 0, diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Parameter.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Parameter.aidl index 7313b57c83..ff33c42047 100644 --- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Parameter.aidl +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Parameter.aidl @@ -41,6 +41,8 @@ union Parameter { boolean offload; android.hardware.audio.effect.Parameter.VolumeStereo volumeStereo; android.hardware.audio.effect.Parameter.Specific specific; + android.hardware.audio.common.SinkMetadata sinkMetadata; + android.hardware.audio.common.SourceMetadata sourceMetadata; @VintfStability union Id { android.hardware.audio.effect.VendorExtension vendorEffectTag; diff --git a/audio/aidl/android/hardware/audio/effect/Flags.aidl b/audio/aidl/android/hardware/audio/effect/Flags.aidl index 28685c3e03..70668a39cf 100644 --- a/audio/aidl/android/hardware/audio/effect/Flags.aidl +++ b/audio/aidl/android/hardware/audio/effect/Flags.aidl @@ -144,4 +144,18 @@ parcelable Flags { * Set to true if the effect instance bypass audio data (no processing). */ boolean bypass; + + /** + * Effect instance sets this flag to true if it requires record AudioTrack metadata update. In + * this case the framework must call IEffect.setParameter to notify effect instance when there + * is a change in sinkMetadata. + */ + boolean sinkMetadataIndication; + + /** + * Effect instance sets this flag to true if it requires playback AudioTrack metadata update. In + * this case the framework must call IEffect.setParameter to notify effect instance when there + * is a change in sourceMetadata. + */ + boolean sourceMetadataIndication; } diff --git a/audio/aidl/android/hardware/audio/effect/Parameter.aidl b/audio/aidl/android/hardware/audio/effect/Parameter.aidl index 6ec7226e3f..6fd916133e 100644 --- a/audio/aidl/android/hardware/audio/effect/Parameter.aidl +++ b/audio/aidl/android/hardware/audio/effect/Parameter.aidl @@ -16,6 +16,8 @@ package android.hardware.audio.effect; +import android.hardware.audio.common.SinkMetadata; +import android.hardware.audio.common.SourceMetadata; import android.hardware.audio.effect.AcousticEchoCanceler; import android.hardware.audio.effect.AutomaticGainControlV1; import android.hardware.audio.effect.AutomaticGainControlV2; @@ -198,4 +200,20 @@ union Parameter { Spatializer spatializer; } Specific specific; + + /** + * SinkMetadata defines the metadata of record AudioTracks which the effect instance associate + * with. + * The effect engine is required to set Flags.sinkMetadataIndication to true if it wants to + * receive sinkMetadata update from the audio framework. + */ + SinkMetadata sinkMetadata; + + /** + * SourceMetadata defines the metadata of playback AudioTracks which the effect instance + * associate with. + * The effect engine is required to set Flags.sourceMetadataIndication to true if it wants to + * receive sourceMetadata update from the audio framework. + */ + SourceMetadata sourceMetadata; }