Merge "agm: compress plugin: correct compress capture timestamp"
diff --git a/ipc/HwBinders/agm_ipc_client/src/agm_client_wrapper.cpp b/ipc/HwBinders/agm_ipc_client/src/agm_client_wrapper.cpp
index de56c56..520a2af 100644
--- a/ipc/HwBinders/agm_ipc_client/src/agm_client_wrapper.cpp
+++ b/ipc/HwBinders/agm_ipc_client/src/agm_client_wrapper.cpp
@@ -71,6 +71,7 @@
#include <agm/agm_api.h>
#include "inc/AGMCallback.h"
+#include <mutex>
using android::hardware::Return;
using android::hardware::hidl_vec;
@@ -91,6 +92,7 @@
sp<IAGMCallback> ClbkBinder = NULL;
static list_declare(client_clbk_data_list);
static pthread_mutex_t clbk_data_list_lock = PTHREAD_MUTEX_INITIALIZER;
+static std::mutex agm_session_register_cb_mutex;
struct client_cb_data {
struct listnode node;
@@ -730,6 +732,7 @@
int agm_session_register_cb(uint32_t session_id, agm_event_cb cb,
enum event_type evt_type, void *client_data)
{
+ std::lock_guard<std::mutex> lck(agm_session_register_cb_mutex);
ALOGV("%s : sess_id = %d, evt_type = %d, client_data = %p \n", __func__,
session_id, evt_type, client_data);
int32_t ret = 0;
diff --git a/ipc/HwBinders/agm_ipc_service/Android.mk b/ipc/HwBinders/agm_ipc_service/Android.mk
index 69e6850..5619703 100644
--- a/ipc/HwBinders/agm_ipc_service/Android.mk
+++ b/ipc/HwBinders/agm_ipc_service/Android.mk
@@ -6,6 +6,7 @@
LOCAL_VENDOR_MODULE := true
LOCAL_CFLAGS += -v -Wall
+LOCAL_CFLAGS += -D_ANDROID_
LOCAL_C_INCLUDES := $(TOP)/vendor/qcom/opensource/agm/ipc/HwBinders/agm_ipc_client/
LOCAL_SRC_FILES := src/agm_server_wrapper.cpp
@@ -20,6 +21,7 @@
libbase \
libar-gsl \
vendor.qti.hardware.AGMIPC@1.0 \
+ libutilscallstack \
libagm
ifeq ($(strip $(AUDIO_FEATURE_ENABLED_AGM_HIDL)),true)
diff --git a/ipc/HwBinders/agm_ipc_service/src/agm_server_wrapper.cpp b/ipc/HwBinders/agm_ipc_service/src/agm_server_wrapper.cpp
index e596251..62480d4 100644
--- a/ipc/HwBinders/agm_ipc_service/src/agm_server_wrapper.cpp
+++ b/ipc/HwBinders/agm_ipc_service/src/agm_server_wrapper.cpp
@@ -70,6 +70,8 @@
#include <signal.h>
#include "gsl_intf.h"
#include <hwbinder/IPCThreadState.h>
+#include <utils/ProcessCallStack.h>
+#include <cutils/properties.h>
#define MAX_CACHE_SIZE 64
#define NUM_GKV(x) (*((uint32_t *) x))
@@ -114,6 +116,16 @@
"signal %d (<debuggerd signal>), code -1 "
"(SI_QUEUE from pid %d, uid %d)",
d_info->signal, d_info->pid, d_info->uid);
+#ifdef _ANDROID_
+ char propValue[PROPERTY_VALUE_MAX];
+ property_get("ro.debuggable", propValue, "0");
+ if(atoi(propValue) == 1) {
+ std::string prefix = "audioserver_" + std::to_string(d_info->pid) + " ";
+ android::ProcessCallStack pcs;
+ pcs.update();
+ pcs.log(LOG_TAG, ANDROID_LOG_FATAL, prefix.c_str());
+ }
+#endif
if (sigqueue(getpid(), DEBUGGER_SIGNAL, {.sival_int = 0}) < 0) {
ALOGW("%s: Sending signal %d failed with error %d",
__func__, DEBUGGER_SIGNAL, errno);
diff --git a/service/inc/private/agm/device.h b/service/inc/private/agm/device.h
index 0324658..7fda4a3 100644
--- a/service/inc/private/agm/device.h
+++ b/service/inc/private/agm/device.h
@@ -240,5 +240,6 @@
int device_get_group_list(struct aif_info *aif_list, size_t *num_groups);
int device_get_start_refcnt(struct device_obj *dev_obj);
+int device_get_state(struct device_obj *dev_obj);
bool get_file_path_extn(char* file_path_extn, char* file_path_extn_wo_variant);
#endif
diff --git a/service/src/device.c b/service/src/device.c
index 7c03b25..743972f 100644
--- a/service/src/device.c
+++ b/service/src/device.c
@@ -937,6 +937,19 @@
}
+int device_get_state(struct device_obj *dev_obj)
+{
+ if (dev_obj == NULL) {
+ AGM_LOGE("Invalid device object\n");
+ return DEV_CLOSED;
+ }
+
+ if (dev_obj->parent_dev)
+ return dev_obj->parent_dev->state;
+ else
+ return dev_obj->state;
+}
+
static struct device_group_data* device_get_group_data_by_name(char *dev_name)
{
struct device_group_data *grp_data = NULL;
diff --git a/service/src/session_obj.c b/service/src/session_obj.c
index 92b4b75..a39997d 100644
--- a/service/src/session_obj.c
+++ b/service/src/session_obj.c
@@ -660,8 +660,8 @@
return ret;
pthread_mutex_lock(&dev_obj->lock);
- if ((dev_obj->state == DEV_OPENED || dev_obj->state == DEV_STARTED ||
- dev_obj->state == DEV_PREPARED) && dev_obj->params != NULL) {
+
+ if ((device_get_state(dev_obj) != DEV_CLOSED) && dev_obj->params != NULL) {
ret = graph_set_config(sess_obj->graph, dev_obj->params,
dev_obj->params_size);
if (ret)
@@ -1049,7 +1049,7 @@
goto done;
}
- if (ec_ref_dev_obj->state != DEV_STARTED) {
+ if (device_get_state(ec_ref_dev_obj) != DEV_STARTED) {
AGM_LOGE("Error:%d Device object with aif id:%d\n"
"not in STARTED state, current state:%d\n",
ret, sess_obj->ec_ref_aif_id,