diff options
author | 2017-11-07 11:39:24 +0000 | |
---|---|---|
committer | 2017-11-07 11:39:24 +0000 | |
commit | f28a76d8b4e6eda95fcabd36bb0334f9f11d92ee (patch) | |
tree | cad1650ce0e0ed949b8645cfbc0cdde58073bd36 | |
parent | Remove unused debug macro. (diff) | |
download | wireguard-openbsd-f28a76d8b4e6eda95fcabd36bb0334f9f11d92ee.tar.xz wireguard-openbsd-f28a76d8b4e6eda95fcabd36bb0334f9f11d92ee.zip |
prefill with silence the buffer where cmap_copy() stores samples
rather than the file buffer. Fixes initialized data being treated as
recorded samples when resampling or format conversions are involved
but mono->stereo conversion is disabled.
-rw-r--r-- | usr.bin/aucat/aucat.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/usr.bin/aucat/aucat.c b/usr.bin/aucat/aucat.c index 5c4f5667a65..b2a50f8e0cd 100644 --- a/usr.bin/aucat/aucat.c +++ b/usr.bin/aucat/aucat.c @@ -345,7 +345,20 @@ slot_init(struct slot *s) enc_init(&s->conv, &s->afile.par, slot_nch); s->convbuf = xmalloc(s->round * slot_nch * sizeof(adata_t)); - enc_sil_do(&s->conv, s->buf.data, bufsz); + } + + /* + * cmap_copy() doesn't write samples in all channels, + * for instance when mono->stereo conversion is + * disabled. So we have to prefill cmap_copy() output + * with silence. + */ + if (s->resampbuf) { + memset(s->resampbuf, 0, + dev_round * slot_nch * sizeof(adata_t)); + } else if (s->convbuf) { + memset(s->convbuf, 0, + s->round * slot_nch * sizeof(adata_t)); } else { memset(s->buf.data, 0, bufsz * slot_nch * sizeof(adata_t)); |