summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2024-02-14 12:48:39 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2024-02-14 12:48:39 +0000
commit8b1e2fba501037f09637d4d0bf975b744d56f31b (patch)
tree97892b9f9d54777fbc9a8a86b5d4960eba4f3169
parent3f3c7bb6b843e6f1beb2fac5fcefd5a8ff417b3e (diff)
parent745cbb066dbd28882354f4488e25df9618f9b112 (diff)
downloadmedia-8b1e2fba501037f09637d4d0bf975b744d56f31b.tar.gz
Merge "audio: add audio_channel_mask_contains_stereo" into main am: 745cbb066d
Original change: https://android-review.googlesource.com/c/platform/system/media/+/2954025 Change-Id: I1c149d7f8f5f808c37358ee3f89e8df34c58411b Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--audio/include/system/audio.h18
-rw-r--r--audio/include/system/audio_effects/effect_spatializer.h9
2 files changed, 26 insertions, 1 deletions
diff --git a/audio/include/system/audio.h b/audio/include/system/audio.h
index c2c80bb5..ffa8c69d 100644
--- a/audio/include/system/audio.h
+++ b/audio/include/system/audio.h
@@ -332,6 +332,24 @@ static inline CONSTEXPR audio_channel_mask_t audio_channel_mask_from_representat
}
/*
+ * Returns true so long as stereo channels are present in the channel mask.
+ *
+ * This is the minimum constraint for spatialization in Android V.
+ *
+ * Prior to V, AUDIO_CHANNEL_OUT_QUAD was the minimum constraint.
+ * Prior to T, AUDIO_CHANNEL_OUT_5POINT1 was the minimum constraint.
+ *
+ * TODO(b/303920722) rename to audio_is_channel_mask_spatialized() after testing
+ * is complete.
+ * TODO(b/316909431) flagged at caller due to lack of native_bridge flag support.
+ */
+static inline CONSTEXPR bool audio_channel_mask_contains_stereo(audio_channel_mask_t channelMask) {
+ return audio_channel_mask_get_representation(channelMask)
+ == AUDIO_CHANNEL_REPRESENTATION_POSITION
+ && (channelMask & AUDIO_CHANNEL_OUT_STEREO) == AUDIO_CHANNEL_OUT_STEREO;
+}
+
+/*
* Returns true so long as Quadraphonic channels (FL, FR, BL, BR)
* or (FL, FR, SL, SR) are completely specified
* in the channel mask. We expect these 4 channels to be the minimum for
diff --git a/audio/include/system/audio_effects/effect_spatializer.h b/audio/include/system/audio_effects/effect_spatializer.h
index b92bb50d..2035d45f 100644
--- a/audio/include/system/audio_effects/effect_spatializer.h
+++ b/audio/include/system/audio_effects/effect_spatializer.h
@@ -86,7 +86,14 @@ typedef enum
// Set/get the head tracking data connection mode: passes the mode followed by the sensor ID
// on uint32_t
- SPATIALIZER_PARAM_HEADTRACKING_CONNECTION
+ SPATIALIZER_PARAM_HEADTRACKING_CONNECTION,
+ // Set/get the actual input channel mask of the track being spatialized. This is required to
+ // support stereo spatialization (b/303920722) where number of active input channels would be
+ // different from the channel mask received during effect configuration.
+ // Stereo channels will be packed into 5.1 stream where the other 4 channels will contain
+ // silence. The effect can configure spatialization settings accordingly when this parameter is
+ // received.
+ SPATIALIZER_PARAM_INPUT_CHANNEL_MASK,
} t_virtualizer_stage_params;
// See SpatializationLevel.aidl