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
F168239437: D48031.id148537.diff
Thu, Aug 27, 3:03 AM
Unknown Object (File)
Tue, Aug 25, 5:25 PM
Unknown Object (File)
Tue, Aug 25, 2:23 PM
Unknown Object (File)
Tue, Aug 25, 11:49 AM
Unknown Object (File)
Tue, Aug 25, 8:29 AM
Unknown Object (File)
Tue, Aug 25, 8:02 AM
Unknown Object (File)
Mon, Aug 24, 1:44 AM
Unknown Object (File)
Sun, Aug 23, 7:08 PM
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 61087
Build 57971: arc lint + arc unit

Event Timeline

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

Maybe ENODEV would be better.

sys/dev/sound/pcm/feeder_chain.c
572–573

This seems redundant with AFMT_CONVERTIBLE from sound.h?

703–709

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
572–573

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.

703–709

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.