summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2024-02-14 08:30:40 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2024-02-14 08:30:40 +0000
commit745cbb066dbd28882354f4488e25df9618f9b112 (patch)
treecfc0354b2d003766d488c6b8701ea74e874cec40
parente7519a879d0025584bfc7fe3eefcacfda7dea21c (diff)
parente0283c632d005ebe1cae13eeb4a165ed46fb3dc0 (diff)
downloadmedia-745cbb066dbd28882354f4488e25df9618f9b112.tar.gz
Merge "audio: add audio_channel_mask_contains_stereo" into main
-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 826c1a22..2979ba3f 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