mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-29 05:40:25 -04:00
test/latency: use frame bytes correctly in writebuf()
Reported-by: Alessandro Lapini <alessandro.lapini@gmail.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
7cea8c1562
commit
deb07a0b20
1 changed files with 2 additions and 1 deletions
|
|
@ -374,6 +374,7 @@ long readbuf(snd_pcm_t *handle, char *buf, long len, size_t *frames, size_t *max
|
|||
long writebuf(snd_pcm_t *handle, char *buf, long len, size_t *frames)
|
||||
{
|
||||
long r;
|
||||
int frame_bytes = (snd_pcm_format_width(format) / 8) * channels;
|
||||
|
||||
while (len > 0) {
|
||||
r = snd_pcm_writei(handle, buf, len);
|
||||
|
|
@ -383,7 +384,7 @@ long writebuf(snd_pcm_t *handle, char *buf, long len, size_t *frames)
|
|||
if (r < 0)
|
||||
return r;
|
||||
// showstat(handle, 0);
|
||||
buf += r * 4;
|
||||
buf += r * frame_bytes;
|
||||
len -= r;
|
||||
*frames += r;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue