Page MenuHomeFreeBSD

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

Authored by christos on Wed, Dec 11, 4:47 PM.
Tags
None
Referenced Files
F107004326: D48031.diff
Wed, Jan 8, 8:17 PM
Unknown Object (File)
Thu, Dec 26, 11:17 AM
Unknown Object (File)
Thu, Dec 26, 7:51 AM
Unknown Object (File)
Thu, Dec 26, 7:13 AM
Unknown Object (File)
Thu, Dec 26, 3:12 AM
Unknown Object (File)
Mon, Dec 23, 3:38 PM
Unknown Object (File)
Sat, Dec 21, 9:07 PM
Unknown Object (File)
Wed, Dec 18, 5:11 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 61266
Build 58150: arc lint + arc unit

Event Timeline

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

Maybe ENODEV would be better.

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

This seems redundant with AFMT_CONVERTIBLE from sound.h?

700–706

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.

700–706

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.