[Development report #18] Audio Stack Improvements

From: Christos Margiolis <christos_at_freebsd.org>
Date: Tue, 30 Jul 2024 14:18:20 UTC
Submitted talk related to the project, for the 09/2024 DevSummit in
Dublin, Ireland.

Implementing audio(8).

mixer(8): Make mute and recsrc argument parsing more robust:
https://cgit.freebsd.org/src/commit/?id=8ca73331ef810cd0e0b9e3c37cddc1d89fbe8c6b

sound: Implement dummy driver:
https://cgit.freebsd.org/src/commit/?id=c15c9315b2cb7601cc337f7d5a8e124f4b2d5861

sound tests: Add sndstat nvlist ATF test:
https://cgit.freebsd.org/src/commit/?id=95eb4b873b6a8b527c5bd78d7191975dfca38998

mixer(8): Add tests:
https://cgit.freebsd.org/src/commit/?id=94a86f3f69205a6de3c07ae60daf4f5f920e9b82

sound examples: Organize files in directories:
https://cgit.freebsd.org/src/commit/?id=cb00491fbc51751fe166056cc69e23beeb26fee4

sound examples: Add sndstat nvlist example:
https://cgit.freebsd.org/src/commit/?id=f08ecd24a19ba772701fc35caaad92b9fe91fa9c

sound: Fix memory leak in chn_init():
https://cgit.freebsd.org/src/commit/?id=16329b7b3276f09dc70bdd1ca8bc605546fe71e0

Fixed a panic reported by Peter Holm, related to fc76e24e583d (”sound:
Fix lock order reversals in mseq_open()”), which was triggered by
stress2. Eventually saw that rew@ had already committed the same fix:
https://cgit.freebsd.org/src/commit/?id=3114d55866b86ca1132923211936aa23881b0057

snd_hdsp*: Free up channel resources in case of CHANNEL_INIT() failure:
https://cgit.freebsd.org/src/commit/?id=85d1c84c2406aa2e4e2114215b01eee65714848f

sound: Simplify chn_init():
https://cgit.freebsd.org/src/commit/?id=5b209e153b58515c0315f5902e18ecd7d75ecd2a

sound: Rename chn_* feeder functions to feeder_*:
https://cgit.freebsd.org/src/commit/?id=29ff7b08be363f0d4345794bb951d5c0c8406a0a

sound: Remove unused FEEDER_DEBUG:
https://cgit.freebsd.org/src/commit/?id=c55f995502cbaa2d38b7a7003bc27805b28a6a29

sound: Remove unused defines from pcm/sound.h:
https://cgit.freebsd.org/src/commit/?id=f477d412530a8cb9d8e058d00189ce127584f6f6

sound: Simplify feeder_remove():
https://cgit.freebsd.org/src/commit/?id=00172d20070a544e0514cce9f94475c5525fd15e

sound: Add device status string to sndstat nvlist:
https://cgit.freebsd.org/src/commit/?id=810530aa2648812860e84d951d9cf96dfd24e595

sound: Add *vchanrate and *vchanformat to sndstat nvlist:
https://cgit.freebsd.org/src/commit/?id=a6283717577066b0ff6c62053145470ff4134051

sound: Add OSS channel capabilities to sndstat nvlist:
https://cgit.freebsd.org/src/commit/?id=bd5bcc848c5764229926ad27a4bd77af4f87d189

sndstat.4: Fix typo:
https://cgit.freebsd.org/src/commit/?id=f0eceecf5ab51a68d713f9a5a7f360964d0a49ce

sound: Fix VCHANs' starting and ending points in feeder chain:
https://reviews.freebsd.org/D46177

Working on PR 280315:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=280315

Working on PR 280319:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=280319

Posted my audio(3) WIP for an initial discussion and constructive
criticism. After consideration of Florian’s comments (even though I have
some disagreements) and some of the potential ideas we discussed, I
think it’s better to put the library on the backburner for a while, as
it requires more discussion with other audio developers and a better
implementation. Since I am 1.5 months away from the contract’s deadline,
I think it’s better to focus on the rest of the deliverables, which are
more important to the regular user than the library.

Contacted hccontrol(8)’s author and wulf@ about hccontrol(8)’s lack of
stability. They told me the problem is most likely in the bluetooth
stack code itself, and not hccontrol(8). I am considering continuing the
development of bluetooth device management utility, but in any case I
will not guarantee its stability. Both the people I emailed told me that
all bluetooth utilities seem to be very unstable at this point.

MFC’d all recent patches to stable/14.

This work is sponsored by the FreeBSD Foundation.

Christos