Commit 9c98cf7e authored by Jaroslav Kysela's avatar Jaroslav Kysela

[ALSA] Fix bugs with incorrectly wrapped appl_ptr

PCM Midlevel
    This patch is against alsa-driver-1.0.8.
    It covers:
        alsa-kernel/core/pcm_lib.c
    The main changes are in the first listed file.

    It corresponds to bug description:
        <https://bugtrack.alsa-project.org/alsa-bug/view.php?id=951>

    The patch does cosmetic change:

     -- Better, more universal and smaller wrapping to within
        0..runtime->boundary-1 in functions snd_pcm_lib_write1() and
        snd_pcm_lib_read1() in pcm_lib.c
Signed-off-by: default avatarCharles Levert <charles_levert@gna.org>
Signed-off-by: default avatarJaroslav Kysela <perex@suse.cz>
parent 7eb90579
......@@ -2141,11 +2141,9 @@ static snd_pcm_sframes_t snd_pcm_lib_write1(snd_pcm_substream_t *substream,
break;
}
appl_ptr += frames;
if (appl_ptr >= runtime->boundary) {
runtime->control->appl_ptr = 0;
} else {
runtime->control->appl_ptr = appl_ptr;
}
if (appl_ptr >= runtime->boundary)
appl_ptr -= runtime->boundary;
runtime->control->appl_ptr = appl_ptr;
if (substream->ops->ack)
substream->ops->ack(substream);
......@@ -2440,11 +2438,9 @@ static snd_pcm_sframes_t snd_pcm_lib_read1(snd_pcm_substream_t *substream,
break;
}
appl_ptr += frames;
if (appl_ptr >= runtime->boundary) {
runtime->control->appl_ptr = 0;
} else {
runtime->control->appl_ptr = appl_ptr;
}
if (appl_ptr >= runtime->boundary)
appl_ptr -= runtime->boundary;
runtime->control->appl_ptr = appl_ptr;
if (substream->ops->ack)
substream->ops->ack(substream);
......
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