Page MenuHomeFreeBSD

sound: Initialize channels with sane default rate and format
AcceptedPublic

Authored by christos on Sun, Jan 12, 12:55 AM.
Tags
None
Referenced Files
F108212828: D48434.diff
Wed, Jan 22, 5:25 PM
Unknown Object (File)
Fri, Jan 17, 9:36 AM
Unknown Object (File)
Fri, Jan 17, 9:36 AM
Unknown Object (File)
Thu, Jan 16, 10:57 PM
Unknown Object (File)
Thu, Jan 16, 6:59 AM
Unknown Object (File)
Tue, Jan 14, 9:33 PM
Unknown Object (File)
Tue, Jan 14, 6:32 PM
Subscribers

Details

Summary

There is no good reason to initialize with AFMT_U8 at 8000Hz.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

Diff Detail

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

Event Timeline

sys/dev/sound/pcm/channel.c
1212–1213

Shouldn't we try to match here what we set for vchanformat and vchanrate? That would be the driver's selected rate for example, at least with all your patches applied. Or maybe fix it the other way round, it's just that we already start with different settings here.

sys/dev/sound/pcm/channel.c
1212–1213

Without D47917, vchanrate and vchanformat are initialized after the first vchans' creation during attach, but because the primary channels are created first, they wouldn't be able to use vchanrate and vchanformat here, and would instead need to wait for the chn_reset()s in vchan_create() in order to get an actual speed & format. The vchan defaults are S16_LE:2.0 at 48000 Hz anyway, which is what I'm also doing here, so without any manual vchan settings, these values should be the same as vchanrate and vchanformat.

Without D47917, they are not initialized at all until the first vchan is created, so we can also not use them here.

I see now that there's a chn_reset() following this for primary channels, which means the defaults here may be overridden if not compatible. Also my concern was in conjunction with D48435, but I think we have to fix it there.

This revision is now accepted and ready to land.Tue, Jan 21, 7:58 PM