]> git.alsa-project.org Git - alsa-lib.git/commitdiff
dsnoop: The stop threshold was not implemented correctly
authorMark Hills <mark@xwax.org>
Mon, 22 Jun 2020 13:15:12 +0000 (14:15 +0100)
committerTakashi Iwai <tiwai@suse.de>
Tue, 23 Jun 2020 10:59:00 +0000 (12:59 +0200)
The previous implementation would mean that stop_threshold behaved
erratically. The intent is to detect that the buffer is too full,
and stop.

In practice, I don't think this was a bug in practice for applications
which don't adjust the stop_threshold. The line above catches those cases.

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

index c64df381e2250b8c02d0ba763fd27183df83b9e2..790d944c3526416cab4f9350e9cc8b6c472c3bbd 100644 (file)
@@ -165,7 +165,7 @@ static int snd_pcm_dsnoop_sync_ptr(snd_pcm_t *pcm)
        // printf("sync ptr diff = %li\n", diff);
        if (pcm->stop_threshold >= pcm->boundary)       /* don't care */
                return 0;
-       if ((avail = snd_pcm_mmap_capture_hw_avail(pcm)) >= pcm->stop_threshold) {
+       if ((avail = snd_pcm_mmap_capture_avail(pcm)) >= pcm->stop_threshold) {
                gettimestamp(&dsnoop->trigger_tstamp, pcm->tstamp_type);
                dsnoop->state = SND_PCM_STATE_XRUN;
                dsnoop->avail_max = avail;