Page MenuHomeFreeBSD

sound: Bail out early if a format is not supported
ClosedPublic

Authored by christos on Dec 11 2024, 4:47 PM.
Tags
None
Referenced Files
F129445016: D48031.id148537.diff
Sat, Sep 20, 9:50 PM
Unknown Object (File)
Wed, Sep 10, 5:57 PM
Unknown Object (File)
Sat, Sep 6, 9:59 PM
Unknown Object (File)
Mon, Sep 1, 3:34 AM
Unknown Object (File)
Sun, Aug 24, 4:51 AM
Unknown Object (File)
Aug 10 2025, 5:10 AM
Unknown Object (File)
Aug 9 2025, 3:29 AM
Unknown Object (File)
Aug 7 2025, 8:32 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.
This revision was not accepted when it landed; it landed in state Needs Review.Feb 18 2025, 7:38 PM
This revision was automatically updated to reflect the committed changes.