From 0e37ab93b7c611d4c1f94c4bfbee7acf312c9aec Mon Sep 17 00:00:00 2001 From: Jonathan Aillet Date: Wed, 7 Nov 2018 16:52:38 +0900 Subject: Tweaking debug prints Replace some 'printf' by application framework debug functions. Improve 'ALSA_PCM_UID' macro. Correct minor errors in debug prints. Change-Id: I49899fd904d42b5b3bec46017eb319ed7d321dc5 Signed-off-by: Jonathan Aillet --- plugins/alsa/alsa-api-pcm.c | 2 +- plugins/alsa/alsa-core-pcm.c | 22 +++++++++++----------- plugins/alsa/alsa-utils-dump.c | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) (limited to 'plugins/alsa') diff --git a/plugins/alsa/alsa-api-pcm.c b/plugins/alsa/alsa-api-pcm.c index 5b6d3f5..1bba75c 100644 --- a/plugins/alsa/alsa-api-pcm.c +++ b/plugins/alsa/alsa-api-pcm.c @@ -394,7 +394,7 @@ PUBLIC AlsaPcmHwInfoT * ApiPcmSetParams(SoftMixerT *mixer, const char *uid, json FORMAT_CHECK(FLOAT_LE); FORMAT_CHECK(FLOAT_BE); - AFB_ApiNotice(mixer->api, "ApiPcmSetParams:%s(params) unsupported format 'S16_LE|S32_L|...' format=%s", uid, format); + AFB_ApiError(mixer->api, "ApiPcmSetParams:%s(params) unsupported format 'S16_LE|S32_L|...' format=%s", uid, format); goto OnErrorExit; check_access: diff --git a/plugins/alsa/alsa-core-pcm.c b/plugins/alsa/alsa-core-pcm.c index f80b1e4..509e1ac 100644 --- a/plugins/alsa/alsa-core-pcm.c +++ b/plugins/alsa/alsa-core-pcm.c @@ -345,7 +345,7 @@ STATIC int AlsaPcmReadCB( struct pollfd * pfd, AlsaPcmCopyHandleT * pcmCopyHandl if (availIn <= 0) { if (availIn == -EPIPE) { int ret = xrun(pcmIn, (int)availIn); - printf("XXX read EPIPE (recov=%d) !\n", ret); + AFB_ApiDebug(pcmCopyHandle->api, "XXX read EPIPE (recov=%d) {%s}!", ret, ALSA_PCM_UID(pcmIn, string)); // For some (undocumented...) reason, a start is mandatory. snd_pcm_start(pcmIn); @@ -392,10 +392,10 @@ STATIC int AlsaPcmReadCB( struct pollfd * pfd, AlsaPcmCopyHandleT * pcmCopyHandl if (r < 0) { if (r == -EPIPE) { err = xrun(pcmIn, (int)r); - printf("read EPIPE (%d), recov %d\n", ++pcmCopyHandle->read_err_count, err); + AFB_ApiDebug(pcmCopyHandle->api, "read EPIPE (%d), recov %d", ++pcmCopyHandle->read_err_count, err); goto ExitOnSuccess; } else if (r == -ESTRPIPE) { - printf("read ESTRPIPE\n"); + AFB_ApiDebug(pcmCopyHandle->api, "read ESTRPIPE"); if ((err = suspend(pcmIn, (int)r)) < 0) goto ExitOnSuccess; r = 0; @@ -567,12 +567,12 @@ static void *writeThreadEntry(void *handle) { if (availOut < 0) { if (availOut == -EPIPE) { - printf("write update EPIPE\n"); + AFB_ApiDebug(pcmCopyHandle->api, "write update EPIPE"); xrun(pcmOut, (int)availOut); continue; } if (availOut == -ESTRPIPE) { - printf("write update ESTRPIPE\n"); + AFB_ApiDebug(pcmCopyHandle->api, "write update ESTRPIPE"); suspend(pcmOut, (int)availOut); continue; } @@ -602,14 +602,14 @@ static void *writeThreadEntry(void *handle) { if (r <= 0) { if (r == -EPIPE) { int err = xrun(pcmOut, (int)r); - printf("XXX write EPIPE (%d), recov %d\n", ++pcmCopyHandle->write_err_count , err); + AFB_ApiDebug(pcmCopyHandle->api, "XXX write EPIPE (%d), recov %d", ++pcmCopyHandle->write_err_count , err); continue; } else if (r == -ESTRPIPE) { - printf("XXX write ESTRPIPE\n"); + AFB_ApiDebug(pcmCopyHandle->api, "XXX write ESTRPIPE"); break; } - printf("Unhandled error %s\n", strerror(errno)); + AFB_ApiDebug(pcmCopyHandle->api, "Unhandled error %s", strerror(errno)); break; } @@ -741,9 +741,9 @@ PUBLIC int AlsaPcmCopy(SoftMixerT *mixer, AlsaStreamAudioT *stream, AlsaPcmCtlT int pMuteFd[2]; error = pipe(pMuteFd); if (error < 0) { - AFB_ApiError(mixer->api, - "Unable to create the mute signaling pipe\n"); - goto OnErrorExit; + AFB_ApiError(mixer->api, + "Unable to create the mute signaling pipe"); + goto OnErrorExit; } struct pollfd mutePFd; diff --git a/plugins/alsa/alsa-utils-dump.c b/plugins/alsa/alsa-utils-dump.c index 34ed568..b6c011d 100644 --- a/plugins/alsa/alsa-utils-dump.c +++ b/plugins/alsa/alsa-utils-dump.c @@ -45,7 +45,7 @@ PUBLIC char *AlsaDumpPcmUid(snd_pcm_t *pcmHandle, char *buffer, size_t len) { int pcmCard = snd_pcm_info_get_card(pcmInfo); const char *pcmName = snd_pcm_info_get_name(pcmInfo); - snprintf(buffer, len, "hw:%i [%s]", pcmCard, pcmName); + snprintf(buffer, len, "hw:%i [%s](%i,%i)", pcmCard, pcmName, snd_pcm_info_get_device(pcmInfo), snd_pcm_info_get_subdevice(pcmInfo)); return buffer; OnErrorExit: -- cgit 1.2.3-korg