Commit e581f1ce authored by Takashi Iwai's avatar Takashi Iwai

ALSA: usb-audio: Disable low-latency playback for free-wheel mode

The free-wheel stream operation like dmix may not update the appl_ptr
appropriately, and it doesn't fit with the low-latency playback mode.
Disable the low-latency playback operation when the stream is set up
in such a mode.

Link: https://lore.kernel.org/r/20210929080844.11583-5-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 9c9a3b9d
...@@ -582,7 +582,8 @@ static int snd_usb_hw_free(struct snd_pcm_substream *substream) ...@@ -582,7 +582,8 @@ static int snd_usb_hw_free(struct snd_pcm_substream *substream)
} }
/* check whether early start is needed for playback stream */ /* check whether early start is needed for playback stream */
static int lowlatency_playback_available(struct snd_usb_substream *subs) static int lowlatency_playback_available(struct snd_pcm_runtime *runtime,
struct snd_usb_substream *subs)
{ {
struct snd_usb_audio *chip = subs->stream->chip; struct snd_usb_audio *chip = subs->stream->chip;
...@@ -591,6 +592,9 @@ static int lowlatency_playback_available(struct snd_usb_substream *subs) ...@@ -591,6 +592,9 @@ static int lowlatency_playback_available(struct snd_usb_substream *subs)
/* disabled via module option? */ /* disabled via module option? */
if (!chip->lowlatency) if (!chip->lowlatency)
return false; return false;
/* free-wheeling mode? (e.g. dmix) */
if (runtime->stop_threshold > runtime->buffer_size)
return false;
/* too short periods? */ /* too short periods? */
if (subs->data_endpoint->nominal_queue_size >= subs->buffer_bytes) if (subs->data_endpoint->nominal_queue_size >= subs->buffer_bytes)
return false; return false;
...@@ -630,7 +634,7 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream) ...@@ -630,7 +634,7 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream)
subs->period_elapsed_pending = 0; subs->period_elapsed_pending = 0;
runtime->delay = 0; runtime->delay = 0;
subs->lowlatency_playback = lowlatency_playback_available(subs); subs->lowlatency_playback = lowlatency_playback_available(runtime, subs);
if (!subs->lowlatency_playback) if (!subs->lowlatency_playback)
ret = start_endpoints(subs); ret = start_endpoints(subs);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment