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
Unknown Object (File)
Fri, Mar 14, 6:04 PM
Unknown Object (File)
Tue, Mar 11, 6:37 PM
Unknown Object (File)
Thu, Mar 6, 2:14 PM
Unknown Object (File)
Thu, Mar 6, 2:13 AM
Unknown Object (File)
Sun, Mar 2, 11:01 PM
Unknown Object (File)
Sun, Mar 2, 11:01 PM
Unknown Object (File)
Sun, Mar 2, 10:15 PM
Unknown Object (File)
Sun, Mar 2, 9:24 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 Not Applicable
Unit
Tests Not Applicable

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.Tue, Feb 18, 7:38 PM
This revision was automatically updated to reflect the committed changes.