Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 6 Jul 2024 18:24:04 GMT
From:      Christos Margiolis <christos@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: f30af1f037a6 - main - sound: SNDCTL_AUDIOINFO: Do not skip physical channels if VCHANs are disabled
Message-ID:  <202407061824.466IO4bp090484@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by christos:

URL: https://cgit.FreeBSD.org/src/commit/?id=f30af1f037a68947edbabebc7ab495cd1b7a4ec8

commit f30af1f037a68947edbabebc7ab495cd1b7a4ec8
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2024-07-06 18:22:08 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2024-07-06 18:22:08 +0000

    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
---
 sys/dev/sound/pcm/dsp.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

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;
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202407061824.466IO4bp090484>