diff options
author | Jaikrishna Nemallapudi <jaikrishnax.nemallapudi@intel.com> | 2017-04-12 11:16:29 +0530 |
---|---|---|
committer | Subhransu S. Prusty <subhransu.s.prusty@intel.com> | 2017-04-13 14:06:15 +0530 |
commit | e125261297a6c33b6f0f441bd446d79dfc7c5f9d (patch) | |
tree | a8dba0b35f32f05d0ea7b7d0e216fad68b12424c /utils | |
parent | 001b25ef86c1b3843a6c05d41968eb77b2abf905 (diff) |
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 <jaikrishnax.nemallapudi@intel.com>
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Diffstat (limited to 'utils')
-rw-r--r-- | utils/tinyplay.c | 3 |
1 files changed, 2 insertions, 1 deletions
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; } |