Page MenuHomeFreeBSD

sound: Bail out early if a format is not supported
Needs ReviewPublic

Authored by christos on Dec 11 2024, 4:47 PM.
Tags
None
Referenced Files
F109905320: D48031.id148537.diff
Tue, Feb 11, 12:36 AM
Unknown Object (File)
Jan 9 2025, 1:54 PM
Unknown Object (File)
Jan 9 2025, 11:04 AM
Unknown Object (File)
Jan 9 2025, 10:24 AM
Unknown Object (File)
Jan 8 2025, 8:17 PM
Unknown Object (File)
Dec 26 2024, 11:17 AM
Unknown Object (File)
Dec 26 2024, 7:51 AM
Unknown Object (File)
Dec 26 2024, 7:13 AM
Subscribers

Details

Summary

If a format is unsupported, the feeder_build_* functions will fail
anyway, so bail out early to avoid unnecessary computation.

This is also needed by a series of upcoming patches to the feeder
framework.

Sponsored by: The FreeBSD Foundation
MFC after: 2 days

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 61398
Build 58282: arc lint + arc unit

Event Timeline

sys/dev/sound/pcm/feeder_chain.c
712

Maybe ENODEV would be better.

sys/dev/sound/pcm/feeder_chain.c
578–579

This seems redundant with AFMT_CONVERTIBLE from sound.h?

706–712

Below we handle *any* format with bitperfect / passthrough. If these cases never hit feeder_chain() then the code below is superfluous, but I suspect it's not. Which means we cannot bail out early here?

sys/dev/sound/pcm/feeder_chain.c
578–579

I am aware of it, but I thought the "convertible" part in the name would make the meaning of the operation non-obvious. I can however, use AFMT_CONVERTIBLE and add a comment, which should be fine.

706–712

That's a good point. I think the check could be moved to the else (non-bitperfect/non-passthrough) case instead.

christos marked 2 inline comments as done.
  • Use AFMT_CONVERTIBLE.
  • Move check inside non-bitperfect/passthrough case.