summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-05-10 07:08:39 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-05-10 07:08:39 +0000
commit204e1ffe2fbfc87ca8893b460de62d3ff38d302c (patch)
tree6f60013f9f2a1725a517962d338a85f64f9b76a1
parent35e2e0a9d2d5017f639e23ce8eb230412196bb8a (diff)
parent3b1b64ea2d8b3afc06eb6b8d15c854706162da8a (diff)
downloadaudio-android13-mainline-sdkext-release.tar.gz
Change-Id: Ibfd3941c70c477399e10a58d1dcca791e5dea387
-rw-r--r--METADATA4
-rw-r--r--OWNERS2
-rw-r--r--hal/Android.mk4
-rw-r--r--hal/audio_extn/a2dp.c1
-rw-r--r--hal/audio_extn/maxxaudio.c1
-rw-r--r--hal/audio_extn/usb.c4
-rw-r--r--hal/audio_hw.c93
-rw-r--r--hal/audio_hw.h1
-rw-r--r--hal/msm8974/platform.c1
-rw-r--r--legacy/alsa_sound/Android.mk9
-rw-r--r--legacy/libalsa-intf/Android.mk10
-rw-r--r--post_proc/Android.mk6
-rw-r--r--visualizer/Android.mk3
-rw-r--r--voice_processing/Android.mk2
14 files changed, 93 insertions, 48 deletions
diff --git a/METADATA b/METADATA
new file mode 100644
index 0000000..77043d3
--- /dev/null
+++ b/METADATA
@@ -0,0 +1,4 @@
+third_party {
+ license_note: "would be NOTICE save for legacy/libalsa-intf/alsa_ucm.h"
+ license_type: RESTRICTED
+}
diff --git a/OWNERS b/OWNERS
index d65f614..15bc50d 100644
--- a/OWNERS
+++ b/OWNERS
@@ -1,5 +1,5 @@
# Default code reviewers picked from top 3 or more developers.
# Please update this list if you find better candidates.
hunga@google.com
-krocard@google.com
+mnaganov@google.com
elaurent@google.com
diff --git a/hal/Android.mk b/hal/Android.mk
index eb806be..b9b64b1 100644
--- a/hal/Android.mk
+++ b/hal/Android.mk
@@ -226,7 +226,7 @@ endif
LOCAL_SHARED_LIBRARIES += libbase libhidlbase libutils android.hardware.power@1.2 liblog
-LOCAL_SHARED_LIBRARIES += android.hardware.power-ndk_platform
+LOCAL_SHARED_LIBRARIES += android.hardware.power-V1-ndk
LOCAL_SHARED_LIBRARIES += libbinder_ndk
LOCAL_SRC_FILES += audio_perf.cpp
@@ -234,6 +234,8 @@ LOCAL_SRC_FILES += audio_perf.cpp
LOCAL_HEADER_LIBRARIES += libhardware_headers
LOCAL_MODULE := audio.primary.$(TARGET_BOARD_PLATFORM)
+LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
+LOCAL_LICENSE_CONDITIONS := notice
LOCAL_MODULE_RELATIVE_PATH := hw
diff --git a/hal/audio_extn/a2dp.c b/hal/audio_extn/a2dp.c
index d7e2e2a..d594dc0 100644
--- a/hal/audio_extn/a2dp.c
+++ b/hal/audio_extn/a2dp.c
@@ -1424,6 +1424,7 @@ int audio_extn_a2dp_start_playback()
if (ret != 0 ) {
ALOGE("%s: Bluetooth controller start failed", __func__);
a2dp.a2dp_started = false;
+ ret = -ETIMEDOUT;
} else {
if (configure_a2dp_encoder_format() == true) {
a2dp.a2dp_started = true;
diff --git a/hal/audio_extn/maxxaudio.c b/hal/audio_extn/maxxaudio.c
index 5079233..3b92d14 100644
--- a/hal/audio_extn/maxxaudio.c
+++ b/hal/audio_extn/maxxaudio.c
@@ -20,6 +20,7 @@
#include <audio_hw.h>
#include <cutils/str_parms.h>
#include <dlfcn.h>
+#include <fcntl.h>
#include <log/log.h>
#include <math.h>
#include <platform_api.h>
diff --git a/hal/audio_extn/usb.c b/hal/audio_extn/usb.c
index b0b5049..4bf6a32 100644
--- a/hal/audio_extn/usb.c
+++ b/hal/audio_extn/usb.c
@@ -336,7 +336,7 @@ static int usb_get_capability(int type,
char *bit_width_str = NULL;
struct usb_device_config * usb_device_info;
bool check = false;
- int tries=5;
+ int tries=3;
memset(path, 0, sizeof(path));
ALOGV("%s: for %s", __func__, (type == USB_PLAYBACK) ?
@@ -354,7 +354,7 @@ static int usb_get_capability(int type,
// TODO: figure up if this wait is needed any more
while (tries--) {
if (access(path, F_OK) < 0) {
- ALOGW("stream %s doesn't exist retrying\n", path);
+ ALOGW("stream %s doesn't exist retrying %d more times\n", path, tries);
sleep(1);
continue;
}
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 0f9dcf0..d165668 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -803,10 +803,13 @@ int enable_snd_device(struct audio_device *adev,
ALOGD("%s: snd_device(%d: %s)", __func__, snd_device, device_name);
- if (is_a2dp_device(snd_device) &&
- (audio_extn_a2dp_start_playback() < 0)) {
- ALOGE("%s: failed to configure A2DP control path", __func__);
- goto on_error;
+ if (is_a2dp_device(snd_device)) {
+ if (audio_extn_a2dp_start_playback() < 0) {
+ ALOGE("%s: failed to configure A2DP control path", __func__);
+ goto on_error;
+ } else {
+ adev->a2dp_started = true;
+ }
}
audio_route_apply_and_update_path(adev->audio_route, device_name);
@@ -839,9 +842,10 @@ int disable_snd_device(struct audio_device *adev,
if (adev->snd_dev_ref_cnt[snd_device] == 0) {
audio_extn_dsm_feedback_enable(adev, snd_device, false);
- if (is_a2dp_device(snd_device))
+ if (is_a2dp_device(snd_device)) {
audio_extn_a2dp_stop_playback();
-
+ adev->a2dp_started = false;
+ }
if ((snd_device == SND_DEVICE_OUT_SPEAKER ||
snd_device == SND_DEVICE_OUT_SPEAKER_SAFE ||
snd_device == SND_DEVICE_OUT_SPEAKER_REVERSE ||
@@ -1212,6 +1216,12 @@ static void check_and_route_playback_usecases(struct audio_device *adev,
usecase = node_to_item(node, struct audio_usecase, list);
if (switch_device[usecase->id] ) {
enable_audio_route(adev, usecase);
+ if (usecase->stream.out && usecase->id == USECASE_AUDIO_PLAYBACK_VOIP) {
+ struct stream_out *out = usecase->stream.out;
+ audio_extn_utils_send_app_type_gain(out->dev,
+ out->app_type_cfg.app_type,
+ &out->app_type_cfg.gain[0]);
+ }
}
}
}
@@ -2463,16 +2473,13 @@ int start_output_stream(struct stream_out *out)
}
if (out->devices & AUDIO_DEVICE_OUT_ALL_A2DP) {
- if (!audio_extn_a2dp_is_ready()) {
- if (out->devices & (AUDIO_DEVICE_OUT_SPEAKER | AUDIO_DEVICE_OUT_SPEAKER_SAFE)) {
- a2dp_combo = true;
- } else {
- if (!(out->flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD)) {
- ALOGE("%s: A2DP profile is not ready, return error", __func__);
- ret = -EAGAIN;
- goto error_config;
- }
- }
+ if (out->devices & (AUDIO_DEVICE_OUT_SPEAKER | AUDIO_DEVICE_OUT_SPEAKER_SAFE)) {
+ a2dp_combo = true;
+ } else if (!audio_extn_a2dp_is_ready() &&
+ !(out->flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD)) {
+ ALOGE("%s: A2DP profile is not ready, return error", __func__);
+ ret = -EAGAIN;
+ goto error_config;
}
}
out->pcm_device_id = platform_get_pcm_device_id(out->usecase, PCM_PLAYBACK);
@@ -2505,11 +2512,14 @@ int start_output_stream(struct stream_out *out)
audio_streaming_hint_start();
audio_extn_perf_lock_acquire();
+ if (!(out->devices & AUDIO_DEVICE_OUT_ALL_A2DP) ||
+ audio_extn_a2dp_is_ready()) {
+ select_devices(adev, out->usecase);
+ }
+
if ((out->devices & AUDIO_DEVICE_OUT_ALL_A2DP) &&
- (!audio_extn_a2dp_is_ready())) {
- if (!a2dp_combo) {
- check_a2dp_restore_l(adev, out, false);
- } else {
+ (!audio_extn_a2dp_is_ready() || !adev->a2dp_started)) {
+ if (a2dp_combo) {
audio_devices_t dev = out->devices;
if (dev & AUDIO_DEVICE_OUT_SPEAKER_SAFE)
out->devices = AUDIO_DEVICE_OUT_SPEAKER_SAFE;
@@ -2517,9 +2527,13 @@ int start_output_stream(struct stream_out *out)
out->devices = AUDIO_DEVICE_OUT_SPEAKER;
select_devices(adev, out->usecase);
out->devices = dev;
+ } else if (!audio_extn_a2dp_is_ready()) {
+ check_a2dp_restore_l(adev, out, false);
+ } else {
+ ALOGE("%s: A2DP is not started, return error", __func__);
+ ret = -EINVAL;
+ goto error_open;
}
- } else {
- select_devices(adev, out->usecase);
}
audio_extn_extspk_update(adev->extspk);
@@ -2732,23 +2746,21 @@ static size_t get_stream_buffer_size(size_t duration_ms,
int channel_count,
bool is_low_latency)
{
- size_t size = 0;
+ // Compute target frames based on time or period size.
+ size_t target_frames = is_low_latency
+ ? configured_low_latency_capture_period_size // record only
+ : (sample_rate * duration_ms) / 1000;
- size = (sample_rate * duration_ms) / 1000;
- if (is_low_latency)
- size = configured_low_latency_capture_period_size;
+ // Round up to a multiple of 16 frames in case sizing for the MixerThread.
+ if (!is_low_latency) { // low latency flag set for record only
+ target_frames = (target_frames + 0xf) & ~0xf;
+ }
- size *= channel_count * audio_bytes_per_sample(format);
+ // Buffer size is the target frames multiplied by the frame size in bytes.
+ const size_t frame_size = channel_count * audio_bytes_per_sample(format);
+ const size_t buffer_size = target_frames * frame_size;
- /* make sure the size is multiple of 32 bytes
- * At 48 kHz mono 16-bit PCM:
- * 5.000 ms = 240 frames = 15*16*1*2 = 480, a whole multiple of 32 (15)
- * 3.333 ms = 160 frames = 10*16*1*2 = 320, a whole multiple of 32 (10)
- */
- size += 0x1f;
- size &= ~0x1f;
-
- return size;
+ return buffer_size;
}
static uint32_t out_get_sample_rate(const struct audio_stream *stream)
@@ -2988,16 +3000,8 @@ static int out_set_parameters(struct audio_stream *stream, const char *kvpairs)
lock_output_stream(out);
- // The usb driver needs to be closed after usb device disconnection
- // otherwise audio is no longer played on the new usb devices.
- // By forcing the stream in standby, the usb stack refcount drops to 0
- // and the driver is closed.
if (val == AUDIO_DEVICE_NONE &&
audio_is_usb_out_device(out->devices)) {
- if (out->usecase == USECASE_AUDIO_PLAYBACK_OFFLOAD) {
- ALOGD("%s() putting the usb device in standby after disconnection", __func__);
- out_standby_l(&out->stream.common);
- }
val = AUDIO_DEVICE_OUT_SPEAKER;
forced_speaker_fallback = true;
}
@@ -6606,6 +6610,7 @@ static int adev_open(const hw_module_t *module, const char *name,
adev->primary_output = NULL;
adev->bluetooth_nrec = true;
adev->acdb_settings = TTY_MODE_OFF;
+ adev->a2dp_started = false;
/* adev->cur_hdmi_channels = 0; by calloc() */
adev->snd_dev_ref_cnt = calloc(SND_DEVICE_MAX, sizeof(int));
voice_init(adev);
diff --git a/hal/audio_hw.h b/hal/audio_hw.h
index e980e88..b709b1d 100644
--- a/hal/audio_hw.h
+++ b/hal/audio_hw.h
@@ -431,6 +431,7 @@ struct audio_device {
snd_device_t last_logged_snd_device[AUDIO_USECASE_MAX][2]; /* [out, in] */
int camera_orientation; /* CAMERA_BACK_LANDSCAPE ... CAMERA_FRONT_PORTRAIT */
bool bt_sco_on;
+ bool a2dp_started;
};
int select_devices(struct audio_device *adev,
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 8fa9826..2d35365 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -19,6 +19,7 @@
#include <stdlib.h>
#include <dlfcn.h>
+#include <fcntl.h>
#include <pthread.h>
#include <unistd.h>
#include <log/log.h>
diff --git a/legacy/alsa_sound/Android.mk b/legacy/alsa_sound/Android.mk
index 101c22d..26a4562 100644
--- a/legacy/alsa_sound/Android.mk
+++ b/legacy/alsa_sound/Android.mk
@@ -57,6 +57,9 @@ LOCAL_C_INCLUDES += system/core/include
LOCAL_MODULE := audio.primary.msm8960
+LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
+LOCAL_LICENSE_CONDITIONS := notice
+LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_MODULE_TAGS := optional
@@ -74,6 +77,9 @@ LOCAL_SRC_FILES := \
AudioPolicyManagerALSA.cpp
LOCAL_MODULE := audio_policy.msm8960
+LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
+LOCAL_LICENSE_CONDITIONS := notice
+LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_MODULE_TAGS := optional
@@ -126,6 +132,9 @@ LOCAL_SHARED_LIBRARIES := \
LOCAL_SHARED_LIBRARIES += libdl
LOCAL_MODULE:= alsa.msm8960
+LOCAL_LICENSE_KINDS:= SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
+LOCAL_LICENSE_CONDITIONS:= notice
+LOCAL_NOTICE_FILE:= $(LOCAL_PATH)/NOTICE
LOCAL_MODULE_TAGS := optional
include $(BUILD_SHARED_LIBRARY)
diff --git a/legacy/libalsa-intf/Android.mk b/legacy/libalsa-intf/Android.mk
index c259d9f..2657e46 100644
--- a/legacy/libalsa-intf/Android.mk
+++ b/legacy/libalsa-intf/Android.mk
@@ -7,6 +7,8 @@ include $(CLEAR_VARS)
#LOCAL_SRC_FILES:= aplay.c alsa_pcm.c alsa_mixer.c
LOCAL_SRC_FILES:= aplay.c
LOCAL_MODULE:= aplay
+LOCAL_LICENSE_KINDS:= SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD SPDX-license-identifier-LGPL
+LOCAL_LICENSE_CONDITIONS:= notice restricted
LOCAL_SHARED_LIBRARIES:= libc libcutils libalsa-intf
LOCAL_MODULE_TAGS:= debug
include $(BUILD_EXECUTABLE)
@@ -15,6 +17,8 @@ include $(CLEAR_VARS)
#LOCAL_SRC_FILES:= arec.c alsa_pcm.c
LOCAL_SRC_FILES:= arec.c
LOCAL_MODULE:= arec
+LOCAL_LICENSE_KINDS:= SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD SPDX-license-identifier-LGPL
+LOCAL_LICENSE_CONDITIONS:= notice restricted
LOCAL_SHARED_LIBRARIES:= libc libcutils libalsa-intf
LOCAL_MODULE_TAGS:= debug
include $(BUILD_EXECUTABLE)
@@ -22,6 +26,8 @@ include $(BUILD_EXECUTABLE)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= amix.c
LOCAL_MODULE:= amix
+LOCAL_LICENSE_KINDS:= SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD SPDX-license-identifier-LGPL
+LOCAL_LICENSE_CONDITIONS:= notice restricted
LOCAL_SHARED_LIBRARIES := libc libcutils libalsa-intf
LOCAL_MODULE_TAGS:= debug
include $(BUILD_EXECUTABLE)
@@ -29,6 +35,8 @@ include $(BUILD_EXECUTABLE)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= alsaucm_test.c
LOCAL_MODULE:= alsaucm_test
+LOCAL_LICENSE_KINDS:= SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD SPDX-license-identifier-LGPL
+LOCAL_LICENSE_CONDITIONS:= notice restricted
LOCAL_SHARED_LIBRARIES:= libc libcutils libalsa-intf
LOCAL_MODULE_TAGS:= debug
include $(BUILD_EXECUTABLE)
@@ -40,6 +48,8 @@ LOCAL_COPY_HEADERS += alsa_ucm.h
LOCAL_COPY_HEADERS += msm8960_use_cases.h
LOCAL_SRC_FILES:= alsa_mixer.c alsa_pcm.c alsa_ucm.c
LOCAL_MODULE:= libalsa-intf
+LOCAL_LICENSE_KINDS:= SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD SPDX-license-identifier-LGPL
+LOCAL_LICENSE_CONDITIONS:= notice restricted
LOCAL_MODULE_TAGS := optional
LOCAL_SHARED_LIBRARIES:= libc libcutils #libutils #libmedia libhardware_legacy
LOCAL_CFLAGS := -DQC_PROP -DCONFIG_DIR=\"/system/etc/snd_soc_msm/\"
diff --git a/post_proc/Android.mk b/post_proc/Android.mk
index ce84e41..267585a 100644
--- a/post_proc/Android.mk
+++ b/post_proc/Android.mk
@@ -31,6 +31,8 @@ LOCAL_PROPRIETARY_MODULE := true
LOCAL_MODULE_RELATIVE_PATH := soundfx
LOCAL_MODULE:= libqcompostprocbundle
+LOCAL_LICENSE_KINDS:= SPDX-license-identifier-Apache-2.0
+LOCAL_LICENSE_CONDITIONS:= notice
LOCAL_C_INCLUDES := \
external/tinyalsa/include \
@@ -61,6 +63,8 @@ LOCAL_SHARED_LIBRARIES := \
LOCAL_MODULE_RELATIVE_PATH := soundfx
LOCAL_MODULE:= libvolumelistener
+LOCAL_LICENSE_KINDS:= SPDX-license-identifier-Apache-2.0
+LOCAL_LICENSE_CONDITIONS:= notice
LOCAL_MODULE_OWNER := qcom
LOCAL_PROPRIETARY_MODULE := true
@@ -93,6 +97,8 @@ LOCAL_SHARED_LIBRARIES := \
LOCAL_MODULE_RELATIVE_PATH := soundfx
LOCAL_MODULE:= libmalistener
+LOCAL_LICENSE_KINDS:= SPDX-license-identifier-Apache-2.0
+LOCAL_LICENSE_CONDITIONS:= notice
LOCAL_MODULE_OWNER := google
LOCAL_PROPRIETARY_MODULE := true
diff --git a/visualizer/Android.mk b/visualizer/Android.mk
index 13a45c7..c9b765a 100644
--- a/visualizer/Android.mk
+++ b/visualizer/Android.mk
@@ -36,6 +36,9 @@ LOCAL_HEADER_LIBRARIES := libhardware_headers
LOCAL_MODULE_RELATIVE_PATH := soundfx
LOCAL_MODULE:= libqcomvisualizer
+LOCAL_LICENSE_KINDS:= SPDX-license-identifier-Apache-2.0
+LOCAL_LICENSE_CONDITIONS:= notice
+LOCAL_NOTICE_FILE:= $(LOCAL_PATH)/NOTICE
LOCAL_MODULE_OWNER := qcom
LOCAL_PROPRIETARY_MODULE := true
diff --git a/voice_processing/Android.mk b/voice_processing/Android.mk
index 02adf18..c41c460 100644
--- a/voice_processing/Android.mk
+++ b/voice_processing/Android.mk
@@ -4,6 +4,8 @@ LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE:= libqcomvoiceprocessing
+LOCAL_LICENSE_KINDS:= SPDX-license-identifier-Apache-2.0
+LOCAL_LICENSE_CONDITIONS:= notice
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_OWNER := qcom
LOCAL_PROPRIETARY_MODULE := true