Merge 70411f19f73885d888e901aa5d1d47fc10f91d1e on remote branch
Change-Id: I0f20db8783823414d5e1344f1ccbde0e91cf1191
diff --git a/resource_manager/src/ResourceManager.cpp b/resource_manager/src/ResourceManager.cpp
index b989f58..61d7ed2 100644
--- a/resource_manager/src/ResourceManager.cpp
+++ b/resource_manager/src/ResourceManager.cpp
@@ -26,9 +26,9 @@
* 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:
+ * Changes from Qualcomm Innovation Center, Inc. are provided under the following license:
*
- * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/
@@ -6918,7 +6918,15 @@
if (backEndName == listAllBackEndIds[i].second) {
dev = Device::getObject((pal_device_id_t) i);
if(dev) {
- getActiveStream_l(activeStreams, dev);
+ std::list<Stream*>::iterator it;
+ for(it = mActiveStreams.begin(); it != mActiveStreams.end(); it++) {
+ std::vector <std::shared_ptr<Device>> devices;
+ (*it)->getAssociatedDevices(devices);
+ typename std::vector<std::shared_ptr<Device>>::iterator result =
+ std::find(devices.begin(), devices.end(), dev);
+ if (result != devices.end())
+ activeStreams.push_back(*it);
+ }
PAL_DBG(LOG_TAG, "got dev %d active streams on dev is %zu", i, activeStreams.size() );
for (int j=0; j < activeStreams.size(); j++) {
/*do not add if this is a dup*/
diff --git a/session/src/SessionAlsaUtils.cpp b/session/src/SessionAlsaUtils.cpp
index ce1fc9d..8118ead 100644
--- a/session/src/SessionAlsaUtils.cpp
+++ b/session/src/SessionAlsaUtils.cpp
@@ -2313,6 +2313,7 @@
if (strcmp(dAttr.custom_config.custom_key, "mspp") &&
dAttr.id == PAL_DEVICE_OUT_SPEAKER &&
+ dAttr.config.ch_info.channels == 2 &&
((sAttr.type == PAL_STREAM_LOW_LATENCY) ||
(sAttr.type == PAL_STREAM_ULTRA_LOW_LATENCY) ||
(sAttr.type == PAL_STREAM_PCM_OFFLOAD) ||
@@ -2321,9 +2322,7 @@
pal_param_device_rotation_t rotation;
rotation.rotation_type = rm->mOrientation == ORIENTATION_270 ?
PAL_SPEAKER_ROTATION_RL : PAL_SPEAKER_ROTATION_LR;
- status = sess->handleDeviceRotation(streamHandle, rotation.rotation_type,
- pcmDevIds.at(0), mixerHandle, builder,
- aifBackEndsToConnect);
+ status = sess->setParameters(streamHandle, 0, PAL_PARAM_ID_DEVICE_ROTATION, &rotation);
if (status != 0) {
PAL_ERR(LOG_TAG,"handleDeviceRotation failed");
status = 0; //rotaton setting failed is not fatal.
diff --git a/stream/src/Stream.cpp b/stream/src/Stream.cpp
index 414711e..7cd64d8 100644
--- a/stream/src/Stream.cpp
+++ b/stream/src/Stream.cpp
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2019-2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2022-2023 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
@@ -27,8 +26,8 @@
* 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.
+ * Changes from Qualcomm Innovation Center, Inc. are provided under the following license:
+ * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted (subject to the limitations in the
@@ -1117,7 +1116,13 @@
int32_t status = 0;
if (currentState == STREAM_IDLE) {
- PAL_DBG(LOG_TAG, "stream is in %d state, no need to switch device", currentState);
+ for (int i = 0; i < mDevices.size(); i++) {
+ if (dev_id == mDevices[i]->getSndDeviceId()) {
+ mDevices.erase(mDevices.begin() + i);
+ PAL_DBG(LOG_TAG, "stream is in IDLE state, erase device: %d", dev_id);
+ break;
+ }
+ }
status = 0;
goto exit;
}
@@ -1207,7 +1212,8 @@
dev->setDeviceAttributes(*dattr);
if (currentState == STREAM_IDLE) {
- PAL_DBG(LOG_TAG, "stream is in %d state, no need to switch device", currentState);
+ PAL_DBG(LOG_TAG, "stream is in IDLE state, insert %d to mDevices", dev->getSndDeviceId());
+ mDevices.push_back(dev);
status = 0;
goto exit;
}
diff --git a/stream/src/StreamCommon.cpp b/stream/src/StreamCommon.cpp
index d9cf880..a2cd8d2 100644
--- a/stream/src/StreamCommon.cpp
+++ b/stream/src/StreamCommon.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, Inc. are provided under the following license:
+ * Copyright (c) 2022, 2024 Qualcomm Innovation Center, Inc. All rights reserved.
+ * SPDX-License-Identifier: BSD-3-Clause-Clear
*/
#define LOG_TAG "PAL: StreamCommon"
diff --git a/stream/src/StreamCompress.cpp b/stream/src/StreamCompress.cpp
index 72a7ce1..d2068af 100644
--- a/stream/src/StreamCompress.cpp
+++ b/stream/src/StreamCompress.cpp
@@ -26,8 +26,8 @@
* 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.
+ * Changes from Qualcomm Innovation Center, Inc. are provided under the following license:
+ * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/
@@ -129,7 +129,9 @@
session->registerCallBack(handleSessionCallBack, (uint64_t)this);
PAL_VERBOSE(LOG_TAG,"Create new Devices with no_of_devices - %d", no_of_devices);
+ bool str_registered = false;
for (uint32_t i = 0; i < no_of_devices; i++) {
+
dev = Device::getInstance((struct pal_device *)&dattr[i] , rm);
if (dev == nullptr) {
PAL_ERR(LOG_TAG, "Device creation is failed");
@@ -140,6 +142,10 @@
dev->insertStreamDeviceAttr(&dattr[i], this);
mPalDevices.push_back(dev);
mStreamMutex.unlock();
+ if (!str_registered) {
+ rm->registerStream(this);
+ str_registered = true;
+ }
isDeviceConfigUpdated = rm->updateDeviceConfig(&dev, &dattr[i], sattr);
mStreamMutex.lock();
@@ -150,7 +156,6 @@
dev = nullptr;
}
mStreamMutex.unlock();
- rm->registerStream(this);
PAL_VERBOSE(LOG_TAG,"exit, state %d", currentState);
}
diff --git a/stream/src/StreamPCM.cpp b/stream/src/StreamPCM.cpp
index 6646570..db300d4 100644
--- a/stream/src/StreamPCM.cpp
+++ b/stream/src/StreamPCM.cpp
@@ -26,8 +26,8 @@
* 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.
+ * Changes from Qualcomm Innovation Center, Inc. are provided under the following license:
+ * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/
@@ -123,6 +123,7 @@
}
PAL_VERBOSE(LOG_TAG, "Create new Devices with no_of_devices - %d", no_of_devices);
+ bool str_registered = false;
for (int i = 0; i < no_of_devices; i++) {
//Check with RM if the configuration given can work or not
//for e.g., if incoming stream needs 24 bit device thats also
@@ -140,6 +141,14 @@
dev->insertStreamDeviceAttr(&dattr[i], this);
mPalDevices.push_back(dev);
mStreamMutex.unlock();
+ /* Stream mutex is unlocked before calling stream specific API
+ * in resource manager to avoid deadlock issues between stream
+ * and active stream mutex from ResourceManager.
+ */
+ if (!str_registered) {
+ rm->registerStream(this);
+ str_registered = true;
+ }
isDeviceConfigUpdated = rm->updateDeviceConfig(&dev, &dattr[i], sattr);
mStreamMutex.lock();
@@ -159,11 +168,6 @@
session->registerCallBack(handleSoftPauseCallBack, (uint64_t)this);
mStreamMutex.unlock();
- /* Stream mutex is unlocked before calling stream specific API
- * in resource manager to avoid deadlock issues between stream
- * and active stream mutex from ResourceManager.
- */
- rm->registerStream(this);
PAL_DBG(LOG_TAG, "Exit. state %d", currentState);
return;
}
diff --git a/stream/src/StreamSensorPCMData.cpp b/stream/src/StreamSensorPCMData.cpp
index 3332ec5..b125c33 100644
--- a/stream/src/StreamSensorPCMData.cpp
+++ b/stream/src/StreamSensorPCMData.cpp
@@ -26,8 +26,8 @@
* 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 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Changes from Qualcomm Innovation Center, Inc. are provided under the following license:
+ * Copyright (c) 2022, 2024 Qualcomm Innovation Center, Inc. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/
@@ -62,7 +62,6 @@
}
rm->registerStream(this);
-
/* Print the concurrency feature flags supported */
PAL_INFO(LOG_TAG, "capture conc enable %d,voice conc enable %d,voip conc enable %d",
acd_info_->GetConcurrentCaptureEnable(),
diff --git a/stream/src/StreamUltraSound.cpp b/stream/src/StreamUltraSound.cpp
index 63827f1..8b6566d 100644
--- a/stream/src/StreamUltraSound.cpp
+++ b/stream/src/StreamUltraSound.cpp
@@ -26,8 +26,8 @@
* 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.
+ * Changes from Qualcomm Innovation Center, Inc. are provided under the following license:
+ * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/