dsnoop: The stop threshold was not implemented correctly

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>
This commit is contained in:
Mark Hills 2020-06-22 14:15:12 +01:00 committed by Takashi Iwai
parent 243105769b
commit 19c7de16fd

View file

@ -165,7 +165,7 @@ static int snd_pcm_dsnoop_sync_ptr(snd_pcm_t *pcm)
// printf("sync ptr diff = %li\n", diff); // printf("sync ptr diff = %li\n", diff);
if (pcm->stop_threshold >= pcm->boundary) /* don't care */ if (pcm->stop_threshold >= pcm->boundary) /* don't care */
return 0; 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); gettimestamp(&dsnoop->trigger_tstamp, pcm->tstamp_type);
dsnoop->state = SND_PCM_STATE_XRUN; dsnoop->state = SND_PCM_STATE_XRUN;
dsnoop->avail_max = avail; dsnoop->avail_max = avail;