From 6f315dbfb2288f1c309367efe70bec1628841207 Mon Sep 17 00:00:00 2001 From: Hongwei Wang Date: Thu, 29 Mar 2018 14:27:51 -0700 Subject: Adds audio patch test audio_hw.c is formatted via clang-format and more debug information for audio patch is added Bug: 77147937 Test: releaseAudioPatch(createAudioPatch(String, int, int)) Change-Id: I5cb02557cc5df31a3d33337905601630c5bd525e --- emulator/audio/audio_policy_configuration.xml | 30 +++++++++++++++++++++++++++ emulator/audio/driver/audio_hw.c | 20 ++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/emulator/audio/audio_policy_configuration.xml b/emulator/audio/audio_policy_configuration.xml index 2bc3172..30d20f0 100644 --- a/emulator/audio/audio_policy_configuration.xml +++ b/emulator/audio/audio_policy_configuration.xml @@ -60,6 +60,8 @@ bus6_notification_out bus7_system_sound_out bus0_mic1_in + + bus1_audio_patch_test_in bus0_media_out @@ -116,6 +118,15 @@ samplingRates="48000" channelMasks="AUDIO_CHANNEL_IN_STEREO"/> + + + + + + + + + + + + + + @@ -207,6 +232,11 @@ + + diff --git a/emulator/audio/driver/audio_hw.c b/emulator/audio/driver/audio_hw.c index 24294ca..83d4858 100644 --- a/emulator/audio/driver/audio_hw.c +++ b/emulator/audio/driver/audio_hw.c @@ -1360,11 +1360,31 @@ static int adev_create_audio_patch(struct audio_hw_device *dev, unsigned int num_sinks, const struct audio_port_config *sinks, audio_patch_handle_t *handle) { + // Logging only, no real work is done here + for (int i = 0; i < num_sources; i++) { + ALOGD("%s: source[%d] type=%d address=%s", __func__, i, sources[i].type, + sources[i].type == AUDIO_PORT_TYPE_DEVICE + ? sources[i].ext.device.address + : ""); + } + for (int i = 0; i < num_sinks; i++) { + ALOGD("%s: sink[%d] type=%d address=%s", __func__, i, sinks[i].type, + sinks[i].type == AUDIO_PORT_TYPE_DEVICE ? sinks[i].ext.device.address + : "N/A"); + } + if (num_sources == 1 && num_sinks == 1 && + sources[0].type == AUDIO_PORT_TYPE_DEVICE && + sinks[0].type == AUDIO_PORT_TYPE_DEVICE) { + // The same audio_patch_handle_t will be passed to release_audio_patch + *handle = 42; + ALOGD("%s: handle: %d", __func__, *handle); + } return 0; } static int adev_release_audio_patch(struct audio_hw_device *dev, audio_patch_handle_t handle) { + ALOGD("%s: handle: %d", __func__, handle); return 0; } -- cgit v1.2.3