From e125261297a6c33b6f0f441bd446d79dfc7c5f9d Mon Sep 17 00:00:00 2001 From: Jaikrishna Nemallapudi Date: Wed, 12 Apr 2017 11:16:29 +0530 Subject: Fix to pass num_frames to pcm_writei pcm_writei expects size of data in frames, whereas currently size is passed as number of bytes. So convert number of bytes to frames for argument to pcm_writei. Signed-off-by: Jaikrishna Nemallapudi Signed-off-by: Subhransu S. Prusty --- utils/tinyplay.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/tinyplay.c b/utils/tinyplay.c index d0c1e36..ea7e115 100644 --- a/utils/tinyplay.c +++ b/utils/tinyplay.c @@ -409,7 +409,8 @@ int play_sample(struct ctx *ctx) do { num_read = fread(buffer, 1, size, ctx->file); if (num_read > 0) { - if (pcm_writei(ctx->pcm, buffer, num_read) < 0) { + if (pcm_writei(ctx->pcm, buffer, + pcm_bytes_to_frames(ctx->pcm, num_read)) < 0) { fprintf(stderr, "error playing sample\n"); break; } -- cgit v1.2.3