Re: aucat -e u16le doesn't work

From: Alexandre Ratchov <alex_at_caoua.org>
Date: Thu, 10 Dec 2020 22:13:29 +0100
On Thu, Dec 10, 2020 at 04:14:31AM +0000, James Cook wrote:
> As far as I can tell, aucat's u16le encoding is broken and behaves the
> same as s16le (on my little-endian amd64 system).
> 
> For example:
> 
>   aucat -c 0:0 -r 48000 -e u16le -i unsigned_samples
> 
> sounds garbled (where unsigned_samples has raw 16-bit little-endian
> unsigned samples), but if I pass in a file with signed samples instead,
> it sounds fine:
> 
>   aucat -c 0:0 -r 48000 -e u16le -i signed_samples
> 
> (that last command also works if I pass the correct encoding, "s16le",
> instead of "u16le" --- it sounds the same either way).
> 
> I also observe this with conversion. Here is an easy-to-reproduce
> example:
> 
>   aucat -n -e s16le -i /dev/zero -e u16le -o - | hexdump -v | head
> 
> This shows all zeros:
> 
> falsifian angel ~ $ aucat -n -e s16le -i /dev/zero -e u16le -o - | hexdump -v | head
> 0000000    0000    0000    0000    0000    0000    0000    0000    0000
> 0000010    0000    0000    0000    0000    0000    0000    0000    0000
> ...
> 
> but it should have changed the samples to 0x8000. By contrast,
> s16be->u16be or s32le->u32le seem to behave correctly, e.g.:
> 
> falsifian angel ~ $ aucat -n -e s16be -i /dev/zero -e u16be -o - | hexdump -v | head
> 0000000    0080    0080    0080    0080    0080    0080    0080    0080
> 0000010    0080    0080    0080    0080    0080    0080    0080    0080
> ...
> 
> I'm using aucat on OpenBSD current on an amd64 system.
> 
> Please cc me on replies.
> 

Thanks for the very precise report. The problem was that the
signedness check was missing when deciding whether to setup a format
conversion layer. This was causing aucat to consider u16 as its native
encoding, in turn skipping any conversions.

Now it's fixed (both OpenBSD and portable sndio), the same bug was
present in sndiod, it's fixed as well.
Received on Thu Dec 10 2020 - 22:13:29 CET

This archive was generated by hypermail 2.3.0 : Tue Aug 09 2022 - 16:23:50 CEST