Skip to content

Commit

Permalink
audio: add get_active_micropones() function
Browse files Browse the repository at this point in the history
The Google VTS tests for Android VtsHalAudioV5_0Target(GetMicrophonesTest)
needs to use pointer of function (*get_active_micropones)() which is not
initialized and function in_get_active_microphones() required for initialization
witch is not implemented in tinyhal.

The analysis of the implementation of the audio hal for Qualcomm
(https://android.googlesource.com/platform/hardware/qcom/audio/+/refs/heads/
master/hal/audio_hw.c) and Goldfish
(https://android.googlesource.com/device/generic/goldfish/+/dc18a59%5E%21/)
have been made. The implementation similar to Goldfish(stub) has been chosen as
basic.

Function in_get_active_microphones() was implemented as stub function that will
expand in the future. This function fill array audio_microphone_characteristic_t
with default microphone information.

Signed-off-by: Anton Dehtiarov <anton.dehtiarov@globallogic.com>
  • Loading branch information
AntonDehtiarov committed Sep 29, 2020
1 parent bfb0a28 commit b84e993
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions audio/audio_hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -2080,6 +2080,14 @@ static int adev_get_microphones(const struct audio_hw_device *dev,
}
#endif

#ifdef AUDIO_DEVICE_API_VERSION_5_0
static int in_get_active_microphones(const struct audio_stream_in *stream,
struct audio_microphone_characteristic_t *mic_array,
size_t *mic_count) {
return adev_get_microphones(NULL, mic_array, mic_count);
}
#endif

/*********************************************************************
* Stream open and close
*********************************************************************/
Expand Down Expand Up @@ -2222,6 +2230,10 @@ static int adev_open_input_stream(struct audio_hw_device *dev,

in->common.dev = adev;

#ifdef AUDIO_DEVICE_API_VERSION_5_0
in->common.stream.get_active_microphones = in_get_active_microphones;
#endif

devices &= AUDIO_DEVICE_IN_ALL;
ret = do_init_in_common(&in->common, config, devices);
if (ret < 0) {
Expand Down

0 comments on commit b84e993

Please sign in to comment.