Merge "pal: update the mixer cntls for crow"
diff --git a/device/src/Bluetooth.cpp b/device/src/Bluetooth.cpp
index cb67a90..f002ef4 100644
--- a/device/src/Bluetooth.cpp
+++ b/device/src/Bluetooth.cpp
@@ -1227,6 +1227,7 @@
if ((fbDev->deviceStartStopCount > 0) &&
(--fbDev->deviceStartStopCount == 0)) {
fbDev->isConfigured = false;
+ fbDev->isAbrEnabled = false;
}
if (fbDev->deviceCount > 0)
fbDev->deviceCount--;
@@ -1241,6 +1242,7 @@
if ((fbDev->deviceStartStopCount > 0) &&
(--fbDev->deviceStartStopCount == 0)) {
fbDev->isConfigured = false;
+ fbDev->isAbrEnabled = false;
}
if (fbDev->deviceCount > 0)
fbDev->deviceCount--;
diff --git a/resource_manager/src/ResourceManager.cpp b/resource_manager/src/ResourceManager.cpp
index 91d1061..133e387 100644
--- a/resource_manager/src/ResourceManager.cpp
+++ b/resource_manager/src/ResourceManager.cpp
@@ -9057,8 +9057,10 @@
param_bt_a2dp.dev_id = PAL_DEVICE_OUT_BLUETOOTH_A2DP;
param_bt_a2dp.a2dp_suspended = true;
PAL_DBG(LOG_TAG, "Applying cached a2dp_suspended true param");
+ mResourceManagerMutex.unlock();
status = dev->setDeviceParameter(PAL_PARAM_ID_BT_A2DP_SUSPENDED,
¶m_bt_a2dp);
+ mResourceManagerMutex.lock();
} else {
a2dp_suspended = false;
}
diff --git a/stream/src/Stream.cpp b/stream/src/Stream.cpp
index 355d35e..c252a35 100644
--- a/stream/src/Stream.cpp
+++ b/stream/src/Stream.cpp
@@ -866,6 +866,16 @@
a2dpSuspend = false;
+ /* Check for BT device connected state */
+ for (int32_t i = 0; i < mDevices.size(); i++) {
+ pal_device_id_t dev_id = (pal_device_id_t)mDevices[i]->getSndDeviceId();
+ if (rm->isBtDevice(dev_id) && !(rm->isDeviceAvailable(dev_id))) {
+ PAL_ERR(LOG_TAG, "BT device %d not connected", dev_id);
+ status = -ENODEV;
+ goto exit;
+ }
+ }
+
/* SCO device is not ready */
if (rm->isDeviceAvailable(mDevices, PAL_DEVICE_OUT_BLUETOOTH_SCO) &&
!rm->isDeviceReady(PAL_DEVICE_OUT_BLUETOOTH_SCO)) {
@@ -1373,6 +1383,7 @@
int32_t connectCount = 0, disconnectCount = 0;
bool isNewDeviceA2dp = false;
bool isCurDeviceA2dp = false;
+ bool isCurDeviceSco = false;
bool isCurrentDeviceProxyOut = false;
bool isCurrentDeviceDpOut = false;
bool matchFound = false;
@@ -1425,6 +1436,11 @@
curBtDevId = curDevId;
}
+ if (curDevId == PAL_DEVICE_OUT_BLUETOOTH_SCO) {
+ isCurDeviceSco = true;
+ curBtDevId = curDevId;
+ }
+
if (curDevId == PAL_DEVICE_OUT_PROXY)
isCurrentDeviceProxyOut = true;
@@ -1497,11 +1513,19 @@
* But the audioflinger continues to write data until standby time
* (3sec). As BT is turned off, the write gets blocked.
* Avoid this by routing audio to speaker until standby.
+ *
+ * If a stream is active on SCO and playback has ended, APM will send
+ * routing=0. Stream will be closed in PAL after standby time. If SCO
+ * device gets disconnected, this stream will not receive new routing
+ * and stream will remain with SCO for the time being. If SCO device
+ * gets connected again with different config in the meantime and
+ * capture stream tries to start ABR path, it will lead to error due to
+ * config mismatch. Added OUT_SCO device handling to resolve this.
*/
// This assumes that PAL_DEVICE_NONE comes as single device
if ((newDevices[i].id == PAL_DEVICE_NONE) &&
- (((isCurDeviceA2dp == true) && (!rm->isDeviceReady(curBtDevId))) ||
- (isCurrentDeviceProxyOut) || (isCurrentDeviceDpOut))) {
+ ((isCurrentDeviceProxyOut) || (isCurrentDeviceDpOut) ||
+ ((isCurDeviceA2dp || isCurDeviceSco) && (!rm->isDeviceReady(curBtDevId))))) {
newDevices[i].id = PAL_DEVICE_OUT_SPEAKER;
if (rm->getDeviceConfig(&newDevices[i], mStreamAttr)) {
diff --git a/stream/src/StreamCompress.cpp b/stream/src/StreamCompress.cpp
index a0d4a1c..9fe128e 100644
--- a/stream/src/StreamCompress.cpp
+++ b/stream/src/StreamCompress.cpp
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2019-2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -26,6 +25,10 @@
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Changes from Qualcomm Innovation Center are provided under the following license:
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * SPDX-License-Identifier: BSD-3-Clause-Clear
*/
#define LOG_TAG "PAL: StreamCompress"
@@ -187,7 +190,9 @@
}
}
+ rm->lockGraph();
status = session->open(this);
+ rm->unlockGraph();
if (0 != status) {
PAL_ERR(LOG_TAG,"session open failed with status %d", status);
goto exit;
diff --git a/stream/src/StreamPCM.cpp b/stream/src/StreamPCM.cpp
index deff268..e001253 100644
--- a/stream/src/StreamPCM.cpp
+++ b/stream/src/StreamPCM.cpp
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2019-2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -26,6 +25,10 @@
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Changes from Qualcomm Innovation Center are provided under the following license:
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * SPDX-License-Identifier: BSD-3-Clause-Clear
*/
#define LOG_TAG "PAL: StreamPCM"
@@ -226,7 +229,9 @@
}
}
+ rm->lockGraph();
status = session->open(this);
+ rm->unlockGraph();
if (0 != status) {
PAL_ERR(LOG_TAG, "session open failed with status %d", status);
goto exit;