Merge tag 'android-7.1.1_r4' of https://android.googlesource.com/platform//hardware/qcom/audio into HEAD
Android 7.1.1 release 4
Change-Id: I9bb4ad48faefc53bc4a9b1da3167226b49e64d3e
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 46a18bf..6770e03 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -350,6 +350,79 @@
adev->adm_abandon_focus(adev->adm_data, in->capture_handle);
}
+// Time string format similar to logcat, buffer_length must be >= 19 chars.
+static void ns2string(int64_t ns, char *buffer, int buffer_length)
+{
+ const int one_second = 1000000000;
+ const time_t sec = ns / one_second;
+ struct tm tm;
+ localtime_r(&sec, &tm);
+ snprintf(buffer, buffer_length, "%02d-%02d %02d:%02d:%02d.%03d",
+ tm.tm_mon + 1, // localtime_r uses months in 0 - 11 range
+ tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec,
+ (int)(ns % one_second / 1000000));
+}
+
+// Convert timespec to nsec.
+static int64_t ts2ns(const struct timespec *ts)
+{
+ return ts->tv_sec * 1000000000LL + ts->tv_nsec;
+}
+
+// Log errors: consecutive errors with the same code will
+// be aggregated if they occur within one second.
+// A mutual exclusion lock must be held before calling.
+static void log_error_l(struct error_log *log, int code) {
+ ++log->errors;
+
+ struct timespec now_ts = { 0, 0 };
+ (void)clock_gettime(CLOCK_REALTIME, &now_ts);
+ const int64_t now = ts2ns(&now_ts);
+
+ // Within 1 second, cluster the same error codes together.
+ const int one_second = 1000000000;
+ if (code == log->entries[log->idx].code &&
+ now - log->entries[log->idx].last_time < one_second) {
+ log->entries[log->idx].count++;
+ log->entries[log->idx].last_time = now;
+ return;
+ }
+
+ // Add new error entry.
+ if (++log->idx >= ARRAY_SIZE(log->entries)) {
+ log->idx = 0;
+ }
+ log->entries[log->idx].count = 1;
+ log->entries[log->idx].code = code;
+ log->entries[log->idx].first_time = now;
+ log->entries[log->idx].last_time = now;
+}
+
+// Dump information in the error log. A mutual exclusion lock
+// should be held, but if that cannot be obtained, one should
+// make a copy of the error log before calling -- the call is
+// still safe, but there might be some misinterpreted data.
+static void log_dump_l(const struct error_log *log, int fd)
+{
+ dprintf(fd, " Errors: %u\n", log->errors);
+ if (log->errors == 0)
+ return;
+
+ dprintf(fd, " Index Code Freq First time Last time\n");
+ for (size_t i = 0; i < ARRAY_SIZE(log->entries); ++i) {
+ if (log->entries[i].count != 0) {
+ char first_time[32];
+ char last_time[32];
+ ns2string(log->entries[i].first_time, first_time, sizeof(first_time));
+ ns2string(log->entries[i].last_time, last_time, sizeof(last_time));
+ dprintf(fd, " %c%4zu %4d %5d %s %s\n",
+ i == log->idx ? '*' : ' ', // mark head position
+ i, log->entries[i].code, log->entries[i].count,
+ first_time, last_time);
+ }
+ }
+}
+
static int parse_snd_card_status(struct str_parms * parms, int * card,
card_status_t * status)
{
@@ -546,7 +619,9 @@
ALOGE("%s: spkr_start_processing failed", __func__);
goto on_error;
}
- } else if (platform_can_split_snd_device(snd_device, &num_devices, new_snd_devices)) {
+ } else if (platform_can_split_snd_device(snd_device,
+ &num_devices,
+ new_snd_devices) == 0) {
for (i = 0; i < num_devices; i++) {
enable_snd_device(adev, new_snd_devices[i]);
}
@@ -600,7 +675,9 @@
snd_device == SND_DEVICE_OUT_VOICE_SPEAKER) &&
audio_extn_spkr_prot_is_enabled()) {
audio_extn_spkr_prot_stop_processing(snd_device);
- } else if (platform_can_split_snd_device(snd_device, &num_devices, new_snd_devices)) {
+ } else if (platform_can_split_snd_device(snd_device,
+ &num_devices,
+ new_snd_devices) == 0) {
for (i = 0; i < num_devices; i++) {
disable_snd_device(adev, new_snd_devices[i]);
}
@@ -630,6 +707,114 @@
return 0;
}
+/*
+ legend:
+ uc - existing usecase
+ new_uc - new usecase
+ d1, d11, d2 - SND_DEVICE enums
+ a1, a2 - corresponding ANDROID device enums
+ B, B1, B2 - backend strings
+
+case 1
+ uc->dev d1 (a1) B1
+ new_uc->dev d1 (a1), d2 (a2) B1, B2
+
+ resolution: disable and enable uc->dev on d1
+
+case 2
+ uc->dev d1 (a1) B1
+ new_uc->dev d11 (a1) B1
+
+ resolution: need to switch uc since d1 and d11 are related
+ (e.g. speaker and voice-speaker)
+ use ANDROID_DEVICE_OUT enums to match devices since SND_DEVICE enums may vary
+
+case 3
+ uc->dev d1 (a1) B1
+ new_uc->dev d2 (a2) B2
+
+ resolution: no need to switch uc
+
+case 4
+ uc->dev d1 (a1) B
+ new_uc->dev d2 (a2) B
+
+ resolution: disable enable uc-dev on d2 since backends match
+ we cannot enable two streams on two different devices if they
+ share the same backend. e.g. if offload is on speaker device using
+ QUAD_MI2S backend and a low-latency stream is started on voice-handset
+ using the same backend, offload must also be switched to voice-handset.
+
+case 5
+ uc->dev d1 (a1) B
+ new_uc->dev d1 (a1), d2 (a2) B
+
+ resolution: disable enable uc-dev on d2 since backends match
+ we cannot enable two streams on two different devices if they
+ share the same backend.
+
+case 6
+ uc->dev d1 a1 B1
+ new_uc->dev d2 a1 B2
+
+ resolution: no need to switch
+
+case 7
+
+ uc->dev d1 (a1), d2 (a2) B1, B2
+ new_uc->dev d1 B1
+
+ resolution: no need to switch
+
+*/
+static snd_device_t derive_playback_snd_device(struct audio_usecase *uc,
+ struct audio_usecase *new_uc,
+ snd_device_t new_snd_device)
+{
+ audio_devices_t a1 = uc->stream.out->devices;
+ audio_devices_t a2 = new_uc->stream.out->devices;
+
+ snd_device_t d1 = uc->out_snd_device;
+ snd_device_t d2 = new_snd_device;
+
+ // Treat as a special case when a1 and a2 are not disjoint
+ if ((a1 != a2) && (a1 & a2)) {
+ snd_device_t d3[2];
+ int num_devices = 0;
+ int ret = platform_can_split_snd_device(popcount(a1) > 1 ? d1 : d2,
+ &num_devices,
+ d3);
+ if (ret < 0) {
+ if (ret != -ENOSYS) {
+ ALOGW("%s failed to split snd_device %d",
+ __func__,
+ popcount(a1) > 1 ? d1 : d2);
+ }
+ goto end;
+ }
+
+ // NB: case 7 is hypothetical and isn't a practical usecase yet.
+ // But if it does happen, we need to give priority to d2 if
+ // the combo devices active on the existing usecase share a backend.
+ // This is because we cannot have a usecase active on a combo device
+ // and a new usecase requests one device in this combo pair.
+ if (platform_check_backends_match(d3[0], d3[1])) {
+ return d2; // case 5
+ } else {
+ return d1; // case 1
+ }
+ } else {
+ if (platform_check_backends_match(d1, d2)) {
+ return d2; // case 2, 4
+ } else {
+ return d1; // case 6, 3
+ }
+ }
+
+end:
+ return d2; // return whatever was calculated before.
+}
+
static void check_and_route_playback_usecases(struct audio_device *adev,
struct audio_usecase *uc_info,
snd_device_t snd_device)
@@ -678,10 +863,15 @@
}
}
+ snd_device_t d_device;
list_for_each(node, &adev->usecase_list) {
usecase = node_to_item(node, struct audio_usecase, list);
if (switch_device[usecase->id]) {
- enable_snd_device(adev, snd_device);
+ d_device = derive_playback_snd_device(usecase, uc_info,
+ snd_device);
+ enable_snd_device(adev, d_device);
+ /* Update the out_snd_device before enabling the audio route */
+ usecase->out_snd_device = d_device;
}
}
@@ -689,9 +879,7 @@
specified usecase to new snd devices */
list_for_each(node, &adev->usecase_list) {
usecase = node_to_item(node, struct audio_usecase, list);
- /* Update the out_snd_device only before enabling the audio route */
if (switch_device[usecase->id] ) {
- usecase->out_snd_device = snd_device;
enable_audio_route(adev, usecase);
}
}
@@ -1718,8 +1906,25 @@
return 0;
}
-static int out_dump(const struct audio_stream *stream __unused, int fd __unused)
+static int out_dump(const struct audio_stream *stream, int fd)
{
+ struct stream_out *out = (struct stream_out *)stream;
+
+ // We try to get the lock for consistency,
+ // but it isn't necessary for these variables.
+ // If we're not in standby, we may be blocked on a write.
+ const bool locked = (pthread_mutex_trylock(&out->lock) == 0);
+ dprintf(fd, " Standby: %s\n", out->standby ? "yes" : "no");
+ dprintf(fd, " Frames written: %lld\n", (long long)out->written);
+
+ if (locked) {
+ log_dump_l(&out->error_log, fd);
+ pthread_mutex_unlock(&out->lock);
+ } else {
+ // We don't have the lock here, copy for safety.
+ struct error_log log = out->error_log;
+ log_dump_l(&log, fd);
+ }
return 0;
}
@@ -2010,6 +2215,7 @@
struct stream_out *out = (struct stream_out *)stream;
struct audio_device *adev = out->dev;
ssize_t ret = 0;
+ int error_code = ERROR_CODE_STANDBY;
lock_output_stream(out);
if (out->standby) {
@@ -2062,9 +2268,13 @@
out->playback_started = 1;
out->offload_state = OFFLOAD_STATE_PLAYING;
}
+ if (ret < 0) {
+ log_error_l(&out->error_log, ERROR_CODE_WRITE);
+ }
pthread_mutex_unlock(&out->lock);
return ret;
} else {
+ error_code = ERROR_CODE_WRITE;
if (out->pcm) {
if (out->muted)
memset((void *)buffer, 0, bytes);
@@ -2081,23 +2291,35 @@
else
ret = pcm_write(out->pcm, (void *)buffer, bytes);
- if (ret == 0)
- out->written += bytes / (out->config.channels * sizeof(short));
-
release_out_focus(out, ns);
+ } else {
+ LOG_ALWAYS_FATAL("out->pcm is NULL after starting output stream");
}
}
exit:
+ // For PCM we always consume the buffer and return #bytes regardless of ret.
+ if (out->usecase != USECASE_AUDIO_PLAYBACK_OFFLOAD) {
+ out->written += bytes / (out->config.channels * sizeof(short));
+ }
+ long long sleeptime_us = 0;
+ if (ret != 0) {
+ log_error_l(&out->error_log, error_code);
+ if (out->usecase != USECASE_AUDIO_PLAYBACK_OFFLOAD) {
+ ALOGE_IF(out->pcm != NULL,
+ "%s: error %zd - %s", __func__, ret, pcm_get_error(out->pcm));
+ sleeptime_us = bytes * 1000000LL / audio_stream_out_frame_size(stream) /
+ out_get_sample_rate(&out->stream.common);
+ // usleep not guaranteed for values over 1 second but we don't limit here.
+ }
+ }
+
pthread_mutex_unlock(&out->lock);
if (ret != 0) {
out_on_error(&out->stream.common);
- if (out->pcm)
- ALOGE("%s: error %zu - %s", __func__, ret, pcm_get_error(out->pcm));
- if (out->usecase != USECASE_AUDIO_PLAYBACK_OFFLOAD)
- usleep(bytes * 1000000 / audio_stream_out_frame_size(stream) /
- out_get_sample_rate(&out->stream.common));
+ if (sleeptime_us != 0)
+ usleep(sleeptime_us);
}
return bytes;
}
diff --git a/hal/audio_hw.h b/hal/audio_hw.h
index 5ce3018..4963316 100644
--- a/hal/audio_hw.h
+++ b/hal/audio_hw.h
@@ -51,6 +51,8 @@
#define MAX_SUPPORTED_CHANNEL_MASKS 2
#define DEFAULT_HDMI_OUT_CHANNELS 2
+#define ERROR_LOG_ENTRIES 16
+
typedef enum card_status_t {
CARD_STATUS_OFFLINE,
CARD_STATUS_ONLINE
@@ -148,6 +150,24 @@
int data[];
};
+enum {
+ ERROR_CODE_STANDBY,
+ ERROR_CODE_WRITE,
+};
+
+struct error_log_entry {
+ int32_t code;
+ int32_t count;
+ int64_t first_time;
+ int64_t last_time;
+};
+
+struct error_log {
+ uint32_t errors;
+ uint32_t idx;
+ struct error_log_entry entries[ERROR_LOG_ENTRIES];
+};
+
struct stream_out {
struct audio_stream_out stream;
pthread_mutex_t lock; /* see note below on mutex acquisition order */
@@ -188,6 +208,8 @@
bool routing_change;
struct audio_device *dev;
card_status_t card_status;
+
+ struct error_log error_log;
};
struct stream_in {
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index 52e9fd8..72d9591 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -1424,35 +1424,35 @@
return ret;
}
-bool platform_can_split_snd_device(snd_device_t snd_device,
+int platform_can_split_snd_device(snd_device_t snd_device,
int *num_devices,
snd_device_t *new_snd_devices)
{
- bool status = false;
+ int ret = -EINVAL;
if (NULL == num_devices || NULL == new_snd_devices) {
ALOGE("%s: NULL pointer ..", __func__);
- return false;
+ return -EINVAL;
}
/*
* If wired headset/headphones/line devices share the same backend
- * with speaker/earpiece this routine returns false.
+ * with speaker/earpiece this routine -EINVAL.
*/
if (snd_device == SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES &&
!platform_check_backends_match(SND_DEVICE_OUT_SPEAKER, SND_DEVICE_OUT_HEADPHONES)) {
*num_devices = 2;
new_snd_devices[0] = SND_DEVICE_OUT_SPEAKER;
new_snd_devices[1] = SND_DEVICE_OUT_HEADPHONES;
- status = true;
+ ret = 0;
} else if (snd_device == SND_DEVICE_OUT_SPEAKER_AND_LINE &&
!platform_check_backends_match(SND_DEVICE_OUT_SPEAKER, SND_DEVICE_OUT_LINE)) {
*num_devices = 2;
new_snd_devices[0] = SND_DEVICE_OUT_SPEAKER;
new_snd_devices[1] = SND_DEVICE_OUT_LINE;
- status = true;
+ ret = 0;
}
- return status;
+ return ret;
}
snd_device_t platform_get_output_snd_device(void *platform, audio_devices_t devices)
diff --git a/hal/msm8960/platform.c b/hal/msm8960/platform.c
index 939aff3..786e10f 100644
--- a/hal/msm8960/platform.c
+++ b/hal/msm8960/platform.c
@@ -1075,11 +1075,11 @@
return true;
}
-bool platform_can_split_snd_device(snd_device_t in_snd_device __unused,
+int platform_can_split_snd_device(snd_device_t in_snd_device __unused,
int *num_devices __unused,
snd_device_t *out_snd_devices __unused)
{
- return false;
+ return -ENOSYS;
}
bool platform_check_backends_match(snd_device_t snd_device1 __unused,
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 441e2a1..a5cfc18 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -1010,24 +1010,37 @@
list_init(&operator_info_list);
set_platform_defaults(my_data);
+ bool card_verifed[MAX_SND_CARD] = {0};
+ const int retry_limit = property_get_int32("audio.snd_card.open.retries", RETRY_NUMBER);
- while (snd_card_num < MAX_SND_CARD) {
- adev->mixer = mixer_open(snd_card_num);
+ for (;;) {
+ if (snd_card_num >= MAX_SND_CARD) {
+ if (retry_num++ >= retry_limit) {
+ ALOGE("%s: Unable to find correct sound card, aborting.", __func__);
+ goto init_failed;
+ }
- while (!adev->mixer && retry_num < RETRY_NUMBER) {
+ snd_card_num = 0;
usleep(RETRY_US);
- adev->mixer = mixer_open(snd_card_num);
- retry_num++;
+ continue;
}
+ if (card_verifed[snd_card_num]) {
+ ++snd_card_num;
+ continue;
+ }
+
+ adev->mixer = mixer_open(snd_card_num);
+
if (!adev->mixer) {
ALOGE("%s: Unable to open the mixer card: %d", __func__,
- snd_card_num);
- retry_num = 0;
- snd_card_num++;
+ snd_card_num);
+ ++snd_card_num;
continue;
}
+ card_verifed[snd_card_num] = true;
+
snd_card_name = mixer_get_name(adev->mixer);
my_data->hw_info = hw_info_init(snd_card_name);
@@ -1106,8 +1119,9 @@
min(strlen(snd_card_name), strlen(my_data->snd_card_name))) != 0) {
ALOGI("%s: found valid sound card %s, but not primary sound card %s",
__func__, snd_card_name, my_data->snd_card_name);
- retry_num = 0;
- snd_card_num++;
+ ++snd_card_num;
+ mixer_close(adev->mixer);
+ adev->mixer = NULL;
hw_info_deinit(my_data->hw_info);
my_data->hw_info = NULL;
continue;
@@ -1120,6 +1134,10 @@
if (!adev->audio_route) {
ALOGE("%s: Failed to init audio route controls, aborting.", __func__);
+ mixer_close(adev->mixer);
+ adev->mixer = NULL;
+ hw_info_deinit(my_data->hw_info);
+ my_data->hw_info = NULL;
goto init_failed;
}
adev->snd_card = snd_card_num;
@@ -1127,11 +1145,6 @@
break;
}
- if (snd_card_num >= MAX_SND_CARD) {
- ALOGE("%s: Unable to find correct sound card, aborting.", __func__);
- goto init_failed;
- }
-
//set max volume step for voice call
property_get("ro.config.vc_call_vol_steps", value, TOSTRING(MAX_VOL_INDEX));
my_data->max_vol_index = atoi(value);
@@ -1850,47 +1863,46 @@
return ret;
}
-bool platform_can_split_snd_device(snd_device_t snd_device,
- int *num_devices,
- snd_device_t *new_snd_devices)
+int platform_can_split_snd_device(snd_device_t snd_device,
+ int *num_devices,
+ snd_device_t *new_snd_devices)
{
- bool status = false;
-
+ int ret = -EINVAL;
if (NULL == num_devices || NULL == new_snd_devices) {
ALOGE("%s: NULL pointer ..", __func__);
- return false;
+ return -EINVAL;
}
/*
* If wired headset/headphones/line devices share the same backend
- * with speaker/earpiece this routine returns false.
+ * with speaker/earpiece this routine returns -EINVAL.
*/
if (snd_device == SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES &&
!platform_check_backends_match(SND_DEVICE_OUT_SPEAKER, SND_DEVICE_OUT_HEADPHONES)) {
*num_devices = 2;
new_snd_devices[0] = SND_DEVICE_OUT_SPEAKER;
new_snd_devices[1] = SND_DEVICE_OUT_HEADPHONES;
- status = true;
+ ret = 0;
} else if (snd_device == SND_DEVICE_OUT_SPEAKER_AND_LINE &&
!platform_check_backends_match(SND_DEVICE_OUT_SPEAKER, SND_DEVICE_OUT_LINE)) {
*num_devices = 2;
new_snd_devices[0] = SND_DEVICE_OUT_SPEAKER;
new_snd_devices[1] = SND_DEVICE_OUT_LINE;
- status = true;
+ ret = 0;
} else if (snd_device == SND_DEVICE_OUT_SPEAKER_SAFE_AND_HEADPHONES &&
!platform_check_backends_match(SND_DEVICE_OUT_SPEAKER_SAFE, SND_DEVICE_OUT_HEADPHONES)) {
*num_devices = 2;
new_snd_devices[0] = SND_DEVICE_OUT_SPEAKER_SAFE;
new_snd_devices[1] = SND_DEVICE_OUT_HEADPHONES;
- status = true;
+ ret = 0;
} else if (snd_device == SND_DEVICE_OUT_SPEAKER_SAFE_AND_LINE &&
!platform_check_backends_match(SND_DEVICE_OUT_SPEAKER_SAFE, SND_DEVICE_OUT_LINE)) {
*num_devices = 2;
new_snd_devices[0] = SND_DEVICE_OUT_SPEAKER_SAFE;
new_snd_devices[1] = SND_DEVICE_OUT_LINE;
- status = true;
+ ret = 0;
}
- return status;
+ return ret;
}
snd_device_t platform_get_output_snd_device(void *platform, audio_devices_t devices)
@@ -2742,6 +2754,14 @@
struct platform_data *my_data = (struct platform_data *)adev->platform;
if (my_data->speaker_lr_swap != swap_channels) {
+
+ // do not swap channels in audio modes with concurrent capture and playback
+ // as this may break the echo reference
+ if ((adev->mode == AUDIO_MODE_IN_COMMUNICATION) || (adev->mode == AUDIO_MODE_IN_CALL)) {
+ ALOGV("%s: will not swap due to audio mode %d", __func__, adev->mode);
+ return 0;
+ }
+
my_data->speaker_lr_swap = swap_channels;
list_for_each(node, &adev->usecase_list) {
diff --git a/hal/platform_api.h b/hal/platform_api.h
index 41e600e..fbc84c1 100644
--- a/hal/platform_api.h
+++ b/hal/platform_api.h
@@ -100,9 +100,9 @@
void platform_set_echo_reference(struct audio_device *adev, bool enable, audio_devices_t out_device);
int platform_swap_lr_channels(struct audio_device *adev, bool swap_channels);
-bool platform_can_split_snd_device(snd_device_t in_snd_device,
- int *num_devices,
- snd_device_t *out_snd_devices);
+int platform_can_split_snd_device(snd_device_t in_snd_device,
+ int *num_devices,
+ snd_device_t *out_snd_devices);
bool platform_check_backends_match(snd_device_t snd_device1, snd_device_t snd_device2);
diff --git a/post_proc/volume_listener.c b/post_proc/volume_listener.c
index 3367b76..4a48a25 100644
--- a/post_proc/volume_listener.c
+++ b/post_proc/volume_listener.c
@@ -32,7 +32,8 @@
#define VOL_FLAG ( EFFECT_FLAG_TYPE_INSERT | \
EFFECT_FLAG_VOLUME_IND | \
EFFECT_FLAG_DEVICE_IND | \
- EFFECT_FLAG_OFFLOAD_SUPPORTED)
+ EFFECT_FLAG_OFFLOAD_SUPPORTED | \
+ EFFECT_FLAG_NO_PROCESS)
#define PRINT_STREAM_TYPE(i) ALOGV("descriptor found and is of stream type %s ",\
i == MUSIC?"MUSIC": \
@@ -332,41 +333,6 @@
return sample;
}
-static int vol_effect_process(effect_handle_t self,
- audio_buffer_t *in_buffer,
- audio_buffer_t *out_buffer)
-{
- int status = 0;
- ALOGV("%s Called ", __func__);
-
- vol_listener_context_t *context = (vol_listener_context_t *)self;
- pthread_mutex_lock(&vol_listner_init_lock);
-
- if (context->state != VOL_LISTENER_STATE_ACTIVE) {
- ALOGE("%s: state is not active .. return error", __func__);
- status = -EINVAL;
- goto exit;
- }
-
- // calculation based on channel count 2
- if (in_buffer->raw != out_buffer->raw) {
- if (context->config.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE) {
- size_t i;
- for (i = 0; i < out_buffer->frameCount*2; i++) {
- out_buffer->s16[i] = clamp16(out_buffer->s16[i] + in_buffer->s16[i]);
- }
- } else {
- memcpy(out_buffer->raw, in_buffer->raw, out_buffer->frameCount * 2 * sizeof(int16_t));
- }
-
- }
-
-exit:
- pthread_mutex_unlock(&vol_listner_init_lock);
- return status;
-}
-
-
static int vol_effect_command(effect_handle_t self,
uint32_t cmd_code, uint32_t cmd_size,
void *p_cmd_data, uint32_t *reply_size,
@@ -818,7 +784,7 @@
/* effect_handle_t interface implementation for volume listener effect */
static const struct effect_interface_s effect_interface = {
- vol_effect_process,
+ NULL,
vol_effect_command,
vol_effect_get_descriptor,
NULL,
diff --git a/visualizer/offload_visualizer.c b/visualizer/offload_visualizer.c
index 69cea57..c56ebff 100644
--- a/visualizer/offload_visualizer.c
+++ b/visualizer/offload_visualizer.c
@@ -869,9 +869,13 @@
case VISUALIZER_CMD_MEASURE: {
if (pReplyData == NULL || replySize == NULL ||
*replySize < (sizeof(int32_t) * MEASUREMENT_COUNT)) {
- ALOGV("%s VISUALIZER_CMD_MEASURE error *replySize %d <"
- "(sizeof(int32_t) * MEASUREMENT_COUNT) %d",
- __func__, *replySize, sizeof(int32_t) * MEASUREMENT_COUNT);
+ if (replySize == NULL) {
+ ALOGV("%s VISUALIZER_CMD_MEASURE error replySize NULL", __func__);
+ } else {
+ ALOGV("%s VISUALIZER_CMD_MEASURE error *replySize %u <"
+ "(sizeof(int32_t) * MEASUREMENT_COUNT) %zu",
+ __func__, *replySize, sizeof(int32_t) * MEASUREMENT_COUNT);
+ }
android_errorWriteLog(0x534e4554, "30229821");
return -EINVAL;
}