1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-30 08:19:09 +00:00

sound: SNDCTL_AUDIOINFO: Do not skip physical channels if VCHANs are disabled

Currently, we are skipping physical channels when servicing
SNDCTL_AUDIOINFO, and VCHANs when servicing SNDCTL_AUDIOINFO_EX.
However, if we call SNDCTL_AUDIOINFO with VCHANs disabled, we'll
eventually skip all channels, resulting in some of oss_audioinfo's
fields containing wrong information (e.g min/max_channels).

Fix this by adding an exception to SNDCTL_AUDIOINFO not to skip physical
channels when VCHANs are disabled.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch, emaste
Differential Revision:	https://reviews.freebsd.org/D45722
This commit is contained in:
Christos Margiolis 2024-07-06 20:22:08 +02:00
parent a9d7f098b8
commit f30af1f037

View File

@ -2159,9 +2159,13 @@ dsp_oss_audioinfo(struct cdev *i_dev, oss_audioinfo *ai, bool ex)
/*
* Skip physical channels if we are servicing SNDCTL_AUDIOINFO,
* or VCHANs if we are servicing SNDCTL_AUDIOINFO_EX.
*
* For SNDCTL_AUDIOINFO do not skip the physical channels if
* there are no VCHANs.
*/
if ((ex && (ch->flags & CHN_F_VIRTUAL) != 0) ||
(!ex && (ch->flags & CHN_F_VIRTUAL) == 0)) {
((!ex && (ch->flags & CHN_F_VIRTUAL) == 0) &&
(d->pvchancount > 0 || d->rvchancount > 0))) {
CHN_UNLOCK(ch);
continue;
}