diff options
Diffstat (limited to 'sound/core')
-rw-r--r-- | sound/core/pcm_lib.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index db3d7e934ec3..2d3e70b2fe3e 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c | |||
@@ -1497,14 +1497,18 @@ void snd_pcm_tick_prepare(struct snd_pcm_substream *substream) | |||
1497 | avail = snd_pcm_capture_avail(runtime); | 1497 | avail = snd_pcm_capture_avail(runtime); |
1498 | } | 1498 | } |
1499 | if (avail < runtime->control->avail_min) { | 1499 | if (avail < runtime->control->avail_min) { |
1500 | snd_pcm_sframes_t n = runtime->control->avail_min - avail; | 1500 | snd_pcm_sframes_t to_avail_min = |
1501 | if (n > 0 && frames > (snd_pcm_uframes_t)n) | 1501 | runtime->control->avail_min - avail; |
1502 | frames = n; | 1502 | if (to_avail_min > 0 && |
1503 | frames > (snd_pcm_uframes_t)to_avail_min) | ||
1504 | frames = to_avail_min; | ||
1503 | } | 1505 | } |
1504 | if (avail < runtime->buffer_size) { | 1506 | if (avail < runtime->buffer_size) { |
1505 | snd_pcm_sframes_t n = runtime->buffer_size - avail; | 1507 | snd_pcm_sframes_t to_buffer_size = |
1506 | if (n > 0 && frames > (snd_pcm_uframes_t)n) | 1508 | runtime->buffer_size - avail; |
1507 | frames = n; | 1509 | if (to_buffer_size > 0 && |
1510 | frames > (snd_pcm_uframes_t)to_buffer_size) | ||
1511 | frames = to_buffer_size; | ||
1508 | } | 1512 | } |
1509 | if (frames == ULONG_MAX) { | 1513 | if (frames == ULONG_MAX) { |
1510 | snd_pcm_tick_set(substream, 0); | 1514 | snd_pcm_tick_set(substream, 0); |