Skip to content

Commit f3dc944

Browse files
authored
Merge pull request #2537 from metalefty/sound-log
sound: logging improvements
2 parents 9bab8e0 + 9d7a817 commit f3dc944

File tree

3 files changed

+46
-12
lines changed

3 files changed

+46
-12
lines changed

sesman/chansrv/audin.c

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,27 @@ static struct xr_wave_format_ex **g_client_formats = NULL;
8888

8989
static int g_current_format = 0; /* index in g_client_formats */
9090

91+
/*****************************************************************************/
92+
93+
/*
94+
* This can be called from sound.c because it includes audin.h.
95+
*/
96+
97+
const char *
98+
audin_wave_format_tag_to_str(int tag)
99+
{
100+
return
101+
(tag == WAVE_FORMAT_PCM) ? "WAVE_FORMAT_PCM" :
102+
(tag == WAVE_FORMAT_ADPCM) ? "WAVE_FORMAT_ADPCM" :
103+
(tag == WAVE_FORMAT_ALAW) ? "WAVE_FORMAT_ALAW" :
104+
(tag == WAVE_FORMAT_MULAW) ? "WAVE_FORMAT_MULAW" :
105+
(tag == WAVE_FORMAT_MULAW) ? "WAVE_FORMAT_MULAW" :
106+
(tag == WAVE_FORMAT_MPEGLAYER3) ? "WAVE_FORMAT_MPEGLAYER3" :
107+
(tag == WAVE_FORMAT_OPUS) ? "WAVE_FORMAT_OPUS" :
108+
(tag == WAVE_FORMAT_AAC) ? "WAVE_FORMAT_AAC" :
109+
"UNKNOWN";
110+
}
111+
91112
/*****************************************************************************/
92113
static int
93114
cleanup_client_formats(void)
@@ -261,9 +282,17 @@ audin_process_formats(int chan_id, struct stream *s)
261282
in_uint16_le(s, wf->nBlockAlign);
262283
in_uint16_le(s, wf->wBitsPerSample);
263284
in_uint16_le(s, wf->cbSize);
264-
LOG_DEVEL(LOG_LEVEL_INFO, "audin_process_formats: recved format wFormatTag 0x%4.4x "
265-
"nChannels %d nSamplesPerSec %d",
266-
wf->wFormatTag, wf->nChannels, wf->nSamplesPerSec);
285+
286+
LOG(LOG_LEVEL_INFO, "audin_process_formats:");
287+
LOG(LOG_LEVEL_INFO, " wFormatNo %d", index);
288+
LOG(LOG_LEVEL_INFO, " wFormatTag %s", audin_wave_format_tag_to_str(wf->wFormatTag));
289+
LOG(LOG_LEVEL_INFO, " nChannels %d", wf->nChannels);
290+
LOG(LOG_LEVEL_INFO, " nSamplesPerSec %d", wf->nSamplesPerSec);
291+
LOG(LOG_LEVEL_INFO, " nAvgBytesPerSec %d", wf->nAvgBytesPerSec);
292+
LOG(LOG_LEVEL_INFO, " nBlockAlign %d", wf->nBlockAlign);
293+
LOG(LOG_LEVEL_INFO, " wBitsPerSample %d", wf->wBitsPerSample);
294+
LOG(LOG_LEVEL_INFO, " cbSize %d", wf->cbSize);
295+
267296
if (wf->cbSize > 0)
268297
{
269298
if (!s_check_rem(s, wf->cbSize))

sesman/chansrv/audin.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
#ifndef _AUDIN_H_
2323
#define _AUDIN_H_
2424

25+
const char *
26+
audin_wave_format_tag_to_str(int tag);
2527
int
2628
audin_init(void);
2729
int

sesman/chansrv/sound.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -369,14 +369,15 @@ sound_process_output_format(int aindex, int wFormatTag, int nChannels,
369369
int nBlockAlign, int wBitsPerSample,
370370
int cbSize, char *data)
371371
{
372-
LOG_DEVEL(LOG_LEVEL_INFO, "sound_process_output_format:");
373-
LOG_DEVEL(LOG_LEVEL_INFO, " wFormatTag %d", wFormatTag);
374-
LOG_DEVEL(LOG_LEVEL_INFO, " nChannels %d", nChannels);
375-
LOG_DEVEL(LOG_LEVEL_INFO, " nSamplesPerSec %d", nSamplesPerSec);
376-
LOG_DEVEL(LOG_LEVEL_INFO, " nAvgBytesPerSec %d", nAvgBytesPerSec);
377-
LOG_DEVEL(LOG_LEVEL_INFO, " nBlockAlign %d", nBlockAlign);
378-
LOG_DEVEL(LOG_LEVEL_INFO, " wBitsPerSample %d", wBitsPerSample);
379-
LOG_DEVEL(LOG_LEVEL_INFO, " cbSize %d", cbSize);
372+
LOG(LOG_LEVEL_INFO, "sound_process_output_format:");
373+
LOG(LOG_LEVEL_INFO, " wFormatNo %d", aindex);
374+
LOG(LOG_LEVEL_INFO, " wFormatTag %s", audin_wave_format_tag_to_str(wFormatTag));
375+
LOG(LOG_LEVEL_INFO, " nChannels %d", nChannels);
376+
LOG(LOG_LEVEL_INFO, " nSamplesPerSec %d", nSamplesPerSec);
377+
LOG(LOG_LEVEL_INFO, " nAvgBytesPerSec %d", nAvgBytesPerSec);
378+
LOG(LOG_LEVEL_INFO, " nBlockAlign %d", nBlockAlign);
379+
LOG(LOG_LEVEL_INFO, " wBitsPerSample %d", wBitsPerSample);
380+
LOG(LOG_LEVEL_INFO, " cbSize %d", cbSize);
380381

381382
LOG_DEVEL_HEXDUMP(LOG_LEVEL_TRACE, "", data, cbSize);
382383

@@ -898,6 +899,8 @@ sound_send_wave_data_chunk(char *data, int data_bytes)
898899
format_index = g_current_client_format_index;
899900
data_bytes = sound_wave_compress(data, data_bytes, &format_index);
900901

902+
LOG(LOG_LEVEL_TRACE, "sound_send_wave_data_chunk: wFormatNo %d", format_index);
903+
901904
/* part one of 2 PDU wave info */
902905

903906
LOG_DEVEL(LOG_LEVEL_DEBUG, "sound_send_wave_data_chunk: sending %d bytes", data_bytes);
@@ -1057,7 +1060,7 @@ sound_process_wave_confirm(struct stream *s, int size)
10571060
in_uint8(s, cConfirmedBlockNo);
10581061
time_diff = time - g_sent_time[cConfirmedBlockNo & 0xff];
10591062

1060-
LOG(LOG_LEVEL_DEBUG, "sound_process_wave_confirm: wTimeStamp %d, "
1063+
LOG(LOG_LEVEL_TRACE, "sound_process_wave_confirm: wTimeStamp %d, "
10611064
"cConfirmedBlockNo %d time diff %d",
10621065
wTimeStamp, cConfirmedBlockNo, time_diff);
10631066

0 commit comments

Comments
 (0)