pal: add new mutex to synchronize getParam mixer ctl call to AGM

Earlier getParam call to AGM was synchronized with resourceManager
mutex. This was causing delay for get parameters in Resource Manager,
as it will be waiting for resourceManager mutex lock.

In cases where there was a concurrency of low latency and offloaded
stream on BT, get encoder latency param for ll stream was getting
blocked due to resourceManager mutex previously acquired by getTimestamp
call for offloaded stream. This was leading to delay in write calls for
ll stream, and thus causing glitches over BT.

Fixed this by introducing mGetParamMutex, which will be used to sync
getParam mixer control calls to AGM.

Change-Id: Ib8ea246c1836f6d4d96912f13c939da003dae8d9
diff --git a/stream/inc/Stream.h b/stream/inc/Stream.h
index e7f1b81..c66c13c 100644
--- a/stream/inc/Stream.h
+++ b/stream/inc/Stream.h
@@ -184,6 +184,7 @@
     int mGainLevel;
     int mOrientation = 0;
     std::mutex mStreamMutex;
+    std::mutex mGetParamMutex;
     static std::mutex mBaseStreamMutex; //TBD change this. as having a single static mutex for all instances of Stream is incorrect. Replace
     static std::shared_ptr<ResourceManager> rm;
     struct modifier_kv *mModifiers;
@@ -324,6 +325,8 @@
         mStreamMutex.unlock();
     };
     bool isMutexLockedbyRm() { return mutexLockedbyRm; }
+    void lockGetParamMutex() { mGetParamMutex.lock(); };
+    void unlockGetParamMutex() { mGetParamMutex.unlock(); };
     /* GetPalDevice only applies to Sound Trigger streams */
     std::shared_ptr<Device> GetPalDevice(Stream *streamHandle, pal_device_id_t dev_id);
     void setCachedState(stream_state_t state);
diff --git a/stream/src/Stream.cpp b/stream/src/Stream.cpp
index 84c44f3..51cbd3f 100644
--- a/stream/src/Stream.cpp
+++ b/stream/src/Stream.cpp
@@ -371,7 +371,9 @@
     }
     pal_param_payload *pal_param = (pal_param_payload *)effect_query;
     effect_pal_payload_t *effectPayload = (effect_pal_payload_t *)pal_param->payload;
+    mGetParamMutex.lock();
     status = session->getEffectParameters(this, effectPayload);
+    mGetParamMutex.unlock();
     if (status) {
        PAL_ERR(LOG_TAG, "getParameters failed with %d", status);
     }
@@ -836,9 +838,9 @@
         PAL_ERR(LOG_TAG, "Sound card offline, status %d", status);
         goto exit;
     }
-    rm->lockResourceManagerMutex();
+    mGetParamMutex.lock();
     status = session->getTimestamp(stime);
-    rm->unlockResourceManagerMutex();
+    mGetParamMutex.unlock();
     if (0 != status) {
         PAL_ERR(LOG_TAG, "Failed to get session timestamp status %d", status);
         if (errno == -ENETRESET &&