mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2026-03-14 05:33:43 -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 writebuf(snd_pcm_t *handle, char *buf, long len, size_t *frames)
|
||||||
{
|
{
|
||||||
long r;
|
long r;
|
||||||
|
int frame_bytes = (snd_pcm_format_width(format) / 8) * channels;
|
||||||
|
|
||||||
while (len > 0) {
|
while (len > 0) {
|
||||||
r = snd_pcm_writei(handle, buf, len);
|
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)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
// showstat(handle, 0);
|
// showstat(handle, 0);
|
||||||
buf += r * 4;
|
buf += r * frame_bytes;
|
||||||
len -= r;
|
len -= r;
|
||||||
*frames += r;
|
*frames += r;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue