hal: Enhance compress offload logging
Add/Enable msg logging
-Salient funtion calls to tinycompress
-Salient funtion calls from frameworks
-Events sent to frameworks
-miscellaneous important events
Change-Id: I493d98d3f3c1216f7c6030a539e01d1f2dd8c202
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 13c3bec..fe0d8dd 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -1166,26 +1166,32 @@
send_callback = false;
switch(cmd->cmd) {
case OFFLOAD_CMD_WAIT_FOR_BUFFER:
+ ALOGD("copl(%x):calling compress_wait", (unsigned int)out);
compress_wait(out->compr, -1);
+ ALOGD("copl(%x):out of compress_wait", (unsigned int)out);
send_callback = true;
event = STREAM_CBK_EVENT_WRITE_READY;
break;
case OFFLOAD_CMD_PARTIAL_DRAIN:
ret = compress_next_track(out->compr);
- if(ret == 0)
+ if(ret == 0) {
+ ALOGD("copl(%x):calling compress_partial_drain", (unsigned int)out);
compress_partial_drain(out->compr);
+ ALOGD("copl(%x):out of compress_partial_drain", (unsigned int)out);
+ }
else if(ret == -ETIMEDOUT)
compress_drain(out->compr);
else
ALOGE("%s: Next track returned error %d",__func__, ret);
-
send_callback = true;
event = STREAM_CBK_EVENT_DRAIN_READY;
/* Resend the metadata for next iteration */
out->send_new_metadata = 1;
break;
case OFFLOAD_CMD_DRAIN:
+ ALOGD("copl(%x):calling compress_drain", (unsigned int)out);
compress_drain(out->compr);
+ ALOGD("copl(%x):calling compress_drain", (unsigned int)out);
send_callback = true;
event = STREAM_CBK_EVENT_DRAIN_READY;
break;
@@ -1384,6 +1390,8 @@
goto error_config;
}
+ ALOGD("%s: enter: usecase(%d: %s) devices(%#x)",
+ __func__, out->usecase, use_case_table[out->usecase], out->devices);
out->pcm_device_id = platform_get_pcm_device_id(out->usecase, PCM_PLAYBACK);
if (out->pcm_device_id < 0) {
ALOGE("%s: Invalid PCM device id(%d) for the usecase(%d)",
@@ -1626,6 +1634,7 @@
out->pcm = NULL;
}
} else {
+ ALOGD("copl(%x):standby", (unsigned int)out);
stop_compressed_output_l(out);
out->gapless_mdata.encoder_delay = 0;
out->gapless_mdata.encoder_padding = 0;
@@ -2016,9 +2025,9 @@
}
if (is_offload_usecase(out->usecase)) {
- ALOGVV("%s: writing buffer (%d bytes) to compress device", __func__, bytes);
+ ALOGD("copl(%x): writing buffer (%d bytes) to compress device", (unsigned int)out, bytes);
if (out->send_new_metadata) {
- ALOGVV("send new gapless metadata");
+ ALOGD("copl(%x):send new gapless metadata", (unsigned int)out);
compress_set_gapless_metadata(out->compr, &out->gapless_mdata);
out->send_new_metadata = 0;
}
@@ -2028,6 +2037,7 @@
ret = -errno;
ALOGVV("%s: writing buffer (%d bytes) to compress device returned %d", __func__, bytes, ret);
if (ret >= 0 && ret < (ssize_t)bytes) {
+ ALOGD("No space available in compress driver, post msg to cb thread");
send_offload_cmd_l(out, OFFLOAD_CMD_WAIT_FOR_BUFFER);
} else if (-ENETRESET == ret) {
ALOGE("copl %s: received sound card offline state on compress write", __func__);
@@ -2200,6 +2210,7 @@
int status = -ENOSYS;
ALOGV("%s", __func__);
if (is_offload_usecase(out->usecase)) {
+ ALOGD("copl(%x):pause compress driver", (unsigned int)out);
pthread_mutex_lock(&out->lock);
if (out->compr != NULL && out->offload_state == OFFLOAD_STATE_PLAYING) {
struct audio_device *adev = out->dev;
@@ -2221,6 +2232,7 @@
int status = -ENOSYS;
ALOGV("%s", __func__);
if (is_offload_usecase(out->usecase)) {
+ ALOGD("copl(%x):resume compress driver", (unsigned int)out);
status = 0;
pthread_mutex_lock(&out->lock);
if (out->compr != NULL && out->offload_state == OFFLOAD_STATE_PAUSED) {
@@ -2258,9 +2270,11 @@
struct stream_out *out = (struct stream_out *)stream;
ALOGV("%s", __func__);
if (is_offload_usecase(out->usecase)) {
+ ALOGD("copl(%x):calling compress flush", (unsigned int)out);
pthread_mutex_lock(&out->lock);
stop_compressed_output_l(out);
pthread_mutex_unlock(&out->lock);
+ ALOGD("copl(%x):out of compress flush", (unsigned int)out);
return 0;
}
return -ENOSYS;
@@ -2662,6 +2676,9 @@
}
#endif
} else if (out->flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) {
+ ALOGD("%s: copl(%x): sample_rate(%d) channel_mask(%#x) devices(%#x) flags(%#x)",
+ __func__, (unsigned int)out, config->sample_rate, config->channel_mask, devices, flags);
+
if (config->offload_info.version != AUDIO_INFO_INITIALIZER.version ||
config->offload_info.size != AUDIO_INFO_INITIALIZER.size) {
ALOGE("%s: Unsupported Offload information", __func__);