]> git.alsa-project.org Git - alsa-lib.git/commitdiff
dsnoop: The delay presented to snd_pcm_status_delay() was incorrect
authorMark Hills <mark@xwax.org>
Mon, 22 Jun 2020 13:15:10 +0000 (14:15 +0100)
committerTakashi Iwai <tiwai@suse.de>
Tue, 23 Jun 2020 10:57:08 +0000 (12:57 +0200)
This was the original bug that caused me to start looking at the
ring buffer functions.

In the API this is documented as:

  "Delay is distance between current application frame position and
   sound frame position. It's positive and less than buffer size in
   normal situation, negative on playback underrun and greater than
   buffer size on capture overrun. "

Because dsnoop was returning the buffer space available to the hardware
the return value was always quite large, and moved in the wrong
direction.

With this patch, dsnoop now gives results which are comparable to using
the "hw" device directly. My test case was with snd-echo3g (Layla3G).

Signed-off-by: Mark Hills <mark@xwax.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
src/pcm/pcm_local.h

index 89d4125b875d2c6072746470c0de6f6220bcd7a1..1fa8e61d2d368f30d339ed35a24305dbfbdb814c 100644 (file)
@@ -589,7 +589,7 @@ static inline snd_pcm_uframes_t snd_pcm_mmap_playback_delay(snd_pcm_t *pcm)
 
 static inline snd_pcm_uframes_t snd_pcm_mmap_capture_delay(snd_pcm_t *pcm)
 {
-       return snd_pcm_mmap_capture_hw_avail(pcm);
+       return snd_pcm_mmap_capture_avail(pcm);
 }
 
 static inline snd_pcm_sframes_t snd_pcm_mmap_delay(snd_pcm_t *pcm)