It seem that audio_time.c is hardcoded to use 48000Hz which is the hda link rate, do the measurement still valid when application use 44100Hz ?
If you use a wallclock then you really abstract away the actual sampling
frequency and the transmission pattern discontinuity (12-11-11-12-11-11-12-11-11-11 pattern, with an invalid sample every 12 or 11 samples for HDAudio). It wouldn't matter if you transmitted 44.1 or 48kHz since they use the same wall clock ticks.
#define PERIOD 6000
#define PLAYBACK_BUFFERS 4
unsigned char buffer_p[PERIOD*4*4]; unsigned char buffer_c[PERIOD*4*4];
I don't understand why you hard coded PERIOD and PLAYBACK_BUFFERS when you use snd_pcm_set_params
since period size and buffer size can be obtained by snd_pcm_get_params() after calling snd_pcm_set_params()
if ((err = snd_pcm_set_params(handle_p, SND_PCM_FORMAT_S16, SND_PCM_ACCESS_RW_INTERLEAVED, 2, 48000, 0, 500000)) < 0) { /* 0.5sec */