diff options
author | Christos Margiolis <christos@FreeBSD.org> | 2024-07-06 18:22:08 +0000 |
---|---|---|
committer | Christos Margiolis <christos@FreeBSD.org> | 2024-07-06 18:22:08 +0000 |
commit | f30af1f037a68947edbabebc7ab495cd1b7a4ec8 (patch) | |
tree | 7ea7ce72ced40737039db7c90c806b2d2d99a0cd | |
parent | a9d7f098b86576006f5aeb312521bfde5ac77c77 (diff) | |
download | src-f30af1f037a68947edbabebc7ab495cd1b7a4ec8.tar.gz src-f30af1f037a68947edbabebc7ab495cd1b7a4ec8.zip |
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
-rw-r--r-- | sys/dev/sound/pcm/dsp.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c index 0eb41faaae45..6ac85635b080 100644 --- a/sys/dev/sound/pcm/dsp.c +++ b/sys/dev/sound/pcm/dsp.c @@ -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; } |