[alsa-devel] Timer instability

Takashi Iwai tiwai at suse.de
Wed Feb 25 16:51:33 CET 2009


At Wed, 25 Feb 2009 15:11:44 +0000,
Clive Messer wrote:
> 36192	36191	100068	3	0	0	1	2
> 36195	36194	100090	2	0	0	1	2
> 36198	36198	100113	1	0	0	1	2
> 36207	36206	63854	2816	1600	0	1	3
> 36212	36211	63854	2815	1601	4	1	3
> 36216	36216	63854	2814	1602	4	1	3
> 36221	36220	63854	2813	1603	4	1	3
> 36225	36225	101224	4460	-44	4	1	3

This is pretty weird.  Is this behavior always reproducible?
What shows with the patch below to alsa-lib?

Also, any change if you play with position_fix parameter, such as,
position_fix=1?


Takashi

---
diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c
index e9ce092..9b91a13 100644
--- a/src/pcm/pcm_hw.c
+++ b/src/pcm/pcm_hw.c
@@ -539,6 +539,10 @@ static int snd_pcm_hw_hwsync(snd_pcm_t *pcm)
 {
 	snd_pcm_hw_t *hw = pcm->private_data;
 	int fd = hw->fd, err;
+	long old_hwptr, new_hwptr;
+	long old_applptr, new_applptr;
+	old_hwptr = *pcm->hw.ptr;
+	old_applptr = *pcm->appl.ptr;
 	if (SNDRV_PROTOCOL_VERSION(2, 0, 3) <= hw->version) {
 		if (hw->sync_ptr) {
 			err = sync_ptr1(hw, SNDRV_PCM_SYNC_PTR_HWSYNC);
@@ -564,6 +568,11 @@ static int snd_pcm_hw_hwsync(snd_pcm_t *pcm)
 			}
 		}
 	}
+	new_hwptr = *pcm->hw.ptr;
+	new_applptr = *pcm->appl.ptr;
+	printf("hwsync: %ld(%ld), %ld(%ld)\n",
+	       new_hwptr, new_hwptr - old_hwptr,
+	       new_applptr, new_applptr - old_applptr);
 	return 0;
 }
 


More information about the Alsa-devel mailing list